All of lore.kernel.org
 help / color / mirror / Atom feed
* xen: PV on HVM: support PV spinlocks
@ 2010-08-13 19:06 Stefano Stabellini
  2010-08-13 21:17 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Stabellini @ 2010-08-13 19:06 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge

xen: PV on HVM: support PV spinlocks

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 6f53453..5643c43 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1290,6 +1290,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
 	switch (action) {
 	case CPU_UP_PREPARE:
 		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
+		if (xen_have_vector_callback)
+			xen_init_lock_cpu(cpu);
 		break;
 	default:
 		break;
@@ -1301,6 +1303,20 @@ static struct notifier_block __cpuinitdata xen_hvm_cpu_notifier = {
 	.notifier_call	= xen_hvm_cpu_notify,
 };
 
+static void xen_hvm_spinlock_init(void)
+{
+	if (!xen_have_vector_callback)
+		return
+	xen_init_lock_cpu(0);
+	xen_init_spinlocks();
+}
+
+static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
+{
+	xen_hvm_spinlock_init();
+	native_smp_prepare_cpus(max_cpus);
+}
+
 static void __init xen_hvm_guest_init(void)
 {
 	int r;
@@ -1320,6 +1336,7 @@ static void __init xen_hvm_guest_init(void)
 	x86_init.irqs.intr_init = xen_init_IRQ;
 	xen_hvm_init_time_ops();
 	xen_hvm_init_mmu_ops();
+	smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
 }
 
 static bool __init xen_hvm_platform(void)

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

* Re: xen: PV on HVM: support PV spinlocks
  2010-08-13 19:06 xen: PV on HVM: support PV spinlocks Stefano Stabellini
@ 2010-08-13 21:17 ` Jeremy Fitzhardinge
  2010-08-16 11:56   ` Stefano Stabellini
  0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2010-08-13 21:17 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: xen-devel

 On 08/13/2010 12:06 PM, Stefano Stabellini wrote:
> xen: PV on HVM: support PV spinlocks
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 6f53453..5643c43 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1290,6 +1290,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
>  	switch (action) {
>  	case CPU_UP_PREPARE:
>  		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
> +		if (xen_have_vector_callback)
> +			xen_init_lock_cpu(cpu);

Why does this depend on vector_callback?  pv spinlocks never have events
actually delivered.

Nice and simple otherwise.

    J

>  		break;
>  	default:
>  		break;
> @@ -1301,6 +1303,20 @@ static struct notifier_block __cpuinitdata xen_hvm_cpu_notifier = {
>  	.notifier_call	= xen_hvm_cpu_notify,
>  };
>  
> +static void xen_hvm_spinlock_init(void)
> +{
> +	if (!xen_have_vector_callback)
> +		return
> +	xen_init_lock_cpu(0);
> +	xen_init_spinlocks();
> +}
> +
> +static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
> +{
> +	xen_hvm_spinlock_init();
> +	native_smp_prepare_cpus(max_cpus);
> +}
> +
>  static void __init xen_hvm_guest_init(void)
>  {
>  	int r;
> @@ -1320,6 +1336,7 @@ static void __init xen_hvm_guest_init(void)
>  	x86_init.irqs.intr_init = xen_init_IRQ;
>  	xen_hvm_init_time_ops();
>  	xen_hvm_init_mmu_ops();
> +	smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
>  }
>  
>  static bool __init xen_hvm_platform(void)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>

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

* Re: xen: PV on HVM: support PV spinlocks
  2010-08-13 21:17 ` Jeremy Fitzhardinge
@ 2010-08-16 11:56   ` Stefano Stabellini
  2010-08-16 19:43     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Stabellini @ 2010-08-16 11:56 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel@lists.xensource.com, Stefano Stabellini

On Fri, 13 Aug 2010, Jeremy Fitzhardinge wrote:
>  On 08/13/2010 12:06 PM, Stefano Stabellini wrote:
> > xen: PV on HVM: support PV spinlocks
> >
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> >
> > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> > index 6f53453..5643c43 100644
> > --- a/arch/x86/xen/enlighten.c
> > +++ b/arch/x86/xen/enlighten.c
> > @@ -1290,6 +1290,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
> >  	switch (action) {
> >  	case CPU_UP_PREPARE:
> >  		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
> > +		if (xen_have_vector_callback)
> > +			xen_init_lock_cpu(cpu);
> 
> Why does this depend on vector_callback?  pv spinlocks never have events
> actually delivered.
> 

HVM guests cannot receive events on vcpus other than 0 without
vector_callback, this means they wouldn't receive even a vcpu_kick and
would get stuck.

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

* Re: xen: PV on HVM: support PV spinlocks
  2010-08-16 11:56   ` Stefano Stabellini
@ 2010-08-16 19:43     ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2010-08-16 19:43 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: xen-devel@lists.xensource.com, Keir Fraser

 On 08/16/2010 04:56 AM, Stefano Stabellini wrote:
> On Fri, 13 Aug 2010, Jeremy Fitzhardinge wrote:
>>  On 08/13/2010 12:06 PM, Stefano Stabellini wrote:
>>> xen: PV on HVM: support PV spinlocks
>>>
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>>
>>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
>>> index 6f53453..5643c43 100644
>>> --- a/arch/x86/xen/enlighten.c
>>> +++ b/arch/x86/xen/enlighten.c
>>> @@ -1290,6 +1290,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
>>>  	switch (action) {
>>>  	case CPU_UP_PREPARE:
>>>  		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
>>> +		if (xen_have_vector_callback)
>>> +			xen_init_lock_cpu(cpu);
>> Why does this depend on vector_callback?  pv spinlocks never have events
>> actually delivered.
>>
> HVM guests cannot receive events on vcpus other than 0 without
> vector_callback, this means they wouldn't receive even a vcpu_kick and
> would get stuck.

Huh, really.  So if a vcpu is blocked in a poll hypercall on a masked
event channel and you send that vcpu an IPI, the poll won't unblock
unless you have a delivery vector?

OK, I guess.

    J

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

* Re: xen: PV on HVM: support PV spinlocks
@ 2010-10-02 11:26 Josip Rodin
  0 siblings, 0 replies; 5+ messages in thread
From: Josip Rodin @ 2010-10-02 11:26 UTC (permalink / raw)
  To: xen-devel

Hi,

I was just reading
http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commitdiff;h=a16a1a93b92ef09c4d759fc711c7f17b658176ec

And there's a chunk that says:

+static void xen_hvm_spinlock_init(void)
+{
+       if (!xen_have_vector_callback)
+               return
+       xen_init_lock_cpu(0);
+       xen_init_spinlocks();
+}

The return statement doesn't have a semicolon after it, so it will instead
take xen_init_lock_cpu(0) as its argument, and the xen_init_spinlocks() call
will never happen.

-- 
     2. That which causes joy or happiness.

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

end of thread, other threads:[~2010-10-02 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 19:06 xen: PV on HVM: support PV spinlocks Stefano Stabellini
2010-08-13 21:17 ` Jeremy Fitzhardinge
2010-08-16 11:56   ` Stefano Stabellini
2010-08-16 19:43     ` Jeremy Fitzhardinge
  -- strict thread matches above, loose matches on Subject: below --
2010-10-02 11:26 Josip Rodin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.