Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcontainer: intelrdt: fix a GetStats() issue #1615

Merged
merged 1 commit into from
Oct 18, 2017

Conversation

xiaochenshen
Copy link
Contributor

This fixes a GetStats() issue introduced in #1590:
If Intel RDT is enabled by hardware and kernel, but intelRdt is not
specified in original config, GetStats() will return error unexpectedly
because we haven't called Apply() to create intelrdt group or attach
tasks for this container. As a result, runc events command will have no
output.

Signed-off-by: Xiaochen Shen xiaochen.shen@intel.com

This fixes a GetStats() issue introduced in opencontainers#1590:
If Intel RDT is enabled by hardware and kernel, but intelRdt is not
specified in original config, GetStats() will return error unexpectedly
because we haven't called Apply() to create intelrdt group or attach
tasks for this container. As a result, runc events command will have no
output.

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
@@ -443,6 +443,11 @@ func (m *IntelRdtManager) GetPath() string {

// Returns statistics for Intel RDT
func (m *IntelRdtManager) GetStats() (*Stats, error) {
// If intelRdt is not specified in config
if m.Config.IntelRdt == nil {
return nil, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the calling code handle a nil, nil return or will it panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crosbymichael

Does the calling code handle a nil, nil return or will it panic?

It will not panic. In caller linuxContainer.Stats(): libcontainer.Stats.IntelRdtStats will be assigned to nil when intelRdtManager.GetStats() returns nil, nil.
And in events command, the caller convertLibcontainerStats() will handle the case when libcontainer.Stats.IntelRdtStats = nil

@crosbymichael
Copy link
Member

crosbymichael commented Oct 18, 2017

LGTM

Approved with PullApprove

@crosbymichael crosbymichael added this to the 1.0.0 milestone Oct 18, 2017
@cyphar
Copy link
Member

cyphar commented Oct 18, 2017

LGTM.

Approved with PullApprove

@cyphar cyphar merged commit d892175 into opencontainers:master Oct 18, 2017
cyphar added a commit that referenced this pull request Oct 18, 2017
  libcontainer: intelrdt: fix a GetStats() issue

LGTMs: @crosbymichael @cyphar
Closes #1615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants