linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] blackfin: convet cpumask apis
@ 2011-04-25  9:27 KOSAKI Motohiro
  2011-04-25  9:28 ` [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-25  9:27 UTC (permalink / raw)
  To: Michael Hennerich, device-driver-devel, LKML, Andrew Morton
  Cc: kosaki.motohiro


Rusty Russle introduced a lot of cpumask related APIs. and He gone even
though the work is unfinished. This patch series is sequel of his work.

No functional change. only api change.

note: I've confirmed only cross-compile build. so, I hope blackfin
developers see the code.


KOSAKI Motohiro (4):
  blackfin: remove unused function
  blackfin: don't touch cpu_possible_map and cpu_present_map directly
  blackfin: don't touch task->cpus_allowed directly
  blackfin: convert old cpumask API to new one

 arch/blackfin/kernel/nmi.c                  |    8 ++--
 arch/blackfin/kernel/process.c              |    6 +--
 arch/blackfin/kernel/setup.c                |    4 +-
 arch/blackfin/mach-bf561/include/mach/smp.h |    2 -
 arch/blackfin/mach-bf561/smp.c              |   27 ++++-------
 arch/blackfin/mach-common/dpmc.c            |    7 ++-
 arch/blackfin/mach-common/smp.c             |   27 ++++++-----



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/4] blackfin: remove unused function
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
@ 2011-04-25  9:28 ` KOSAKI Motohiro
  2011-04-25  9:29 ` [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-25  9:28 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, Michael Hennerich, device-driver-devel, LKML,
	Andrew Morton


platform_send_ipi() has old call-by-value cpumask_t fashon and
it's unused.

Then, this patch removes it.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: device-driver-devel@blackfin.uclinux.org
---
 arch/blackfin/mach-bf561/include/mach/smp.h |    2 --
 arch/blackfin/mach-bf561/smp.c              |   13 -------------
 2 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/blackfin/mach-bf561/include/mach/smp.h b/arch/blackfin/mach-bf561/include/mach/smp.h
index 346c605..36e2ac5 100644
--- a/arch/blackfin/mach-bf561/include/mach/smp.h
+++ b/arch/blackfin/mach-bf561/include/mach/smp.h
@@ -21,8 +21,6 @@ void platform_secondary_init(unsigned int cpu);
 
 void platform_request_ipi(int irq, /*irq_handler_t*/ void *handler);
 
-void platform_send_ipi(cpumask_t callmap, int irq);
-
 void platform_send_ipi_cpu(unsigned int cpu, int irq);
 
 void platform_clear_ipi(unsigned int cpu, int irq);
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index 7b07740..630e2c2 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -116,19 +116,6 @@ void __init platform_request_ipi(int irq, void *handler)
 		panic("Cannot request %s for IPI service", name);
 }
 
-void platform_send_ipi(cpumask_t callmap, int irq)
-{
-	unsigned int cpu;
-	int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8;
-
-	for_each_cpu_mask(cpu, callmap) {
-		BUG_ON(cpu >= 2);
-		SSYNC();
-		bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu)));
-		SSYNC();
-	}
-}
-
 void platform_send_ipi_cpu(unsigned int cpu, int irq)
 {
 	int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8;
-- 
1.7.3.1




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
  2011-04-25  9:28 ` [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
@ 2011-04-25  9:29 ` KOSAKI Motohiro
  2011-04-25  9:31 ` [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-25  9:29 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, Michael Hennerich, device-driver-devel, LKML,
	Andrew Morton

We plan to remove cpu_possible_map and cpu_present_map later and we
have proper init_cpu_possible() and init_cpu_present() APIs.

Therefore this patch rewrites platform_init_cpus and platform_prepare_cpus
by their APIs.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: device-driver-devel@blackfin.uclinux.org
---
 arch/blackfin/mach-bf561/smp.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index 630e2c2..2fca469 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -24,17 +24,23 @@ static DEFINE_SPINLOCK(boot_lock);
 
 void __init platform_init_cpus(void)
 {
-	cpu_set(0, cpu_possible_map); /* CoreA */
-	cpu_set(1, cpu_possible_map); /* CoreB */
+	struct cpumask mask;
+
+	cpumask_set_cpu(0, &mask); /* CoreA */
+	cpumask_set_cpu(1, &mask); /* CoreB */
+	init_cpu_possible(&mask);
 }
 
 void __init platform_prepare_cpus(unsigned int max_cpus)
 {
+	struct cpumask mask;
+
 	bfin_relocate_coreb_l1_mem();
 
 	/* Both cores ought to be present on a bf561! */
-	cpu_set(0, cpu_present_map); /* CoreA */
-	cpu_set(1, cpu_present_map); /* CoreB */
+	cpumask_set_cpu(0, &mask); /* CoreA */
+	cpumask_set_cpu(1, &mask); /* CoreB */
+	init_cpu_present(&mask);
 }
 
 int __init setup_profiling_timer(unsigned int multiplier) /* not supported */
-- 
1.7.3.1




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
  2011-04-25  9:28 ` [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
  2011-04-25  9:29 ` [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
@ 2011-04-25  9:31 ` KOSAKI Motohiro
  2011-04-25  9:32 ` [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-25  9:31 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, Michael Hennerich, device-driver-devel, LKML,
	Andrew Morton

Every callter (except kthread_bind) should use proper
set_cpus_allowed_ptr() APIs.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: device-driver-devel@blackfin.uclinux.org
---

I'm curious why this mysterious code is necessary. Why sys_clone()
restrict allowed cpus automatically and why don't it restore the restriction
when do_fork() is finished.

 arch/blackfin/kernel/process.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index b407bc8..6a660fa 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -171,10 +171,8 @@ asmlinkage int bfin_clone(struct pt_regs *regs)
 	unsigned long newsp;
 
 #ifdef __ARCH_SYNC_CORE_DCACHE
-	if (current->rt.nr_cpus_allowed == num_possible_cpus()) {
-		current->cpus_allowed = cpumask_of_cpu(smp_processor_id());
-		current->rt.nr_cpus_allowed = 1;
-	}
+	if (current->rt.nr_cpus_allowed == num_possible_cpus())
+		set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id()));
 #endif
 
 	/* syscall2 puts clone_flags in r0 and usp in r1 */
-- 
1.7.3.1




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/4] blackfin: convert old cpumask API to new one
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
                   ` (2 preceding siblings ...)
  2011-04-25  9:31 ` [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
@ 2011-04-25  9:32 ` KOSAKI Motohiro
  2011-04-25 18:11 ` [PATCH 0/4] blackfin: convet cpumask apis Mike Frysinger
  2011-04-26 18:26 ` [PATCH 0/4] blackfin: convet cpumask apis Thiago Farina
  5 siblings, 0 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-25  9:32 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, Michael Hennerich, device-driver-devel, LKML,
	Andrew Morton

old cpu_xxx() APIs is planned to removed later. then, converted.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: device-driver-devel@blackfin.uclinux.org
---
 arch/blackfin/kernel/nmi.c       |    8 ++++----
 arch/blackfin/kernel/setup.c     |    4 ++--
 arch/blackfin/mach-common/dpmc.c |    7 ++++---
 arch/blackfin/mach-common/smp.c  |   27 ++++++++++++++-------------
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/arch/blackfin/kernel/nmi.c b/arch/blackfin/kernel/nmi.c
index 0b5f72f..7af8b70 100644
--- a/arch/blackfin/kernel/nmi.c
+++ b/arch/blackfin/kernel/nmi.c
@@ -145,16 +145,16 @@ int check_nmi_wdt_touched(void)
 {
 	unsigned int this_cpu = smp_processor_id();
 	unsigned int cpu;
+	cpumask_t mask;
 
-	cpumask_t mask = cpu_online_map;
-
+	cpumask_copy(&mask, cpu_online_mask);
 	if (!atomic_read(&nmi_touched[this_cpu]))
 		return 0;
 
 	atomic_set(&nmi_touched[this_cpu], 0);
 
-	cpu_clear(this_cpu, mask);
-	for_each_cpu_mask(cpu, mask) {
+	cpumask_clear_cpu(this_cpu, &mask);
+	for_each_cpu(cpu,&mask) {
 		invalidate_dcache_range((unsigned long)(&nmi_touched[cpu]),
 				(unsigned long)(&nmi_touched[cpu]));
 		if (!atomic_read(&nmi_touched[cpu]))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 805c613..c00c87b 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1326,7 +1326,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
 	if (*pos == 0)
-		*pos = first_cpu(cpu_online_map);
+		*pos = cpumask_first(cpu_online_mask);
 	if (*pos >= num_online_cpus())
 		return NULL;
 
@@ -1335,7 +1335,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 {
-	*pos = next_cpu(*pos, cpu_online_map);
+	*pos = cpumask_next(*pos, cpu_online_mask);
 
 	return c_start(m, pos);
 }
diff --git a/arch/blackfin/mach-common/dpmc.c b/arch/blackfin/mach-common/dpmc.c
index 382099f..6ea2921 100644
--- a/arch/blackfin/mach-common/dpmc.c
+++ b/arch/blackfin/mach-common/dpmc.c
@@ -88,10 +88,11 @@ static void bfin_wakeup_cpu(void)
 {
 	unsigned int cpu;
 	unsigned int this_cpu = smp_processor_id();
-	cpumask_t mask = cpu_online_map;
+	cpumask_t mask;
 
-	cpu_clear(this_cpu, mask);
-	for_each_cpu_mask(cpu, mask)
+	cpumask_copy(&mask, cpu_online_mask);
+	cpumask_clear_cpu(this_cpu, &mask);
+	for_each_cpu(cpu, &mask)
 		platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0);
 }
 
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 1fbd94c..f430bba 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -96,7 +96,7 @@ static void ipi_cpu_stop(unsigned int cpu)
 	dump_stack();
 	spin_unlock(&stop_lock);
 
-	cpu_clear(cpu, cpu_online_map);
+	set_cpu_online(cpu, false);
 
 	local_irq_disable();
 
@@ -146,7 +146,7 @@ static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
 		 */
 		resync_core_dcache();
 #endif
-		cpu_clear(cpu, *msg->call_struct.waitmask);
+		cpumask_clear_cpu(cpu, msg->call_struct.waitmask);
 	}
 }
 
@@ -222,9 +222,10 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type,
 	struct ipi_message_queue *msg_queue;
 	struct ipi_message *msg;
 	unsigned long flags, next_msg;
-	cpumask_t waitmask = callmap; /* waitmask is shared by all cpus */
+	cpumask_t waitmask; /* waitmask is shared by all cpus */
 
-	for_each_cpu_mask(cpu, callmap) {
+	cpumask_copy(&waitmask, &callmap);
+	for_each_cpu(cpu, &callmap) {
 		msg_queue = &per_cpu(ipi_msg_queue, cpu);
 		spin_lock_irqsave(&msg_queue->lock, flags);
 		if (msg_queue->count < BFIN_IPI_MSGQ_LEN) {
@@ -246,7 +247,7 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type,
 	}
 
 	if (wait) {
-		while (!cpus_empty(waitmask))
+		while (!cpumask_empty(&waitmask))
 			blackfin_dcache_invalidate_range(
 				(unsigned long)(&waitmask),
 				(unsigned long)(&waitmask));
@@ -265,9 +266,9 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)
 	cpumask_t callmap;
 
 	preempt_disable();
-	callmap = cpu_online_map;
-	cpu_clear(smp_processor_id(), callmap);
-	if (!cpus_empty(callmap))
+	cpumask_copy(&callmap, cpu_online_mask);
+	cpumask_clear_cpu(smp_processor_id(), &callmap);
+	if (!cpumask_empty(&callmap))
 		smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
 
 	preempt_enable();
@@ -284,8 +285,8 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
 
 	if (cpu_is_offline(cpu))
 		return 0;
-	cpus_clear(callmap);
-	cpu_set(cpu, callmap);
+	cpumask_clear(&callmap);
+	cpumask_set_cpu(cpu, &callmap);
 
 	smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
 
@@ -308,9 +309,9 @@ void smp_send_stop(void)
 	cpumask_t callmap;
 
 	preempt_disable();
-	callmap = cpu_online_map;
-	cpu_clear(smp_processor_id(), callmap);
-	if (!cpus_empty(callmap))
+	cpumask_copy(&callmap, cpu_online_mask);
+	cpumask_clear_cpu(smp_processor_id(), &callmap);
+	if (!cpumask_empty(&callmap))
 		smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0);
 
 	preempt_enable();
-- 
1.7.3.1




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/4] blackfin: convet cpumask apis
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
                   ` (3 preceding siblings ...)
  2011-04-25  9:32 ` [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
@ 2011-04-25 18:11 ` Mike Frysinger
  2011-04-25 18:18   ` Mike Frysinger
  2011-04-26 18:26 ` [PATCH 0/4] blackfin: convet cpumask apis Thiago Farina
  5 siblings, 1 reply; 17+ messages in thread
From: Mike Frysinger @ 2011-04-25 18:11 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Michael Hennerich, device-driver-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 05:27, KOSAKI Motohiro wrote:
> Rusty Russle introduced a lot of cpumask related APIs. and He gone even
> though the work is unfinished. This patch series is sequel of his work.
>
> No functional change. only api change.
>
> note: I've confirmed only cross-compile build. so, I hope blackfin
> developers see the code.

fyi, device-driver-devel@b.u.o is for general device drivers while
uclinux-dist-devel@b.u.o is for Blackfin arch work
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/4] blackfin: convet cpumask apis
  2011-04-25 18:11 ` [PATCH 0/4] blackfin: convet cpumask apis Mike Frysinger
@ 2011-04-25 18:18   ` Mike Frysinger
  2011-04-26  1:49     ` KOSAKI Motohiro
  0 siblings, 1 reply; 17+ messages in thread
From: Mike Frysinger @ 2011-04-25 18:18 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Michael Hennerich, device-driver-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 14:11, Mike Frysinger wrote:
> On Mon, Apr 25, 2011 at 05:27, KOSAKI Motohiro wrote:
>> Rusty Russle introduced a lot of cpumask related APIs. and He gone even
>> though the work is unfinished. This patch series is sequel of his work.
>>
>> No functional change. only api change.
>>
>> note: I've confirmed only cross-compile build. so, I hope blackfin
>> developers see the code.
>
> fyi, device-driver-devel@b.u.o is for general device drivers while
> uclinux-dist-devel@b.u.o is for Blackfin arch work

oh, and i guess you typo-ed the list name since it's
"device-drivers-devel" ;).  probably better to resend the series and
not cc Michael (since he doesnt watch over Blackfin anymore).
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/4] blackfin: convet cpumask apis
  2011-04-25 18:18   ` Mike Frysinger
@ 2011-04-26  1:49     ` KOSAKI Motohiro
  2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
  0 siblings, 1 reply; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-26  1:49 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: kosaki.motohiro, Michael Hennerich, device-driver-devel, LKML,
	Andrew Morton

> On Mon, Apr 25, 2011 at 14:11, Mike Frysinger wrote:
> > On Mon, Apr 25, 2011 at 05:27, KOSAKI Motohiro wrote:
> >> Rusty Russle introduced a lot of cpumask related APIs. and He gone even
> >> though the work is unfinished. This patch series is sequel of his work.
> >>
> >> No functional change. only api change.
> >>
> >> note: I've confirmed only cross-compile build. so, I hope blackfin
> >> developers see the code.
> >
> > fyi, device-driver-devel@b.u.o is for general device drivers while
> > uclinux-dist-devel@b.u.o is for Blackfin arch work
> 
> oh, and i guess you typo-ed the list name since it's
> "device-drivers-devel" ;).  probably better to resend the series and
> not cc Michael (since he doesnt watch over Blackfin anymore).

I'm sorry. Will do.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* (resend) [PATCH 1/4] blackfin: remove unused function
  2011-04-26  1:49     ` KOSAKI Motohiro
@ 2011-04-26  1:53       ` KOSAKI Motohiro
  2011-04-26  1:55         ` (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
                           ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-26  1:53 UTC (permalink / raw)
  To: uclinux-dist-devel; +Cc: kosaki.motohiro, Mike Frysinger, LKML, Andrew Morton

platform_send_ipi() has old call-by-value cpumask_t fashon and
it's unused.

Then, this patch removes it.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org

---
 arch/blackfin/mach-bf561/include/mach/smp.h |    2 --
 arch/blackfin/mach-bf561/smp.c              |   13 -------------
 2 files changed, 0 insertions(+), 15 deletions(-)

I sent this parch to wrong address (device-driver-devel@blackfin.uclinux.org).
thus now I'm resending it.


diff --git a/arch/blackfin/mach-bf561/include/mach/smp.h b/arch/blackfin/mach-bf561/include/mach/smp.h
index 346c605..36e2ac5 100644
--- a/arch/blackfin/mach-bf561/include/mach/smp.h
+++ b/arch/blackfin/mach-bf561/include/mach/smp.h
@@ -21,8 +21,6 @@ void platform_secondary_init(unsigned int cpu);
 
 void platform_request_ipi(int irq, /*irq_handler_t*/ void *handler);
 
-void platform_send_ipi(cpumask_t callmap, int irq);
-
 void platform_send_ipi_cpu(unsigned int cpu, int irq);
 
 void platform_clear_ipi(unsigned int cpu, int irq);
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index 7b07740..630e2c2 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -116,19 +116,6 @@ void __init platform_request_ipi(int irq, void *handler)
 		panic("Cannot request %s for IPI service", name);
 }
 
-void platform_send_ipi(cpumask_t callmap, int irq)
-{
-	unsigned int cpu;
-	int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8;
-
-	for_each_cpu_mask(cpu, callmap) {
-		BUG_ON(cpu >= 2);
-		SSYNC();
-		bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu)));
-		SSYNC();
-	}
-}
-
 void platform_send_ipi_cpu(unsigned int cpu, int irq)
 {
 	int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8;
-- 
1.7.3.1






^ permalink raw reply related	[flat|nested] 17+ messages in thread

* (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly
  2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
@ 2011-04-26  1:55         ` KOSAKI Motohiro
  2011-05-13  2:45           ` Mike Frysinger
  2011-04-26  1:56         ` (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-26  1:55 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, uclinux-dist-devel, Mike Frysinger, LKML,
	Andrew Morton

We plan to remove cpu_possible_map and cpu_present_map later and we
have proper init_cpu_possible() and init_cpu_present() APIs.

Therefore this patch rewrites platform_init_cpus and platform_prepare_cpus
by their APIs.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---
 arch/blackfin/mach-bf561/smp.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

I sent this parch to wrong address (device-driver-devel@blackfin.uclinux.org).
thus now I'm resending it.

diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index 630e2c2..2fca469 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -24,17 +24,23 @@ static DEFINE_SPINLOCK(boot_lock);
 
 void __init platform_init_cpus(void)
 {
-	cpu_set(0, cpu_possible_map); /* CoreA */
-	cpu_set(1, cpu_possible_map); /* CoreB */
+	struct cpumask mask;
+
+	cpumask_set_cpu(0, &mask); /* CoreA */
+	cpumask_set_cpu(1, &mask); /* CoreB */
+	init_cpu_possible(&mask);
 }
 
 void __init platform_prepare_cpus(unsigned int max_cpus)
 {
+	struct cpumask mask;
+
 	bfin_relocate_coreb_l1_mem();
 
 	/* Both cores ought to be present on a bf561! */
-	cpu_set(0, cpu_present_map); /* CoreA */
-	cpu_set(1, cpu_present_map); /* CoreB */
+	cpumask_set_cpu(0, &mask); /* CoreA */
+	cpumask_set_cpu(1, &mask); /* CoreB */
+	init_cpu_present(&mask);
 }
 
 int __init setup_profiling_timer(unsigned int multiplier) /* not supported */
-- 
1.7.3.1






^ permalink raw reply related	[flat|nested] 17+ messages in thread

* (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly
  2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
  2011-04-26  1:55         ` (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
@ 2011-04-26  1:56         ` KOSAKI Motohiro
  2011-05-13  2:47           ` Mike Frysinger
  2011-04-26  1:57         ` (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
  2011-04-26  4:47         ` (resend) [PATCH 1/4] blackfin: remove unused function Mike Frysinger
  3 siblings, 1 reply; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-26  1:56 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, uclinux-dist-devel, Mike Frysinger, LKML,
	Andrew Morton

Every callter (except kthread_bind) should use proper
set_cpus_allowed_ptr() APIs.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---

I'm curious why this mysterious code is necessary. Why sys_clone()
restrict allowed cpus automatically and why don't it restore the restriction
when do_fork() is finished.

ps: I sent this parch to wrong address (device-driver-devel@blackfin.uclinux.org).
thus now I'm resending it.


 arch/blackfin/kernel/process.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index b407bc8..6a660fa 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -171,10 +171,8 @@ asmlinkage int bfin_clone(struct pt_regs *regs)
 	unsigned long newsp;
 
 #ifdef __ARCH_SYNC_CORE_DCACHE
-	if (current->rt.nr_cpus_allowed == num_possible_cpus()) {
-		current->cpus_allowed = cpumask_of_cpu(smp_processor_id());
-		current->rt.nr_cpus_allowed = 1;
-	}
+	if (current->rt.nr_cpus_allowed == num_possible_cpus())
+		set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id()));
 #endif
 
 	/* syscall2 puts clone_flags in r0 and usp in r1 */
-- 
1.7.3.1






^ permalink raw reply related	[flat|nested] 17+ messages in thread

* (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one
  2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
  2011-04-26  1:55         ` (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
  2011-04-26  1:56         ` (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
@ 2011-04-26  1:57         ` KOSAKI Motohiro
  2011-05-13  2:51           ` Mike Frysinger
  2011-04-26  4:47         ` (resend) [PATCH 1/4] blackfin: remove unused function Mike Frysinger
  3 siblings, 1 reply; 17+ messages in thread
From: KOSAKI Motohiro @ 2011-04-26  1:57 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: kosaki.motohiro, uclinux-dist-devel, Mike Frysinger, LKML,
	Andrew Morton

old cpu_xxx() APIs is planned to removed later. then, converted.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---

I sent this parch to wrong address (device-driver-devel@blackfin.uclinux.org).
thus now I'm resending it.



 arch/blackfin/kernel/nmi.c       |    8 ++++----
 arch/blackfin/kernel/setup.c     |    4 ++--
 arch/blackfin/mach-common/dpmc.c |    7 ++++---
 arch/blackfin/mach-common/smp.c  |   27 ++++++++++++++-------------
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/arch/blackfin/kernel/nmi.c b/arch/blackfin/kernel/nmi.c
index 0b5f72f..7af8b70 100644
--- a/arch/blackfin/kernel/nmi.c
+++ b/arch/blackfin/kernel/nmi.c
@@ -145,16 +145,16 @@ int check_nmi_wdt_touched(void)
 {
 	unsigned int this_cpu = smp_processor_id();
 	unsigned int cpu;
+	cpumask_t mask;
 
-	cpumask_t mask = cpu_online_map;
-
+	cpumask_copy(&mask, cpu_online_mask);
 	if (!atomic_read(&nmi_touched[this_cpu]))
 		return 0;
 
 	atomic_set(&nmi_touched[this_cpu], 0);
 
-	cpu_clear(this_cpu, mask);
-	for_each_cpu_mask(cpu, mask) {
+	cpumask_clear_cpu(this_cpu, &mask);
+	for_each_cpu(cpu,&mask) {
 		invalidate_dcache_range((unsigned long)(&nmi_touched[cpu]),
 				(unsigned long)(&nmi_touched[cpu]));
 		if (!atomic_read(&nmi_touched[cpu]))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 805c613..c00c87b 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1326,7 +1326,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
 	if (*pos == 0)
-		*pos = first_cpu(cpu_online_map);
+		*pos = cpumask_first(cpu_online_mask);
 	if (*pos >= num_online_cpus())
 		return NULL;
 
@@ -1335,7 +1335,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 {
-	*pos = next_cpu(*pos, cpu_online_map);
+	*pos = cpumask_next(*pos, cpu_online_mask);
 
 	return c_start(m, pos);
 }
diff --git a/arch/blackfin/mach-common/dpmc.c b/arch/blackfin/mach-common/dpmc.c
index 382099f..6ea2921 100644
--- a/arch/blackfin/mach-common/dpmc.c
+++ b/arch/blackfin/mach-common/dpmc.c
@@ -88,10 +88,11 @@ static void bfin_wakeup_cpu(void)
 {
 	unsigned int cpu;
 	unsigned int this_cpu = smp_processor_id();
-	cpumask_t mask = cpu_online_map;
+	cpumask_t mask;
 
-	cpu_clear(this_cpu, mask);
-	for_each_cpu_mask(cpu, mask)
+	cpumask_copy(&mask, cpu_online_mask);
+	cpumask_clear_cpu(this_cpu, &mask);
+	for_each_cpu(cpu, &mask)
 		platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0);
 }
 
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 1fbd94c..f430bba 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -96,7 +96,7 @@ static void ipi_cpu_stop(unsigned int cpu)
 	dump_stack();
 	spin_unlock(&stop_lock);
 
-	cpu_clear(cpu, cpu_online_map);
+	set_cpu_online(cpu, false);
 
 	local_irq_disable();
 
@@ -146,7 +146,7 @@ static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
 		 */
 		resync_core_dcache();
 #endif
-		cpu_clear(cpu, *msg->call_struct.waitmask);
+		cpumask_clear_cpu(cpu, msg->call_struct.waitmask);
 	}
 }
 
@@ -222,9 +222,10 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type,
 	struct ipi_message_queue *msg_queue;
 	struct ipi_message *msg;
 	unsigned long flags, next_msg;
-	cpumask_t waitmask = callmap; /* waitmask is shared by all cpus */
+	cpumask_t waitmask; /* waitmask is shared by all cpus */
 
-	for_each_cpu_mask(cpu, callmap) {
+	cpumask_copy(&waitmask, &callmap);
+	for_each_cpu(cpu, &callmap) {
 		msg_queue = &per_cpu(ipi_msg_queue, cpu);
 		spin_lock_irqsave(&msg_queue->lock, flags);
 		if (msg_queue->count < BFIN_IPI_MSGQ_LEN) {
@@ -246,7 +247,7 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type,
 	}
 
 	if (wait) {
-		while (!cpus_empty(waitmask))
+		while (!cpumask_empty(&waitmask))
 			blackfin_dcache_invalidate_range(
 				(unsigned long)(&waitmask),
 				(unsigned long)(&waitmask));
@@ -265,9 +266,9 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)
 	cpumask_t callmap;
 
 	preempt_disable();
-	callmap = cpu_online_map;
-	cpu_clear(smp_processor_id(), callmap);
-	if (!cpus_empty(callmap))
+	cpumask_copy(&callmap, cpu_online_mask);
+	cpumask_clear_cpu(smp_processor_id(), &callmap);
+	if (!cpumask_empty(&callmap))
 		smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
 
 	preempt_enable();
@@ -284,8 +285,8 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
 
 	if (cpu_is_offline(cpu))
 		return 0;
-	cpus_clear(callmap);
-	cpu_set(cpu, callmap);
+	cpumask_clear(&callmap);
+	cpumask_set_cpu(cpu, &callmap);
 
 	smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
 
@@ -308,9 +309,9 @@ void smp_send_stop(void)
 	cpumask_t callmap;
 
 	preempt_disable();
-	callmap = cpu_online_map;
-	cpu_clear(smp_processor_id(), callmap);
-	if (!cpus_empty(callmap))
+	cpumask_copy(&callmap, cpu_online_mask);
+	cpumask_clear_cpu(smp_processor_id(), &callmap);
+	if (!cpumask_empty(&callmap))
 		smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0);
 
 	preempt_enable();
-- 
1.7.3.1






^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: (resend) [PATCH 1/4] blackfin: remove unused function
  2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
                           ` (2 preceding siblings ...)
  2011-04-26  1:57         ` (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
@ 2011-04-26  4:47         ` Mike Frysinger
  3 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2011-04-26  4:47 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: uclinux-dist-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 21:53, KOSAKI Motohiro wrote:
> platform_send_ipi() has old call-by-value cpumask_t fashon and
> it's unused.

looking at callers of platform_send_ipi_cpu(), it seems that there's
at least one place that could (should) be converted to
platform_send_ipi().  i'd rather update this func to the new api so i
can make that conversion.
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/4] blackfin: convet cpumask apis
  2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
                   ` (4 preceding siblings ...)
  2011-04-25 18:11 ` [PATCH 0/4] blackfin: convet cpumask apis Mike Frysinger
@ 2011-04-26 18:26 ` Thiago Farina
  5 siblings, 0 replies; 17+ messages in thread
From: Thiago Farina @ 2011-04-26 18:26 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Michael Hennerich, device-driver-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 6:27 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
>
> Rusty Russle introduced a lot of cpumask related APIs. and He gone even

s/Russle/Russell

s/and He/And he/

> though the work is unfinished. This patch series is sequel of his work.
>
> No functional change. only api change.
>
> note: I've confirmed only cross-compile build. so, I hope blackfin
> developers see the code.
>
>
> KOSAKI Motohiro (4):
>  blackfin: remove unused function
>  blackfin: don't touch cpu_possible_map and cpu_present_map directly
>  blackfin: don't touch task->cpus_allowed directly
>  blackfin: convert old cpumask API to new one
>
>  arch/blackfin/kernel/nmi.c                  |    8 ++--
>  arch/blackfin/kernel/process.c              |    6 +--
>  arch/blackfin/kernel/setup.c                |    4 +-
>  arch/blackfin/mach-bf561/include/mach/smp.h |    2 -
>  arch/blackfin/mach-bf561/smp.c              |   27 ++++-------
>  arch/blackfin/mach-common/dpmc.c            |    7 ++-
>  arch/blackfin/mach-common/smp.c             |   27 ++++++-----
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly
  2011-04-26  1:55         ` (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
@ 2011-05-13  2:45           ` Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2011-05-13  2:45 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: uclinux-dist-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 21:55, KOSAKI Motohiro wrote:
> We plan to remove cpu_possible_map and cpu_present_map later and we
> have proper init_cpu_possible() and init_cpu_present() APIs.
>
> Therefore this patch rewrites platform_init_cpus and platform_prepare_cpus
> by their APIs.

ive merged this patch now, thanks
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly
  2011-04-26  1:56         ` (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
@ 2011-05-13  2:47           ` Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2011-05-13  2:47 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: uclinux-dist-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 21:56, KOSAKI Motohiro wrote:
> Every callter (except kthread_bind) should use proper
> set_cpus_allowed_ptr() APIs.

ive merged this, thanks
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one
  2011-04-26  1:57         ` (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
@ 2011-05-13  2:51           ` Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2011-05-13  2:51 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: uclinux-dist-devel, LKML, Andrew Morton

On Mon, Apr 25, 2011 at 21:57, KOSAKI Motohiro wrote:
> old cpu_xxx() APIs is planned to removed later. then, converted.

ive merged this one too, thanks
-mike

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-05-13  2:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25  9:27 [PATCH 0/4] blackfin: convet cpumask apis KOSAKI Motohiro
2011-04-25  9:28 ` [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
2011-04-25  9:29 ` [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
2011-04-25  9:31 ` [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
2011-04-25  9:32 ` [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
2011-04-25 18:11 ` [PATCH 0/4] blackfin: convet cpumask apis Mike Frysinger
2011-04-25 18:18   ` Mike Frysinger
2011-04-26  1:49     ` KOSAKI Motohiro
2011-04-26  1:53       ` (resend) [PATCH 1/4] blackfin: remove unused function KOSAKI Motohiro
2011-04-26  1:55         ` (resend) [PATCH 2/4] blackfin: don't touch cpu_possible_map and cpu_present_map directly KOSAKI Motohiro
2011-05-13  2:45           ` Mike Frysinger
2011-04-26  1:56         ` (resend) [PATCH 3/4] blackfin: don't touch task->cpus_allowed directly KOSAKI Motohiro
2011-05-13  2:47           ` Mike Frysinger
2011-04-26  1:57         ` (resend) [PATCH 4/4] blackfin: convert old cpumask API to new one KOSAKI Motohiro
2011-05-13  2:51           ` Mike Frysinger
2011-04-26  4:47         ` (resend) [PATCH 1/4] blackfin: remove unused function Mike Frysinger
2011-04-26 18:26 ` [PATCH 0/4] blackfin: convet cpumask apis Thiago Farina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).