Skip to contentSkip to conversation

preempt/hardirq.h: Fix comment about PREEMPT_ACTIVE bit location

PATCH In review Srivatsa S. Bhat 3 participants 7 messages Jul 20, 2012 – Aug 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 preempt/hardirq.h: Fix comment about PREEMPT_ACTIVE bit location

PREEMPT_ACTIVE flag is bit 27, not 28. Fix the comment.

---

 include/linux/hardirq.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hardirq.h +1 -1
index bb7f309..305f23c 100644
@@ -22,7 +22,7 @@
  *
  * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
  * - bit 26 is the NMI_MASK
- * - bit 28 is the PREEMPT_ACTIVE flag
+ * - bit 27 is the PREEMPT_ACTIVE flag
  *
  * PREEMPT_MASK: 0x000000ff
  * SOFTIRQ_MASK: 0x0000ff00
#1 lore raw

[tip:sched/urgent] sched: Fix comment about PREEMPT_ACTIVE bit location

Commit-ID:  a7e4786b937a3ae918a7520cfdba557a80915fa7
Gitweb:     http://git.kernel.org/tip/a7e4786b937a3ae918a7520cfdba557a80915fa7
Author:     Srivatsa S. Bhat <[email protected]>
AuthorDate: Sat, 21 Jul 2012 00:54:59 +0530
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 26 Jul 2012 13:54:58 +0200

sched: Fix comment about PREEMPT_ACTIVE bit location

PREEMPT_ACTIVE flag is bit 27, not 28. Fix the comment.

---
 include/linux/hardirq.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hardirq.h +1 -1
index bb7f309..305f23c 100644
@@ -22,7 +22,7 @@
  *
  * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
  * - bit 26 is the NMI_MASK
- * - bit 28 is the PREEMPT_ACTIVE flag
+ * - bit 27 is the PREEMPT_ACTIVE flag
  *
  * PREEMPT_MASK: 0x000000ff
  * SOFTIRQ_MASK: 0x0000ff00
#2 lore raw
In reply to Srivatsa S. Bhat
Quoted 13 lines · Srivatsa S. Bhat

PREEMPT_ACTIVE flag is bit 27, not 28. Fix the comment.

---

 include/linux/hardirq.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hardirq.h +0 -0
index bb7f309..305f23c 100644

include/linux/hardirq.h line 25

Quoted 5 lines
include/linux/hardirq.h +1 -1
@@ -22,7 +22,7 @@
  *
  * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
  * - bit 26 is the NMI_MASK
- * - bit 28 is the PREEMPT_ACTIVE flag
+ * - bit 27 is the PREEMPT_ACTIVE flag

Sorry but in arch/x86/include/asm/thread_info.h we have:

#define PREEMPT_ACTIVE 0x10000000

Which happens to be the 28th bit, not 27th. Although, if an arch did not define PREEMPT_ACTIVE it would be 27th.

Perhaps the correct thing to do is to say:

By default the following bits are defined as:

	[...]

Different architectures may modify these.

And then add your change.

-- Steve

Quoted 3 lines
include/linux/hardirq.h +0 -0
  *
  * PREEMPT_MASK: 0x000000ff
  * SOFTIRQ_MASK: 0x0000ff00
#3 lore raw
Quoted 27 lines · Steven Rostedt
Quoted 13 lines · Srivatsa S. Bhat

PREEMPT_ACTIVE flag is bit 27, not 28. Fix the comment.

---

 include/linux/hardirq.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hardirq.h +0 -0
index bb7f309..305f23c 100644

include/linux/hardirq.h line 25

Quoted 5 lines
include/linux/hardirq.h +1 -1
@@ -22,7 +22,7 @@
  *
  * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
  * - bit 26 is the NMI_MASK
- * - bit 28 is the PREEMPT_ACTIVE flag
+ * - bit 27 is the PREEMPT_ACTIVE flag

Sorry but in arch/x86/include/asm/thread_info.h we have:

#define PREEMPT_ACTIVE 0x10000000

Which happens to be the 28th bit, not 27th. Although, if an arch did not define PREEMPT_ACTIVE it would be 27th.

Quoted 8 lines

Perhaps the correct thing to do is to say:

By default the following bits are defined as:

	[...]

Different architectures may modify these.

And then add your change.

Thanks a lot for your suggestions Steve! And sorry for the delay.. I'll post the updated patch (which applies on latest Linus master) as a reply to this thread.

Regards,
Srivatsa S. Bhat

#4 lore raw

PATCH 1/1 preempt/hardirq.h: Clarify PREEMPT_ACTIVE bit location

In reply to Steven Rostedt

By default, the PREEMPT_ACTIVE flag is bit 27, but different architectures can override that. Update the comment to reflect this fact.

---

 include/linux/hardirq.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/hardirq.h +5 -0
index 305f23c..483aa60 100644
@@ -20,10 +20,15 @@
  * hardirq nesting. An arch may choose to give less than 10 bits.
  * m68k expects it to be 8.
  *
+ * By default, the bits are defined as shown below:
+ *
  * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
  * - bit 26 is the NMI_MASK
  * - bit 27 is the PREEMPT_ACTIVE flag
  *
+ * However, different architectures may override them. (For example,
+ * x86 defines bit 28 as the PREEMPT_ACTIVE flag).
+ *
  * PREEMPT_MASK: 0x000000ff
  * SOFTIRQ_MASK: 0x0000ff00
  * HARDIRQ_MASK: 0x03ff0000
#5 lore raw

Re: [PATCH] preempt/hardirq.h: Clarify PREEMPT_ACTIVE bit location

Quoted 4 lines · Srivatsa S. Bhat

By default, the PREEMPT_ACTIVE flag is bit 27, but different architectures can override that. Update the comment to reflect this fact.

Is there any sensible reason why architectures need to override that? I can't find one.

If there is none, then we should just remove all the overrides from the arch code instead. If there is a reason, then it should be documented.

Thanks,

tglx

#6 lore raw

Re: [PATCH] preempt/hardirq.h: Clarify PREEMPT_ACTIVE bit location

Quoted 7 lines · Thomas Gleixner
Quoted 4 lines · Srivatsa S. Bhat

By default, the PREEMPT_ACTIVE flag is bit 27, but different architectures can override that. Update the comment to reflect this fact.

Quoted 6 lines

Is there any sensible reason why architectures need to override that? I can't find one.

If there is none, then we should just remove all the overrides from the arch code instead. If there is a reason, then it should be documented.

IIRC, when I added the NMI bits to implement 'in_nmi()' I tried to make this work across archs. But I found that bits in the preempt count have been hard coded in assembly all over the place, and to clean it up looked to be a nightmare.

It probably should be done, but I didn't have the time to do it then. Perhaps we can revisit it.

In fact, looking at all the archs, I believe all archs override the PREEMPT_ACTIVE bit, and not one of them uses the default (bit 27).

-- Steve