Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460496 > unrolled thread

Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)

Started byBoris Ostrovsky <boris.ostrovsky@oracle.com>
First post2016-08-11 15:00 +0200
Last post2016-08-11 16:20 +0200
Articles 8 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 15:00 +0200
    Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 15:30 +0200
      Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 16:20 +0200
        Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 16:40 +0200
          Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 16:50 +0200
            Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 17:10 +0200
              Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 17:20 +0200
      Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 16:20 +0200

#1460496 — Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2016-08-11 15:00 +0200
SubjectRe: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)
Message-ID<s4XKx-3Wr-15@gated-at.bofh.it>
On 08/10/2016 02:10 PM, tip-bot for Boris Ostrovsky wrote:
> Commit-ID:  aa877175e7a9982233ed8f10cb4bfddd78d82741
> Gitweb:     http://git.kernel.org/tip/aa877175e7a9982233ed8f10cb4bfddd78d82741
> Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
> AuthorDate: Wed, 3 Aug 2016 13:22:28 -0400
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed, 10 Aug 2016 15:42:57 +0200
> 
> cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)
> 
> Now that Xen no longer allocates irqs in _cpu_up() we can restore
> commit:
> 
>   a89941816726 ("hotplug: Prevent alloc/free of irq descriptors during cpu up/down")
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: david.vrabel@citrix.com
> Cc: xen-devel@lists.xenproject.org
> Link: http://lkml.kernel.org/r/1470244948-17674-3-git-send-email-boris.ostrovsky@oracle.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>



Since this patch requires
http://marc.info/?l=xen-devel&m=147024499722041&w=2 it may be better to
take it via Xen tree.

-boris

[toc] | [next] | [standalone]


#1460522

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-08-11 15:30 +0200
Message-ID<s4YdA-4ms-29@gated-at.bofh.it>
In reply to#1460496
On 2016-08-11 08:53:31 [-0400], Boris Ostrovsky wrote:
> Since this patch requires
> http://marc.info/?l=xen-devel&m=147024499722041&w=2 it may be better to
> take it via Xen tree.

Why are you adding more register_cpu_notifier() users?

> -boris

Sebastian

[toc] | [prev] | [next] | [standalone]


#1460558

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-08-11 16:20 +0200
Message-ID<s4YZX-4Uf-9@gated-at.bofh.it>
In reply to#1460522
On 2016-08-11 10:11:20 [-0400], Boris Ostrovsky wrote:
> Are you asking why this is not using new hotplug infrastructure?
correct.

> This should indeed be done but not as part of this series. Here we are
> solving a specific problem and part of this is allowing PV guests use
> the same notifier that HVM guests already do.

I have a huge a series (1285 patches to be exact) which converts the
remaining users away and you are adding new ones.
Is this patch of yours going stable?

> -boris

Sebastian

[toc] | [prev] | [next] | [standalone]


#1460573

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2016-08-11 16:40 +0200
Message-ID<s4Zjj-51o-1@gated-at.bofh.it>
In reply to#1460558
On 08/11/2016 10:17 AM, Sebastian Andrzej Siewior wrote:
> On 2016-08-11 10:11:20 [-0400], Boris Ostrovsky wrote:
>> Are you asking why this is not using new hotplug infrastructure?
> correct.
> 
>> This should indeed be done but not as part of this series. Here we are
>> solving a specific problem and part of this is allowing PV guests use
>> the same notifier that HVM guests already do.
> 
> I have a huge a series (1285 patches to be exact) which converts the
> remaining users away and you are adding new ones.


So you must have converted Xen code already then? Can you post those
patches (not all 1285, just Xen-related, assuming there are no
dependencies) and I'll see if I can add them to this series?


> Is this patch of yours going stable?

No.

-boris

[toc] | [prev] | [next] | [standalone]


#1460582

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-08-11 16:50 +0200
Message-ID<s4ZsZ-54X-5@gated-at.bofh.it>
In reply to#1460573
On 2016-08-11 10:30:57 [-0400], Boris Ostrovsky wrote:
> So you must have converted Xen code already then? Can you post those
> patches (not all 1285, just Xen-related, assuming there are no
> dependencies) and I'll see if I can add them to this series?

This is patch 77. I *hope* the only clash (if any) will be in
cpuhotplug.h. I did not yet retest things in terms of apply & compile.
I plan to do so within this + next week. If you want to test it right
away, please do so :)

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 4 Nov 2015 21:06:00 +0100
Subject: [PATCH] xen: events: fifo: Convert to hotplug state machine

Install the callbacks via the state machine. In theory we could remove the
upper call evtchn_fifo_alloc_control_block() and have callback invoked for
all online CPUs but this does not reflect the currect code.

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/xen/events/events_fifo.c |   33 +++++++++++----------------------
 include/linux/cpuhotplug.h       |    1 +
 2 files changed, 12 insertions(+), 22 deletions(-)

--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -418,30 +418,18 @@ static int evtchn_fifo_alloc_control_blo
 	return ret;
 }
 
-static int evtchn_fifo_cpu_notification(struct notifier_block *self,
-						  unsigned long action,
-						  void *hcpu)
+static int xen_evtchn_cpu_prepare(unsigned int cpu)
 {
-	int cpu = (long)hcpu;
-	int ret = 0;
-
-	switch (action) {
-	case CPU_UP_PREPARE:
-		if (!per_cpu(cpu_control_block, cpu))
-			ret = evtchn_fifo_alloc_control_block(cpu);
-		break;
-	case CPU_DEAD:
-		__evtchn_fifo_handle_events(cpu, true);
-		break;
-	default:
-		break;
-	}
-	return ret < 0 ? NOTIFY_BAD : NOTIFY_OK;
+	if (!per_cpu(cpu_control_block, cpu))
+		return evtchn_fifo_alloc_control_block(cpu);
+	return 0;
 }
 
-static struct notifier_block evtchn_fifo_cpu_notifier = {
-	.notifier_call	= evtchn_fifo_cpu_notification,
-};
+static int xen_evtchn_cpu_dead(unsigned int cpu)
+{
+	__evtchn_fifo_handle_events(cpu, true);
+	return 0;
+}
 
 int __init xen_evtchn_fifo_init(void)
 {
@@ -456,7 +444,8 @@ int __init xen_evtchn_fifo_init(void)
 
 	evtchn_ops = &evtchn_ops_fifo;
 
-	register_cpu_notifier(&evtchn_fifo_cpu_notifier);
+	cpuhp_setup_state_nocalls(CPUHP_XEN_EV_PREPEARE, "XEN_EV_PREPEARE",
+				  xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
 out:
 	put_cpu();
 	return ret;
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -22,6 +22,7 @@ enum cpuhp_state {
 	CPUHP_SMPCFD_PREPARE,
 	CPUHP_RELAY_PREPARE,
 	CPUHP_SLAB_PREPARE,
+	CPUHP_XEN_EV_PREPEARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_SLUB_DEAD,
 	CPUHP_MM_WRITEBACK_DEAD,


Sebastian

[toc] | [prev] | [next] | [standalone]


#1460592

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2016-08-11 17:10 +0200
Message-ID<s4ZMl-5r3-5@gated-at.bofh.it>
In reply to#1460582
On 08/11/2016 10:44 AM, Sebastian Andrzej Siewior wrote:
> On 2016-08-11 10:30:57 [-0400], Boris Ostrovsky wrote:
>> So you must have converted Xen code already then? Can you post those
>> patches (not all 1285, just Xen-related, assuming there are no
>> dependencies) and I'll see if I can add them to this series?
> 
> This is patch 77. I *hope* the only clash (if any) will be in
> cpuhotplug.h. I did not yet retest things in terms of apply & compile.
> I plan to do so within this + next week. If you want to test it right
> away, please do so :)
> 
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Date: Wed, 4 Nov 2015 21:06:00 +0100
> Subject: [PATCH] xen: events: fifo: Convert to hotplug state machine
> 
> Install the callbacks via the state machine. In theory we could remove the
> upper call evtchn_fifo_alloc_control_block() and have callback invoked for
> all online CPUs but this does not reflect the currect code.
> 
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/xen/events/events_fifo.c |   33 +++++++++++----------------------
>  include/linux/cpuhotplug.h       |    1 +
>  2 files changed, 12 insertions(+), 22 deletions(-)


I was actually looking for arch/x86/xen/enlighten.c patch but if you
don't have it I can do it myself.


> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -22,6 +22,7 @@ enum cpuhp_state {
>  	CPUHP_SMPCFD_PREPARE,
>  	CPUHP_RELAY_PREPARE,
>  	CPUHP_SLAB_PREPARE,
> +	CPUHP_XEN_EV_PREPEARE,

Misspelled PREPARE.

-boris

[toc] | [prev] | [next] | [standalone]


#1460598

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-08-11 17:20 +0200
Message-ID<s4ZW1-5uM-15@gated-at.bofh.it>
In reply to#1460592
On 2016-08-11 11:06:29 [-0400], Boris Ostrovsky wrote:
> I was actually looking for arch/x86/xen/enlighten.c patch but if you
> don't have it I can do it myself.

I'm sorry. I had it but it got removed by accident during the refresh.
This is an older version so you have an idea :)

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 4 Nov 2015 21:06:01 +0100
Subject: [PATCH] x86: xen: Convert to hotplug state machine

Install the callbacks via the state machine.

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/xen/enlighten.c   |   28 +++++++++-------------------
 include/linux/cpuhotplug.h |    1 +
 2 files changed, 10 insertions(+), 19 deletions(-)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1802,28 +1802,16 @@ static void __init init_hvm_pv_info(void
 	xen_domain_type = XEN_HVM_DOMAIN;
 }
 
-static int xen_hvm_cpu_notify(struct notifier_block *self, unsigned long action,
-			      void *hcpu)
+static int xen_hvm_cpu_up_prepare(unsigned int cpu)
 {
-	int cpu = (long)hcpu;
-	switch (action) {
-	case CPU_UP_PREPARE:
-		xen_vcpu_setup(cpu);
-		if (xen_have_vector_callback) {
-			if (xen_feature(XENFEAT_hvm_safe_pvclock))
-				xen_setup_timer(cpu);
-		}
-		break;
-	default:
-		break;
+	xen_vcpu_setup(cpu);
+	if (xen_have_vector_callback) {
+		if (xen_feature(XENFEAT_hvm_safe_pvclock))
+			xen_setup_timer(cpu);
 	}
-	return NOTIFY_OK;
+	return 0;
 }
 
-static struct notifier_block xen_hvm_cpu_notifier = {
-	.notifier_call	= xen_hvm_cpu_notify,
-};
-
 #ifdef CONFIG_KEXEC_CORE
 static void xen_hvm_shutdown(void)
 {
@@ -1853,7 +1841,9 @@ static void __init xen_hvm_guest_init(vo
 	if (xen_feature(XENFEAT_hvm_callback_vector))
 		xen_have_vector_callback = 1;
 	xen_hvm_smp_init();
-	register_cpu_notifier(&xen_hvm_cpu_notifier);
+	cpuhp_setup_state_nocalls(CPUHP_XEN_HVM_GUEST_PREPARE,
+				  "XEN_HVM_GUEST_PREPARE",
+				  xen_hvm_cpu_up_prepare, NULL);
 	xen_unplug_emulated_devices();
 	x86_init.irqs.intr_init = xen_init_IRQ;
 	xen_hvm_init_time_ops();
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -24,6 +24,7 @@ enum cpuhp_state {
 	CPUHP_RELAY_PREPARE,
 	CPUHP_SLAB_PREPARE,
 	CPUHP_XEN_EV_PREPEARE,
+	CPUHP_XEN_HVM_GUEST_PREPARE,
 	CPUHP_MD_RAID5_PREPARE,
 	CPUHP_CPUIDLE_COUPLED_PREPARE,
 	CPUHP_TIMERS_DEAD,

Sebastian

[toc] | [prev] | [next] | [standalone]


#1460563

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2016-08-11 16:20 +0200
Message-ID<s4YZX-4Uf-11@gated-at.bofh.it>
In reply to#1460522
On 08/11/2016 09:20 AM, Sebastian Andrzej Siewior wrote:
> On 2016-08-11 08:53:31 [-0400], Boris Ostrovsky wrote:
>> Since this patch requires
>> http://marc.info/?l=xen-devel&m=147024499722041&w=2 it may be better to
>> take it via Xen tree.
> 
> Why are you adding more register_cpu_notifier() users?


Are you asking why this is not using new hotplug infrastructure?

This should indeed be done but not as part of this series. Here we are
solving a specific problem and part of this is allowing PV guests use
the same notifier that HVM guests already do.


-boris

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web