[PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

2015-10-21 Thread roy . qing . li
From: Li RongQing  

when there are 4 cpus, but only one is available to schedule, the warning
will be generated when run the below command:
# perf record -g -e cpu-clock -- find / -name "*.ko"
CPU PMU: unable to set irq affinity (irq=28, cpu=1)
CPU PMU: unable to set irq affinity (irq=29, cpu=2)
CPU PMU: unable to set irq affinity (irq=30, cpu=3)

so ensure the cpu is available to scheduler when set irq affinity

Signed-off-by: Li RongQing 
---
 drivers/perf/arm_pmu.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2365a32..9401aa8 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -619,6 +619,9 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
if (cpu_pmu->irq_affinity)
cpu = cpu_pmu->irq_affinity[i];
 
+   if (!cpu_online(cpu))
+   continue;
+
if (!cpumask_test_and_clear_cpu(cpu, 
_pmu->active_irqs))
continue;
irq = platform_get_irq(pmu_device, i);
@@ -665,6 +668,9 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, 
irq_handler_t handler)
if (cpu_pmu->irq_affinity)
cpu = cpu_pmu->irq_affinity[i];
 
+   if (!cpu_online(cpu))
+   continue;
+
/*
 * If we have a single PMU interrupt that we can't 
shift,
 * assume that we're running on a uniprocessor machine 
and
-- 
2.1.4

--
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/


[PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

2015-10-21 Thread roy . qing . li
From: Li RongQing  

when there are 4 cpus, but only one is available to schedule, the warning
will be generated when run the below command:
# perf record -g -e cpu-clock -- find / -name "*.ko"
CPU PMU: unable to set irq affinity (irq=28, cpu=1)
CPU PMU: unable to set irq affinity (irq=29, cpu=2)
CPU PMU: unable to set irq affinity (irq=30, cpu=3)

so ensure the cpu is available to scheduler when set irq affinity

Signed-off-by: Li RongQing 
---
 drivers/perf/arm_pmu.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2365a32..9401aa8 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -619,6 +619,9 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
if (cpu_pmu->irq_affinity)
cpu = cpu_pmu->irq_affinity[i];
 
+   if (!cpu_online(cpu))
+   continue;
+
if (!cpumask_test_and_clear_cpu(cpu, 
_pmu->active_irqs))
continue;
irq = platform_get_irq(pmu_device, i);
@@ -665,6 +668,9 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, 
irq_handler_t handler)
if (cpu_pmu->irq_affinity)
cpu = cpu_pmu->irq_affinity[i];
 
+   if (!cpu_online(cpu))
+   continue;
+
/*
 * If we have a single PMU interrupt that we can't 
shift,
 * assume that we're running on a uniprocessor machine 
and
-- 
2.1.4

--
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/


[RFC][PATCH] signal: replace !likely with unlikely!

2014-09-10 Thread roy . qing . li
From: Li RongQing  

!likely() is hard to be understood, and I do not know if compiler can
optimise this condition, but unlikely(!()) is clear

Signed-off-by: Li RongQing 
---
 kernel/signal.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..6156cfa 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1571,7 +1571,7 @@ int send_sigqueue(struct sigqueue *q, struct task_struct 
*t, int group)
BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
 
ret = -1;
-   if (!likely(lock_task_sighand(t, )))
+   if (unlikely(!lock_task_sighand(t, )))
goto ret;
 
ret = 1; /* the signal is ignored */
-- 
1.7.10.4

--
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/


[RFC][PATCH] signal: replace !likely with unlikely!

2014-09-10 Thread roy . qing . li
From: Li RongQing roy.qing...@gmail.com 

!likely() is hard to be understood, and I do not know if compiler can
optimise this condition, but unlikely(!()) is clear

Signed-off-by: Li RongQing roy.qing...@gmail.com
---
 kernel/signal.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..6156cfa 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1571,7 +1571,7 @@ int send_sigqueue(struct sigqueue *q, struct task_struct 
*t, int group)
BUG_ON(!(q-flags  SIGQUEUE_PREALLOC));
 
ret = -1;
-   if (!likely(lock_task_sighand(t, flags)))
+   if (unlikely(!lock_task_sighand(t, flags)))
goto ret;
 
ret = 1; /* the signal is ignored */
-- 
1.7.10.4

--
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/