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

Add kpreempt_disable/enable around CPU_SEQID uses to fix kernel BUG warnings #6239

Merged
merged 1 commit into from
Jun 19, 2017

Conversation

numinit
Copy link
Contributor

@numinit numinit commented Jun 16, 2017

Description

In zfs/dmu_object and icp/core/kcf_sched, the CPU_SEQID macro should be surrounded by kpreempt_disable and kpreempt_enable calls to avoid a Linux kernel BUG warning.

Motivation and Context

Remediating frequent (but mostly harmless) Linux kernel BUG warnings during use of the ZFS 0.7 release candidate (see #6232)

How Has This Been Tested?

Compiled and installed the module. The system affected by #6232 no longer gets these BUG warnings in its dmesg.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

@numinit numinit force-pushed the fix-cpu-seqid-preemption branch 3 times, most recently from 1208c91 to ea52ad9 Compare June 16, 2017 22:23
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

The code looks good, but we'll want to drop the slightly misleading comment (explained inline). Also when you refresh this please add your signed-off-by to the commit message so we can merge it.

/*
* Pick the current CPU. We need to disable preemption to ensure that
* we don't get interrupted (and pick the wrong CPU).
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case it isn't really about picking the wrong cpu, it's about using the current cpu as a hint to minimize lock contention. The code is written is such a way that it's safe for this function to be rescheduled at any time to a different cpu. I'd suggest dropping the comment here to avoid any confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@numinit numinit force-pushed the fix-cpu-seqid-preemption branch from ea52ad9 to 418aa38 Compare June 17, 2017 02:54
In zfs/dmu_object and icp/core/kcf_sched, the CPU_SEQID macro
should be surrounded by `kpreempt_disable` and `kpreempt_enable`
calls to avoid a Linux kernel BUG warning.

Signed-off-by: Morgan Jones <me@numin.it>
@numinit numinit force-pushed the fix-cpu-seqid-preemption branch from 418aa38 to cea8810 Compare June 17, 2017 02:56
@behlendorf
Copy link
Contributor

@numinit were you able to verify this resolved the warnings.

@numinit
Copy link
Contributor Author

numinit commented Jun 19, 2017

Yes, this resolves the warnings for me. Removing the testing WIP label.

@numinit numinit changed the title [testing WIP] Add kpreempt_disable/enable around CPU_SEQID uses Add kpreempt_disable/enable around CPU_SEQID uses to fix kernel BUG warnings Jun 19, 2017
@behlendorf
Copy link
Contributor

@numinit great, thanks for the confirmation. Will merge.

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.

2 participants