public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix call of smp_processor_id() by XPC while preemptible
@ 2005-07-12 19:30 Dean Nelson
  2005-07-12 19:39 ` Luck, Tony
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dean Nelson @ 2005-07-12 19:30 UTC (permalink / raw)
  To: linux-ia64

XPC calls smp_processor_id() twice from xpc_setup_infrastructure() with
preemption enabled, which gets flagged if 'DEBUG_PREEMPT=y'. This patch
disables preemption around a now single call to smp_processor_id(). Note
that it doesn't matter if the thread is moved to another processor once
it has the processor ID.

Signed-off-by: Dean Nelson <dcn@sgi.com>


Index: linux-2.6/arch/ia64/sn/kernel/xpc_channel.c
=================================--- linux-2.6.orig/arch/ia64/sn/kernel/xpc_channel.c	2005-07-12 12:09:14.026288661 -0500
+++ linux-2.6/arch/ia64/sn/kernel/xpc_channel.c	2005-07-12 13:23:34.976151339 -0500
@@ -72,7 +72,7 @@
 enum xpc_retval
 xpc_setup_infrastructure(struct xpc_partition *part)
 {
-	int ret;
+	int ret, cpuid;
 	struct timer_list *timer;
 	partid_t partid = XPC_PARTID(part);
 
@@ -223,9 +223,13 @@
 	xpc_vars_part[partid].openclose_args_pa  					__pa(part->local_openclose_args);
 	xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
-	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(smp_processor_id());
-	xpc_vars_part[partid].IPI_phys_cpuid -					cpu_physical_id(smp_processor_id());
+
+	preempt_disable();
+	cpuid = smp_processor_id();
+	preempt_enable();
+	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(cpuid);
+	xpc_vars_part[partid].IPI_phys_cpuid = cpu_physical_id(cpuid);
+
 	xpc_vars_part[partid].nchannels = part->nchannels;
 	xpc_vars_part[partid].magic = XPC_VP_MAGIC1;
 

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

* RE: [PATCH] fix call of smp_processor_id() by XPC while preemptible
  2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
@ 2005-07-12 19:39 ` Luck, Tony
  2005-07-12 20:00 ` Dean Nelson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Luck, Tony @ 2005-07-12 19:39 UTC (permalink / raw)
  To: linux-ia64

>XPC calls smp_processor_id() twice from xpc_setup_infrastructure() with
>preemption enabled, which gets flagged if 'DEBUG_PREEMPT=y'. This patch
>disables preemption around a now single call to smp_processor_id(). Note
>that it doesn't matter if the thread is moved to another processor once
>it has the processor ID.

So the code becomes effectively:

	cpuid = pick_a_random_online_cpuid();

What is the higher level function that you are doing here that is OK
with that?

-Tony

P.S. The cpu number you picked may not still be online by the time
you use it.

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

* Re: [PATCH] fix call of smp_processor_id() by XPC while preemptible
  2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
  2005-07-12 19:39 ` Luck, Tony
@ 2005-07-12 20:00 ` Dean Nelson
  2005-07-12 20:47 ` Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dean Nelson @ 2005-07-12 20:00 UTC (permalink / raw)
  To: linux-ia64

On Tue, Jul 12, 2005 at 12:39:55PM -0700, Luck, Tony wrote:
> >XPC calls smp_processor_id() twice from xpc_setup_infrastructure() with
> >preemption enabled, which gets flagged if 'DEBUG_PREEMPT=y'. This patch
> >disables preemption around a now single call to smp_processor_id(). Note
> >that it doesn't matter if the thread is moved to another processor once
> >it has the processor ID.
> 
> So the code becomes effectively:
> 
> 	cpuid = pick_a_random_online_cpuid();
> 
> What is the higher level function that you are doing here that is OK
> with that?
> 
> -Tony
> 
> P.S. The cpu number you picked may not still be online by the time
> you use it.

From the cpuid we get the nasid and physical cpuid which are passed to
another partition (also running XPC) which it uses to target IPIs for
communication purposes back at 'this' partition. The code is set up
to deal with partitions disappearing.


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

* Re: [PATCH] fix call of smp_processor_id() by XPC while preemptible
  2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
  2005-07-12 19:39 ` Luck, Tony
  2005-07-12 20:00 ` Dean Nelson
@ 2005-07-12 20:47 ` Christoph Hellwig
  2005-07-13 12:44 ` Dean Nelson
  2005-07-13 14:25 ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2005-07-12 20:47 UTC (permalink / raw)
  To: linux-ia64

On Tue, Jul 12, 2005 at 02:30:45PM -0500, Dean Nelson wrote:
> XPC calls smp_processor_id() twice from xpc_setup_infrastructure() with
> preemption enabled, which gets flagged if 'DEBUG_PREEMPT=y'. This patch
> disables preemption around a now single call to smp_processor_id(). Note
> that it doesn't matter if the thread is moved to another processor once
> it has the processor ID.
> 
> Signed-off-by: Dean Nelson <dcn@sgi.com>
> 
> 
> Index: linux-2.6/arch/ia64/sn/kernel/xpc_channel.c
> =================================> --- linux-2.6.orig/arch/ia64/sn/kernel/xpc_channel.c	2005-07-12 12:09:14.026288661 -0500
> +++ linux-2.6/arch/ia64/sn/kernel/xpc_channel.c	2005-07-12 13:23:34.976151339 -0500
> @@ -72,7 +72,7 @@
>  enum xpc_retval
>  xpc_setup_infrastructure(struct xpc_partition *part)
>  {
> -	int ret;
> +	int ret, cpuid;
>  	struct timer_list *timer;
>  	partid_t partid = XPC_PARTID(part);
>  
> @@ -223,9 +223,13 @@
>  	xpc_vars_part[partid].openclose_args_pa >  					__pa(part->local_openclose_args);
>  	xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
> -	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(smp_processor_id());
> -	xpc_vars_part[partid].IPI_phys_cpuid > -					cpu_physical_id(smp_processor_id());
> +
> +	preempt_disable();
> +	cpuid = smp_processor_id();
> +	preempt_enable();

just use __smp_processor_id() (or the fashionable name of the day)
for it.


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

* Re: [PATCH] fix call of smp_processor_id() by XPC while preemptible
  2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
                   ` (2 preceding siblings ...)
  2005-07-12 20:47 ` Christoph Hellwig
@ 2005-07-13 12:44 ` Dean Nelson
  2005-07-13 14:25 ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Dean Nelson @ 2005-07-13 12:44 UTC (permalink / raw)
  To: linux-ia64

On Tue, Jul 12, 2005 at 09:47:54PM +0100, Christoph Hellwig wrote:
> On Tue, Jul 12, 2005 at 02:30:45PM -0500, Dean Nelson wrote:
> >  	xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
> > -	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(smp_processor_id());
> > -	xpc_vars_part[partid].IPI_phys_cpuid > > -					cpu_physical_id(smp_processor_id());
> > +
> > +	preempt_disable();
> > +	cpuid = smp_processor_id();
> > +	preempt_enable();
>
> just use __smp_processor_id() (or the fashionable name of the day)
> for it.

Tony, the revised patch follows.

Christoph, I assume this is what you meant.

Thanks,
Dean



XPC calls smp_processor_id() twice from xpc_setup_infrastructure() with
preemption enabled, which gets flagged if 'DEBUG_PREEMPT=y'. This patch
replaces the two calls to smp_processor_id() by a single call to
raw_smp_processor_id() since any CPU within the partition will do.

Signed-off-by: Dean Nelson <dcn@sgi.com>


Index: linux-2.6/arch/ia64/sn/kernel/xpc_channel.c
=================================--- linux-2.6.orig/arch/ia64/sn/kernel/xpc_channel.c	2005-07-12 12:09:14.026288661 -0500
+++ linux-2.6/arch/ia64/sn/kernel/xpc_channel.c	2005-07-13 06:48:14.408494167 -0500
@@ -72,7 +72,7 @@
 enum xpc_retval
 xpc_setup_infrastructure(struct xpc_partition *part)
 {
-	int ret;
+	int ret, cpuid;
 	struct timer_list *timer;
 	partid_t partid = XPC_PARTID(part);
 
@@ -223,9 +223,9 @@
 	xpc_vars_part[partid].openclose_args_pa  					__pa(part->local_openclose_args);
 	xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
-	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(smp_processor_id());
-	xpc_vars_part[partid].IPI_phys_cpuid -					cpu_physical_id(smp_processor_id());
+	cpuid = raw_smp_processor_id();	/* any CPU in this partition will do */
+	xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(cpuid);
+	xpc_vars_part[partid].IPI_phys_cpuid = cpu_physical_id(cpuid);
 	xpc_vars_part[partid].nchannels = part->nchannels;
 	xpc_vars_part[partid].magic = XPC_VP_MAGIC1;
 

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

* Re: [PATCH] fix call of smp_processor_id() by XPC while preemptible
  2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
                   ` (3 preceding siblings ...)
  2005-07-13 12:44 ` Dean Nelson
@ 2005-07-13 14:25 ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2005-07-13 14:25 UTC (permalink / raw)
  To: linux-ia64

On Wed, Jul 13, 2005 at 07:44:52AM -0500, Dean Nelson wrote:
> Tony, the revised patch follows.
> 
> Christoph, I assume this is what you meant.

looks fine, thanks


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

end of thread, other threads:[~2005-07-13 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-12 19:30 [PATCH] fix call of smp_processor_id() by XPC while preemptible Dean Nelson
2005-07-12 19:39 ` Luck, Tony
2005-07-12 20:00 ` Dean Nelson
2005-07-12 20:47 ` Christoph Hellwig
2005-07-13 12:44 ` Dean Nelson
2005-07-13 14:25 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox