[tip:irq/core] genirq: Clarify logic calculating bogus irqreturn_t values

2017-02-16 Thread tip-bot for Jeremy Kerr
Commit-ID:  5d4bac9a5f4ef24b2482529bda6661a58e5b5b65
Gitweb: http://git.kernel.org/tip/5d4bac9a5f4ef24b2482529bda6661a58e5b5b65
Author: Jeremy Kerr 
AuthorDate: Thu, 16 Feb 2017 12:24:09 +0800
Committer:  Thomas Gleixner 
CommitDate: Thu, 16 Feb 2017 15:32:19 +0100

genirq: Clarify logic calculating bogus irqreturn_t values

Although irqreturn_t is an enum, we treat it (and its enumeration
constants) as a bitmask.

However, bad_action_ret() uses a less-than operator to determine whether
an irqreturn_t falls within allowable bit values, which means we need to
know the signededness of an enum type to read the logic, which is
implementation-dependent.

This change explicitly uses an unsigned type for the comparison. We do
this instead of changing to a bitwise test, as the latter compiles to
increased instructions in this hot path.

It looks like we get the correct behaviour currently (bad_action_ret(-1)
returns 1), so this is purely a readability fix.

Signed-off-by: Jeremy Kerr 
Link: http://lkml.kernel.org/r/1487219049-4061-1-git-send-email...@ozlabs.org
Signed-off-by: Thomas Gleixner 

---
 kernel/irq/spurious.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 5707f97..061ba7e 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -175,7 +175,9 @@ out:
 
 static inline int bad_action_ret(irqreturn_t action_ret)
 {
-   if (likely(action_ret <= (IRQ_HANDLED | IRQ_WAKE_THREAD)))
+   unsigned int r = action_ret;
+
+   if (likely(r <= (IRQ_HANDLED | IRQ_WAKE_THREAD)))
return 0;
return 1;
 }


[tip:irq/core] genirq: Clarify logic calculating bogus irqreturn_t values

2017-02-16 Thread tip-bot for Jeremy Kerr
Commit-ID:  5d4bac9a5f4ef24b2482529bda6661a58e5b5b65
Gitweb: http://git.kernel.org/tip/5d4bac9a5f4ef24b2482529bda6661a58e5b5b65
Author: Jeremy Kerr 
AuthorDate: Thu, 16 Feb 2017 12:24:09 +0800
Committer:  Thomas Gleixner 
CommitDate: Thu, 16 Feb 2017 15:32:19 +0100

genirq: Clarify logic calculating bogus irqreturn_t values

Although irqreturn_t is an enum, we treat it (and its enumeration
constants) as a bitmask.

However, bad_action_ret() uses a less-than operator to determine whether
an irqreturn_t falls within allowable bit values, which means we need to
know the signededness of an enum type to read the logic, which is
implementation-dependent.

This change explicitly uses an unsigned type for the comparison. We do
this instead of changing to a bitwise test, as the latter compiles to
increased instructions in this hot path.

It looks like we get the correct behaviour currently (bad_action_ret(-1)
returns 1), so this is purely a readability fix.

Signed-off-by: Jeremy Kerr 
Link: http://lkml.kernel.org/r/1487219049-4061-1-git-send-email...@ozlabs.org
Signed-off-by: Thomas Gleixner 

---
 kernel/irq/spurious.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 5707f97..061ba7e 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -175,7 +175,9 @@ out:
 
 static inline int bad_action_ret(irqreturn_t action_ret)
 {
-   if (likely(action_ret <= (IRQ_HANDLED | IRQ_WAKE_THREAD)))
+   unsigned int r = action_ret;
+
+   if (likely(r <= (IRQ_HANDLED | IRQ_WAKE_THREAD)))
return 0;
return 1;
 }


[tip:sched/core] powerpc/spufs: Remove MAX_USER_PRIO define

2014-02-11 Thread tip-bot for Jeremy Kerr
Commit-ID:  74b8af7837fa55c020e2ad1b34a6b10dfe25a9b1
Gitweb: http://git.kernel.org/tip/74b8af7837fa55c020e2ad1b34a6b10dfe25a9b1
Author: Jeremy Kerr 
AuthorDate: Tue, 11 Feb 2014 14:05:17 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 11 Feb 2014 09:58:33 +0100

powerpc/spufs: Remove MAX_USER_PRIO define

Current ppc64_defconfig fails with:

 arch/powerpc/platforms/cell/spufs/sched.c:86:0: error: "MAX_USER_PRIO" 
redefined [-Werror]
 cc1: all warnings being treated as errors

Commit 6b6350f155af ("sched: Expose some macros related to priority")
introduced a generic MAX_USER_PRIO macro to sched/prio.h, which is
causing the conflit. Use that one instead of our own.

Reported-by: Fengguang Wu 
Reported-by: Stephen Rothwell 
Signed-off-by: Jeremy Kerr 
Cc: Dongsheng Yang 
Cc: linuxppc-...@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1392098717.689604.970589769393.1.gpush@pablo
Signed-off-by: Ingo Molnar 
---
 arch/powerpc/platforms/cell/spufs/sched.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c 
b/arch/powerpc/platforms/cell/spufs/sched.c
index 4931838..4a0a64f 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -83,7 +83,6 @@ static struct timer_list spuloadavg_timer;
 #define MIN_SPU_TIMESLICE  max(5 * HZ / (1000 * SPUSCHED_TICK), 1)
 #define DEF_SPU_TIMESLICE  (100 * HZ / (1000 * SPUSCHED_TICK))
 
-#define MAX_USER_PRIO  (MAX_PRIO - MAX_RT_PRIO)
 #define SCALE_PRIO(x, prio) \
max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_SPU_TIMESLICE)
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/core] powerpc/spufs: Remove MAX_USER_PRIO define

2014-02-11 Thread tip-bot for Jeremy Kerr
Commit-ID:  74b8af7837fa55c020e2ad1b34a6b10dfe25a9b1
Gitweb: http://git.kernel.org/tip/74b8af7837fa55c020e2ad1b34a6b10dfe25a9b1
Author: Jeremy Kerr j...@ozlabs.org
AuthorDate: Tue, 11 Feb 2014 14:05:17 +0800
Committer:  Ingo Molnar mi...@kernel.org
CommitDate: Tue, 11 Feb 2014 09:58:33 +0100

powerpc/spufs: Remove MAX_USER_PRIO define

Current ppc64_defconfig fails with:

 arch/powerpc/platforms/cell/spufs/sched.c:86:0: error: MAX_USER_PRIO 
redefined [-Werror]
 cc1: all warnings being treated as errors

Commit 6b6350f155af (sched: Expose some macros related to priority)
introduced a generic MAX_USER_PRIO macro to sched/prio.h, which is
causing the conflit. Use that one instead of our own.

Reported-by: Fengguang Wu fengguang...@intel.com
Reported-by: Stephen Rothwell s...@canb.auug.org.au
Signed-off-by: Jeremy Kerr j...@ozlabs.org
Cc: Dongsheng Yang yangds.f...@cn.fujitsu.com
Cc: linuxppc-...@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1392098717.689604.970589769393.1.gpush@pablo
Signed-off-by: Ingo Molnar mi...@kernel.org
---
 arch/powerpc/platforms/cell/spufs/sched.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c 
b/arch/powerpc/platforms/cell/spufs/sched.c
index 4931838..4a0a64f 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -83,7 +83,6 @@ static struct timer_list spuloadavg_timer;
 #define MIN_SPU_TIMESLICE  max(5 * HZ / (1000 * SPUSCHED_TICK), 1)
 #define DEF_SPU_TIMESLICE  (100 * HZ / (1000 * SPUSCHED_TICK))
 
-#define MAX_USER_PRIO  (MAX_PRIO - MAX_RT_PRIO)
 #define SCALE_PRIO(x, prio) \
max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_SPU_TIMESLICE)
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/