Re: [Xen-devel] [PATCH v3 2/2] xen: merge temporary vcpu pinning scenarios

2019-07-28 Thread Juergen Gross
On 26.07.19 13:50, Andrew Cooper wrote: On 26/07/2019 12:42, Juergen Gross wrote: On 26.07.19 13:35, Jan Beulich wrote: On 26.07.2019 11:46, Andrew Cooper wrote: On 24/07/2019 12:26, Juergen Gross wrote: @@ -182,30 +178,24 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv

[Xen-devel] [PATCH] xen: don't longjmp() after domain_crash() in check_wakeup_from_wait()

2019-07-28 Thread Juergen Gross
Continuing on the stack saved by __prepare_to_wait() on the wrong cpu is rather dangerous. Instead of doing so just call the scheduler again as it already is happening in the similar case in __prepare_to_wait() when doing the setjmp() would be wrong. Signed-off-by: Juergen Gross --- xen/common

Re: [Xen-devel] [PATCH] xen: don't longjmp() after domain_crash() in check_wakeup_from_wait()

2019-07-29 Thread Juergen Gross
On 29.07.19 10:34, Andrew Cooper wrote: On 29/07/2019 05:36, Juergen Gross wrote: Continuing on the stack saved by __prepare_to_wait() on the wrong cpu is rather dangerous. Instead of doing so just call the scheduler again as it already is happening in the similar case in __prepare_to_wait

Re: [Xen-devel] [PATCH 3/3] xen: add per-cpu buffer option to debugtrace

2019-07-29 Thread Juergen Gross
On 28.07.19 10:41, Juergen Gross wrote: debugtrace is normally writing trace entries into a single trace buffer. There are cases where this is not optimal, e.g. when hunting a bug which requires writing lots of trace entries and one cpu is stuck. This will result in other cpus filling the trace

Re: [Xen-devel] [RFC 0/6] XEN scheduling hardening

2019-07-29 Thread Juergen Gross
On 29.07.19 13:53, Dario Faggioli wrote: On Fri, 2019-07-26 at 14:14 +0200, Juergen Gross wrote: On 26.07.19 13:56, Dario Faggioli wrote: On Fri, 2019-07-26 at 13:37 +0300, Andrii Anisov wrote: - How to avoid the absolute top priority of tasklets (what is obeyed by all schedulers so

Re: [Xen-devel] [PATCH 1/3] xen: move debugtrace coding to common/debugtrace.c

2019-07-29 Thread Juergen Gross
On 29.07.19 14:45, Jan Beulich wrote: On 28.07.2019 10:40, Juergen Gross wrote: -#endif /* !CONFIG_DEBUG_TRACE */ - - /* * ** * *** Debugging/tracing/error-report *** ... what about this one

Re: [Xen-devel] [PATCH 1/3] xen: move debugtrace coding to common/debugtrace.c

2019-07-29 Thread Juergen Gross
On 29.07.19 16:00, Jan Beulich wrote: On 29.07.2019 15:30, Juergen Gross wrote: On 29.07.19 14:45, Jan Beulich wrote: On 28.07.2019 10:40, Juergen Gross wrote: -#endif /* !CONFIG_DEBUG_TRACE

Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common

2019-07-30 Thread Juergen Gross
On 29.07.19 20:03, Andrew Cooper wrote: On 29/07/2019 14:54, Jan Beulich wrote: On 29.07.2019 15:23, Andrew Cooper wrote: On 29/07/2019 14:00, Jan Beulich wrote: On 26.07.2019 23:08, Andrew Cooper wrote: --- a/xen/include/xen/percpu.h +++ b/xen/include/xen/percpu.h @@ -3,6 +3,12 @@ #

Re: [Xen-devel] [PATCH] [v3] xen: avoid link error on ARM

2019-07-30 Thread Juergen Gross
hen Xen is enabled, as suggested by Juergen Gross and Boris Ostrovsky. Signed-off-by: Arnd Bergmann Pushed to xen/tip.git for-linus-5.3a Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] xen/gntdev.c: Replace vm_map_pages() with vm_map_pages_zero()

2019-07-30 Thread Juergen Gross
On 30.07.19 20:34, Souptick Joarder wrote: 'commit df9bde015a72 ("xen/gntdev.c: convert to use vm_map_pages()")' breaks gntdev driver. If vma->vm_pgoff > 0, vm_map_pages() will: - use map->pages starting at vma->vm_pgoff instead of 0 - verify map->count against vma_pages()+vma->vm_pgoff inste

Re: [Xen-devel] [PATCH] CODING_STYLE: clarify function argument indentation

2019-08-01 Thread Juergen Gross
On 01.08.19 11:55, Anthony PERARD wrote: On Wed, Jul 31, 2019 at 05:57:32PM +, Volodymyr Babchuk wrote: Lars Kurth writes: Ultimately we have to make some trade-offs as to what is more important: a) automatic style checking - which means "common sense" can't be formalised and there will be

[Xen-devel] [PATCH v2 3/4] xen: refactor debugtrace data

2019-08-01 Thread Juergen Gross
As a preparation for per-cpu buffers do a little refactoring of the debugtrace data: put the needed buffer admin data into the buffer as it will be needed for each buffer. While at it switch debugtrace_send_to_console and debugtrace_used to bool and delete an empty line. Signed-off-by: Juergen

[Xen-devel] [PATCH v2 2/4] xen: move debugtrace coding to common/debugtrace.c

2019-08-01 Thread Juergen Gross
Instead of living in drivers/char/console.c move the debugtrace related coding to a new file common/debugtrace.c No functional change, code movement only. Signed-off-by: Juergen Gross --- xen/common/Makefile| 1 + xen/common/debugtrace.c| 177

[Xen-devel] [PATCH v2 0/4] xen: debugtrace cleanup and per-cpu buffer support

2019-08-01 Thread Juergen Gross
Another debugtrace enhancement I needed for core scheduling debugging, plus some cleanup. Changes in V2: - added new patch 1 (preparing the move of debugtrace coding) - patch 4 (v1 patch 3): avoid leaking buffer Juergen Gross (4): xen: use common output function in debugtrace xen: move

[Xen-devel] [PATCH v2 4/4] xen: add per-cpu buffer option to debugtrace

2019-08-01 Thread Juergen Gross
unction to accept size modifiers (e.g. 4M or 1G). Printing out the trace entries is done for each buffer in order to minimize the effort needed during printing. As each entry is prefixed with its sequence number sorting the entries can easily be done when analyzing them. Signed-off-by: Juergen Gro

[Xen-devel] [PATCH v2 1/4] xen: use common output function in debugtrace

2019-08-01 Thread Juergen Gross
functionality to an own source file rename sercon_puts() to console_serial_puts() and make it globally visible. Signed-off-by: Juergen Gross --- xen/drivers/char/console.c | 16 xen/include/xen/console.h | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a

Re: [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting

2019-08-01 Thread Juergen Gross
On 01.08.19 14:16, Viktor Mitin wrote: On Thu, Aug 1, 2019 at 10:40 AM Jan Beulich wrote: On 31.07.2019 18:20, Viktor Mitin wrote: How all those projects live without this issue? Perhaps they don't care? I do. What is the reason not to fix 'diff -p'? Is it not possible at all? I have no

[Xen-devel] [ANNOUNCE] Xen 4.13 Development Update

2019-08-01 Thread Juergen Gross
Dario Faggioli * Core aware scheduling for credit2 (RFC v1) - Dario Faggioli * Core scheduling (v1) - Juergen Gross * Switch to use domheap page for page table (RFC v1) - Wei Liu === x86 === * PV-IOMMU (v7) - Paul Durrant * HVM guest CPU topology support (RFC) - Chao Gao *

Re: [Xen-devel] [PATCH 20/34] xen: convert put_page() to put_user_page*()

2019-08-01 Thread Juergen Gross
fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Cc: Boris Ostrovsky Cc: Juergen Gross Cc: xen-devel@lists.xenproject.org Signed-off-by: John Hubbard --- drivers/xen/gntdev.c | 5 + drivers/xen/privcmd.c | 7 +-- 2 files changed, 2 insertions(+), 10 deletion

Re: [Xen-devel] "CPU N still not dead..." messages during microcode update stage of boot when smt=0

2019-08-01 Thread Juergen Gross
On 02.08.19 04:15, Andy Smith wrote: Hi, On Mon, Jul 22, 2019 at 01:06:03PM +0100, Andrew Cooper wrote: On 22/07/2019 10:16, Jan Beulich wrote: On 21.07.2019 22:06, Andy Smith wrote: (XEN) Adding cpu 1 to runqueue 0 (XEN) CPU 1 still not dead... (XEN) CPU 1 still not dead... (XEN) CPU 1 still

Re: [Xen-devel] [PATCH 20/34] xen: convert put_page() to put_user_page*()

2019-08-02 Thread Juergen Gross
On 02.08.19 07:48, John Hubbard wrote: On 8/1/19 9:36 PM, Juergen Gross wrote: On 02.08.19 04:19, john.hubb...@gmail.com wrote: From: John Hubbard ... diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 2f5ce7230a43..29e461dbee2d 100644 --- a/drivers/xen/privcmd.c +++ b/drivers

Re: [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting

2019-08-02 Thread Juergen Gross
On 02.08.19 10:38, Viktor Mitin wrote: On Thu, Aug 1, 2019 at 3:50 PM Juergen Gross wrote: On 01.08.19 14:16, Viktor Mitin wrote: On Thu, Aug 1, 2019 at 10:40 AM Jan Beulich wrote: On 31.07.2019 18:20, Viktor Mitin wrote: How all those projects live without this issue? Perhaps they

[Xen-devel] [PATCH 0/3] xen/sched: use new idle scheduler for free cpus

2019-08-02 Thread Juergen Gross
longer happen, as parking the not to be started threads is done before. Juergen Gross (3): xen/sched: populate cpupool0 only after all cpus are up xen/sched: remove cpu from pool0 before removing it xen/sched: add minimalistic idle scheduler for free cpus xen/common/cpupool.c | 194

[Xen-devel] [PATCH 2/3] xen/sched: remove cpu from pool0 before removing it

2019-08-02 Thread Juergen Gross
so we need to switch from spinlock_irq to spinlock_irqsave. Signed-off-by: Juergen Gross --- xen/common/cpupool.c | 176 +++-- xen/common/schedule.c | 27 --- xen/include/xen/sched-if.h | 2 + 3 files changed, 128 insertions(+), 77

[Xen-devel] [PATCH 3/3] xen/sched: add minimalistic idle scheduler for free cpus

2019-08-02 Thread Juergen Gross
moving cpus to and from cpupools a lot. This new scheduler will just use a common lock for all free cpus. As this new scheduler is not user selectable don't register it as an official scheduler, but just include it in schedule.c. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c

[Xen-devel] [PATCH 1/3] xen/sched: populate cpupool0 only after all cpus are up

2019-08-02 Thread Juergen Gross
assigning the cpus. Initialize free cpus with all online cpus at that time in order to be able to add the cpu notifier late, too. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xen

[Xen-devel] [GIT PULL] xen: fixes for 5.3-rc3

2019-08-02 Thread Juergen Gross
+++ 7 files changed, 56 insertions(+), 57 deletions(-) Arnd Bergmann (1): xen: avoid link error on ARM Juergen Gross (3): xen/swiotlb: fix condition for calling xen_destroy_contiguous_region() xen/swiotlb: simplify range_straddles_page_boundary() xen/swiotlb: remember

Re: [Xen-devel] [PATCH v2 20/34] xen: convert put_page() to put_user_page*()

2019-08-04 Thread Juergen Gross
fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). This also handles pages[i] == NULL cases, thanks to an approach that is actually written by Juergen Gross. Signed-off-by: Juergen Gross Signed-off-by: John Hubbard Cc: Boris Ostrovsky Cc: xen-devel@lists.xenproject.o

Re: [Xen-devel] [PATCH v2 1/2] xen: add interface for obtaining .config from hypervisor

2019-08-05 Thread Juergen Gross
On 05.08.19 17:07, George Dunlap wrote: On 4/4/19 2:35 PM, Juergen Gross wrote: On 04/04/2019 15:27, Wei Liu wrote: On Fri, Mar 15, 2019 at 05:29:28PM +0100, Juergen Gross wrote: On 15/03/2019 16:55, Andrew Cooper wrote: On 14/03/2019 11:59, Juergen Gross wrote: @@ -1100,6 +1100,20

[Xen-devel] [PATCH] xen/x86: lock cacheline for add_sized()

2019-08-06 Thread Juergen Gross
add_sized() should use an atomic update of the memory word, as it is used by spin_unlock(). With ticket locks unlocking needs to be atomic in order to avoid very rare races when someone tries to get the lock while the lock holder is just releasing it. Signed-off-by: Juergen Gross --- xen

Re: [Xen-devel] [PATCH] xen/x86: lock cacheline for add_sized()

2019-08-06 Thread Juergen Gross
On 06.08.19 10:26, Jan Beulich wrote: On 06.08.2019 09:00, Juergen Gross wrote: add_sized() should use an atomic update of the memory word, as it is used by spin_unlock(). With ticket locks unlocking needs to be atomic in order to avoid very rare races when someone tries to get the lock while

[Xen-devel] [PATCH v2] xen/x86: lock cacheline for add_sized()

2019-08-07 Thread Juergen Gross
be atomic, too, as otherwise the unlock might not write back the correct data. Signed-off-by: Juergen Gross --- xen/include/asm-x86/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/asm-x86/atomic.h b/xen/include/asm-x86/atomic.h index 682bcf91b1

Re: [Xen-devel] [PATCH v2] xen/x86: lock cacheline for add_sized()

2019-08-07 Thread Juergen Gross
On 07.08.19 11:10, Jan Beulich wrote: On 07.08.2019 09:32, Juergen Gross wrote: add_sized() should use an atomic update of the memory word, as it is used by spin_unlock(). Ticket locks are using a read-modify-write operation on parts of the lockword for unlocking, while trying to lock is done

[Xen-devel] [PATCH] xen/sched: fix memory leak in credit2

2019-08-07 Thread Juergen Gross
csched2_deinit() is leaking the run-queue memory. Signed-off-by: Juergen Gross --- xen/common/sched_credit2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 6fff210ca6..6b77da7476 100644 --- a/xen/common/sched_credit2.c +++ b

[Xen-devel] [PATCH 3/4] xen: print lock profile info in panic()

2019-08-07 Thread Juergen Gross
config option select SPINLOCK_DEBUG. As printing the lock profile data will make use of locking, too, we need to disable spinlock debugging before calling spinlock_profile_printall() from panic(). While at it remove a superfluous #ifdef CONFIG_LOCK_PROFILE. Signed-off-by: Juergen Gross --- xen

[Xen-devel] [PATCH 0/4] enhance lock debugging

2019-08-07 Thread Juergen Gross
. when a NMI watchdog is triggering a crash. Juergen Gross (4): xen/spinlocks: in debug builds store cpu holding the lock xen: add new CONFIG_SPINLOCK_DEBUG option xen: print lock profile info in panic() xen: modify lock profiling interface tools/libxc/xc_misc.c | 1 + tools/misc

[Xen-devel] [PATCH 1/4] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-07 Thread Juergen Gross
Add the cpu currently holding the lock to struct lock_debug. This makes analysis of locking errors easier and it can be tested whether the correct cpu is releasing a lock again. Signed-off-by: Juergen Gross --- xen/common/spinlock.c | 31 +-- xen/include/xen

[Xen-devel] [PATCH 2/4] xen: add new CONFIG_SPINLOCK_DEBUG option

2019-08-07 Thread Juergen Gross
Instead of enabling spinlock debugging for debug builds only add a dedicated Kconfig option for that purpose which defaults to DEBUG. Signed-off-by: Juergen Gross --- xen/Kconfig.debug | 7 +++ xen/common/spinlock.c | 4 ++-- xen/include/xen/spinlock.h | 2 +- 3 files changed

[Xen-devel] [PATCH 4/4] xen: modify lock profiling interface

2019-08-07 Thread Juergen Gross
ned-off-by: Juergen Gross --- tools/libxc/xc_misc.c | 1 + tools/misc/xenlockprof.c| 17 ++--- xen/common/domain.c | 4 +- xen/common/spinlock.c | 92 +++-- xen/include/public/sysctl.h | 11 ++ xen/include/xen/spinlo

Re: [Xen-devel] [PATCH 1/4] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-07 Thread Juergen Gross
On 07.08.19 19:05, Andrew Cooper wrote: On 07/08/2019 15:31, Juergen Gross wrote: Add the cpu currently holding the lock to struct lock_debug. This makes analysis of locking errors easier and it can be tested whether the correct cpu is releasing a lock again. Signed-off-by: Juergen Gross

Re: [Xen-devel] [PATCH 2/4] xen: add new CONFIG_SPINLOCK_DEBUG option

2019-08-07 Thread Juergen Gross
On 07.08.19 19:17, Andrew Cooper wrote: On 07/08/2019 15:31, Juergen Gross wrote: Instead of enabling spinlock debugging for debug builds only add a dedicated Kconfig option for that purpose which defaults to DEBUG. Signed-off-by: Juergen Gross --- xen/Kconfig.debug | 7

Re: [Xen-devel] [PATCH 0/4] enhance lock debugging

2019-08-07 Thread Juergen Gross
On 07.08.19 20:11, Andrew Cooper wrote: On 07/08/2019 15:31, Juergen Gross wrote: While hunting a locking problem in my core scheduling series I have added some debugging aids to spinlock handling making it easier to find the root cause for the problem. Making use of the already lock profiling

Re: [Xen-devel] [PATCH 2/4] xen: add new CONFIG_SPINLOCK_DEBUG option

2019-08-08 Thread Juergen Gross
On 08.08.19 08:34, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -44,6 +44,13 @@ config COVERAGE     If unsure, say N here. +config SPINLOCK_DEBUG +    bool "Spinlock debugging" +    default DEBUG + 

Re: [Xen-devel] [PATCH 1/4] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-08 Thread Juergen Gross
On 08.08.19 08:58, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -13,9 +13,9 @@ static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0); -static void check_lock(struct lock_debug *debug) +static void

Re: [Xen-devel] [PATCH 4/4] xen: modify lock profiling interface

2019-08-08 Thread Juergen Gross
On 08.08.19 09:32, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: @@ -463,31 +464,67 @@ int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc) return rc; } -void _lock_profile_register_struct( -int32_t type, struct lock_profile_qhead *qhead, int32_t

Re: [Xen-devel] [PATCH 2/4] xen: add new CONFIG_SPINLOCK_DEBUG option

2019-08-08 Thread Juergen Gross
On 08.08.19 09:35, Jan Beulich wrote: On 08.08.2019 09:23, Juergen Gross wrote: On 08.08.19 08:34, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -44,6 +44,13 @@ config COVERAGE     If unsure, say N here. +config

Re: [Xen-devel] [PATCH 3/4] xen: print lock profile info in panic()

2019-08-08 Thread Juergen Gross
On 08.08.19 09:09, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -53,6 +53,7 @@ config SPINLOCK_DEBUG config LOCK_PROFILE bool "Lock Profiling" + select SPINLOCK_DEBUG ---help---

Re: [Xen-devel] [PATCH 0/4] enhance lock debugging

2019-08-08 Thread Juergen Gross
On 08.08.19 10:33, Andrew Cooper wrote: On 08/08/2019 05:50, Juergen Gross wrote: On 07.08.19 20:11, Andrew Cooper wrote: Its not exactly the easiest to dump to follow. First of all - I don't see why the hold/block time are printed like that.  It might be a holdover from the 32bit

Re: [Xen-devel] [PATCH 1/4] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-08 Thread Juergen Gross
On 08.08.19 12:28, Julien Grall wrote: On 08/08/2019 08:51, Juergen Gross wrote: On 08.08.19 08:58, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: Do we have an implied assumption somewhere that unsigned short is exactly 16 bits wide? I think "val" wants to be uint16_

Re: [Xen-devel] [PATCH 0/4] enhance lock debugging

2019-08-08 Thread Juergen Gross
On 08.08.19 12:20, Andrew Cooper wrote: On 08/08/2019 10:36, Juergen Gross wrote: On 08.08.19 10:33, Andrew Cooper wrote: On 08/08/2019 05:50, Juergen Gross wrote: On 07.08.19 20:11, Andrew Cooper wrote: Its not exactly the easiest to dump to follow. First of all - I don't see wh

Re: [Xen-devel] [PATCH 1/4] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-08 Thread Juergen Gross
On 08.08.19 14:18, Jan Beulich wrote: On 08.08.2019 13:53, Juergen Gross wrote: On 08.08.19 12:28, Julien Grall wrote: On 08/08/2019 08:51, Juergen Gross wrote: On 08.08.19 08:58, Jan Beulich wrote: On 07.08.2019 16:31, Juergen Gross wrote: Do we have an implied assumption somewhere that

Re: [Xen-devel] [PATCH 0/4] enhance lock debugging

2019-08-08 Thread Juergen Gross
On 08.08.19 11:36, Juergen Gross wrote: On 08.08.19 10:33, Andrew Cooper wrote: On 08/08/2019 05:50, Juergen Gross wrote: On 07.08.19 20:11, Andrew Cooper wrote: For sanity sake, we should enforce unique naming of any lock registered for profiling. This would be every lock inited via

[Xen-devel] [PATCH v2 0/5] enhance lock debugging

2019-08-08 Thread Juergen Gross
. when a NMI watchdog is triggering a crash. Changes in V2: - multiple comments addressed - added patch 5 Juergen Gross (5): xen/spinlocks: in debug builds store cpu holding the lock xen: add new CONFIG_DEBUG_LOCKS option xen: print lock profile info in panic() xen: modify lock profiling

[Xen-devel] [PATCH v2 2/5] xen: add new CONFIG_DEBUG_LOCKS option

2019-08-08 Thread Juergen Gross
Instead of enabling debugging for debug builds only add a dedicated Kconfig option for that purpose which defaults to DEBUG. Signed-off-by: Juergen Gross --- V2: - rename to CONFIG_DEBUG_LOCKS (Jan Beulich) --- xen/Kconfig.debug | 7 +++ xen/common/spinlock.c | 4 ++-- xen

[Xen-devel] [PATCH v2 1/5] xen/spinlocks: in debug builds store cpu holding the lock

2019-08-08 Thread Juergen Gross
Add the cpu currently holding the lock to struct lock_debug. This makes analysis of locking errors easier and it can be tested whether the correct cpu is releasing a lock again. Signed-off-by: Juergen Gross --- V2: adjust types (Jan Beulich) --- xen/common/spinlock.c | 33

[Xen-devel] [PATCH v2 5/5] xen: modify several static locks to unique names

2019-08-08 Thread Juergen Gross
In order to have unique names when doing lock profiling several local locks "lock" need to be renamed. Signed-off-by: Juergen Gross --- xen/arch/x86/irq.c | 6 +++--- xen/arch/x86/time.c| 6 +++--- xen/common/keyhandler.c| 6 +++--- xen/common/perfc.c | 6 +

[Xen-devel] [PATCH v2 4/5] xen: modify lock profiling interface

2019-08-08 Thread Juergen Gross
ned-off-by: Juergen Gross --- V2: - add comment about memory allocation needs (Jan Beulich) - check success of memory allocation (Jan Beulich) --- tools/libxc/xc_misc.c | 1 + tools/misc/xenlockprof.c| 17 ++-- xen/common/domain.c | 4 +- xen/common/spinlock.c

[Xen-devel] [PATCH v2 3/5] xen: print lock profile info in panic()

2019-08-08 Thread Juergen Gross
#ifdef CONFIG_LOCK_PROFILE and rename CONFIG_LOCK_PROFILE to CONFIG_DEBUG_LOCK_PROFILE. Also move the .lockprofile.data section to init area in linker scripts as the data is no longer needed after boot. Signed-off-by: Juergen Gross --- V2: - rename CONFIG_LOCK_PROFILE to CONFIG_DEBUG_LOCK_PROFILE

Re: [Xen-devel] [PATCH 0/3] xen/sched: use new idle scheduler for free cpus

2019-08-09 Thread Juergen Gross
On 02.08.19 15:07, Juergen Gross wrote: These three patches have been carved out from my core scheduling series as they are sufficiently independent to be applied even without the big series. Without this little series there are messages like the following to be seen on the console when booting

[Xen-devel] [PATCH v2 37/48] xen/sched: carve out freeing sched_unit memory into dedicated function

2019-08-09 Thread Juergen Gross
We'll need a way to free a sched_unit structure without side effects in a later patch. Signed-off-by: Juergen Gross --- RFC V2: new patch, carved out from RFC V1 patch 49 --- xen/common/schedule.c | 38 +- 1 file changed, 21 insertions(+), 17 dele

[Xen-devel] [PATCH v2 26/48] xen/sched: rework and rename vcpu_force_reschedule()

2019-08-09 Thread Juergen Gross
vcpu we can just do that. In case it is for a foreign vcpu we should pause it for that purpose like we do for all other vcpu state modifications. Rename the function to vcpu_set_periodic_timer() as this now reflects the functionality. Signed-off-by: Juergen Gross --- V1: latch NOW() only after

[Xen-devel] [PATCH v2 35/48] xen/sched: add fall back to idle vcpu when scheduling unit

2019-08-09 Thread Juergen Gross
ff-by: Juergen Gross --- RFC V2: - new patch (Andrew Cooper) V1: - use urgent_count to select correct idle routine (Jan Beulich) V2: - set vcpu->is_running in context_saved() - introduce reset_stack_and_jump_nolp() (Jan Beulich) - readd scrubbing (Jan Beulich, Andrew Cooper) - get_cpu_current

[Xen-devel] [PATCH v2 06/48] xen/sched: switch schedule_data.curr to point at sched_unit

2019-08-09 Thread Juergen Gross
In preparation of core scheduling let the percpu pointer schedule_data.curr point to a strct sched_unit instead of the related vcpu. At the same time rename the per-vcpu scheduler specific structs to per-unit ones. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common

[Xen-devel] [PATCH v2 00/48] xen: add core scheduling support

2019-08-09 Thread Juergen Gross
vidual patches) Changes in RFC V2: - ARM is building now - HVM domains are working now - idling will always be done with idle_vcpu active - other small changes see individual patches Juergen Gross (48): xen/sched: use new sched_unit instead of vcpu in scheduler interfaces xen/sched: move pe

[Xen-devel] [PATCH v2 10/48] xen/sched: add scheduler helpers hiding vcpu

2019-08-09 Thread Juergen Gross
processor of an unit - sched_{set|clear}_pause_flags[_atomic]() to modify pause_flags of the associated vcpu(s) - sched_idle_unit() to get the sched_unit pointer of the idle vcpu of a specific physical cpu Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 3 +-- xen/common

[Xen-devel] [PATCH v2 34/48] xen/sched: add a percpu resource index

2019-08-09 Thread Juergen Gross
-off-by: Juergen Gross --- RFC V2: new patch (carved out from RFC V1 patch 49) --- xen/common/schedule.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c6cd357bc8..13d3392640 100644 --- a/xen/common/schedule.c

[Xen-devel] [PATCH v2 13/48] xen/sched: add is_running indicator to struct sched_unit

2019-08-09 Thread Juergen Gross
pdated whenever the is_running indicator is changed. Use that new field in the schedulers instead of the similar vcpu field. Signed-off-by: Juergen Gross --- RFC V2: fix arm build, don't drop v->is_running --- xen/common/sched_credit.c | 12 +++- xen/common/sched_

[Xen-devel] [PATCH v2 12/48] xen/sched: switch struct task_slice from vcpu to sched_unit

2019-08-09 Thread Juergen Gross
Let the schedulers put a sched_unit pointer into struct task_slice instead of a vcpu pointer. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 8 xen/common/sched_credit.c | 4 ++-- xen/common/sched_credit2.c | 4 ++-- xen/common/sched_null.c | 12

[Xen-devel] [PATCH v2 33/48] xen/sched: support allocating multiple vcpus into one sched unit

2019-08-09 Thread Juergen Gross
f the domain's vcpu linked list, which isn't the case. Signed-off-by: Juergen Gross --- xen/common/schedule.c | 85 +++ 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index bbc9eb9

[Xen-devel] [PATCH v2 36/48] xen/sched: make vcpu_wake() and vcpu_sleep() core scheduling aware

2019-08-09 Thread Juergen Gross
priority than a normal schedule event. Use the same mechanism when waking up a vcpu of a currently active unit. While at it make vcpu_sleep_nosync_locked() static as it is used in schedule.c only. Signed-off-by: Juergen Gross --- RFC V2: add vcpu_sleep() handling and force_context_switch flag V2: fix

[Xen-devel] [PATCH v2 25/48] xen/sched: add runstate counters to struct sched_unit

2019-08-09 Thread Juergen Gross
Add counters to struct sched_unit summing up runstates of associated vcpus. Signed-off-by: Juergen Gross --- RFC V2: add counters for each possible runstate --- xen/common/schedule.c | 5 + xen/include/xen/sched.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/xen/common

[Xen-devel] [PATCH v2 18/48] xen/sched: make arinc653 scheduler vcpu agnostic.

2019-08-09 Thread Juergen Gross
Switch arinc653 scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 208 +--- 1 file changed, 101 insertions(+), 107 deletions(-) diff --git a/xen/common/sched_arinc653.c b/xen/common

[Xen-devel] [PATCH v2 04/48] xen/sched: introduce struct sched_resource

2019-08-09 Thread Juergen Gross
core or socket only. Signed-off-by: Juergen Gross --- V1: - add accessor functions - use DEFINE_PER_CPU_READ_MOSTLY (Dario Faggioli) --- xen/common/sched_credit.c | 2 ++ xen/common/sched_credit2.c | 7 +++ xen/common/sched_null.c| 3 +++ xen/common/sched_rt.c | 2 ++ xen/common

[Xen-devel] [PATCH v2 44/48] xen/sched: support multiple cpus per scheduling resource

2019-08-09 Thread Juergen Gross
Prepare supporting multiple cpus per scheduling resource by allocating the cpumask per resource dynamically. Modify sched_res_mask to have only one bit per scheduling resource set. Signed-off-by: Juergen Gross --- V1: new patch (carved out from other patch) --- xen/common/schedule.c | 16

[Xen-devel] [PATCH v2 01/48] xen/sched: use new sched_unit instead of vcpu in scheduler interfaces

2019-08-09 Thread Juergen Gross
rename local functions switched to sched_unit, too. For now this new struct will contain a domain, a vcpu pointer and a unit_id only and is allocated at vcpu creation time. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- RFC V2: - move definition of struct sched_unit to sched.h

[Xen-devel] [PATCH v2 31/48] xen/sched: add support for multiple vcpus per sched unit where missing

2019-08-09 Thread Juergen Gross
In several places there is support for multiple vcpus per sched unit missing. Add that missing support (with the exception of initial allocation) and missing helpers for that. Signed-off-by: Juergen Gross --- RFC V2: - fix vcpu_runstate_helper() V1: - add special handling for idle unit in

[Xen-devel] [PATCH v2 27/48] xen/sched: Change vcpu_migrate_*() to operate on schedule unit

2019-08-09 Thread Juergen Gross
vcpu_sync_execstate() for each vcpu of the unit when changing processors. vcpu_move_locked() is switched to schedule unit, too. Signed-off-by: Juergen Gross --- xen/common/schedule.c | 106 ++ 1 file changed, 63 insertions(+), 43 deletions(-) diff

[Xen-devel] [PATCH v2 05/48] xen/sched: let pick_cpu return a scheduler resource

2019-08-09 Thread Juergen Gross
Instead of returning a physical cpu number let pick_cpu() return a scheduler resource instead. Rename pick_cpu() to pick_resource() to reflect that change. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_arinc653.c | 12 ++-- xen/common/sched_credit.c

[Xen-devel] [PATCH v2 07/48] xen/sched: move per cpu scheduler private data into struct sched_resource

2019-08-09 Thread Juergen Gross
This prepares support of larger scheduling granularities, e.g. core scheduling. While at it move sched_has_urgent_vcpu() from include/asm-x86/cpuidle.h into schedule.c removing the need for including sched-if.h in cpuidle.h and multiple other C sources. Signed-off-by: Juergen Gross Acked-by

[Xen-devel] [PATCH v2 11/48] xen/sched: rename scheduler related perf counters

2019-08-09 Thread Juergen Gross
Rename the scheduler related perf counters from vcpu* to unit* where appropriate. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c| 32 xen/common/sched_credit2.c | 18 +- xen/common/sched_null.c | 18 +- xen

[Xen-devel] [PATCH v2 24/48] xen: switch from for_each_vcpu() to for_each_sched_unit()

2019-08-09 Thread Juergen Gross
Where appropriate switch from for_each_vcpu() to for_each_sched_unit() in order to prepare core scheduling. As it is beneficial once here and for sure in future add a unit_scheduler() helper and let vcpu_scheduler() use it. Signed-off-by: Juergen Gross --- V2: - handle affinity_broken correctly

[Xen-devel] [PATCH v2 23/48] xen/sched: switch sched_move_irqs() to take sched_unit as parameter

2019-08-09 Thread Juergen Gross
sched_move_irqs() should work on a sched_unit as that is the unit moved between cpus. Rename the current function to vcpu_move_irqs() as it is still needed in schedule(). Signed-off-by: Juergen Gross --- xen/common/schedule.c | 18 +- 1 file changed, 13 insertions(+), 5

[Xen-devel] [PATCH v2 02/48] xen/sched: move per-vcpu scheduler private data pointer to sched_unit

2019-08-09 Thread Juergen Gross
This prepares making the different schedulers vcpu agnostic. Note that some scheduler specific accessor function are misnamed after this patch. This will be corrected in later patches. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 4 ++-- xen/common/sched_credit.c | 6

[Xen-devel] [PATCH v2 16/48] xen/sched: make credit scheduler vcpu agnostic.

2019-08-09 Thread Juergen Gross
Switch credit scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 503 +++--- 1 file changed, 250 insertions(+), 253 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common

[Xen-devel] [PATCH v2 28/48] xen/sched: move struct task_slice into struct sched_unit

2019-08-09 Thread Juergen Gross
. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 20 +++- xen/common/sched_credit.c | 25 +++-- xen/common/sched_credit2.c | 21 + xen/common/sched_null.c | 29 ++--- xen/common/sched_rt.c | 22

[Xen-devel] [PATCH v2 19/48] xen: add sched_unit_pause_nosync() and sched_unit_unpause()

2019-08-09 Thread Juergen Gross
The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause() today. Add sched_unit_pause_nosync() and sched_unit_unpause() to perform the same operations on scheduler units instead. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 6 +++--- xen/include/xen/sched-if.h | 10

[Xen-devel] [PATCH v2 22/48] xen/sched: switch schedule() from vcpus to sched_units

2019-08-09 Thread Juergen Gross
Use sched_units instead of vcpus in schedule(). This includes the introduction of sched_unit_runstate_change() as a replacement of vcpu_runstate_change() in schedule(). Signed-off-by: Juergen Gross --- xen/common/schedule.c | 68 +-- 1 file

[Xen-devel] [PATCH v2 09/48] xen/sched: move some per-vcpu items to struct sched_unit

2019-08-09 Thread Juergen Gross
flag must be kept per vcpu as it is related to guest actions on specific vcpus. Signed-off-by: Juergen Gross --- V2: - move affinity_broken back to struct vcpu (Jan Beulich) - print affinities only once per unit (Jan Beulich) --- xen/common/domain.c| 15 ++-- xen/common/domctl.c

[Xen-devel] [PATCH v2 29/48] xen/sched: add code to sync scheduling of all vcpus of a sched unit

2019-08-09 Thread Juergen Gross
selecting the vcpu to switch to, as we already know which vcpu we want to run. This has the other advantage not to loose any other concurrent SCHEDULE_SOFTIRQ events. Signed-off-by: Juergen Gross --- RFC V2: - move syncing after context_switch() to schedule.c V2: - don't run tasklets directly

[Xen-devel] [PATCH v2 41/48] xen/sched: prepare per-cpupool scheduling granularity

2019-08-09 Thread Juergen Gross
populating the cpupool with cpus. This will make on- and offlining of cpus much easier and avoids writing code which would needed to be thrown away later. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 23

[Xen-devel] [PATCH v2 39/48] xen/sched: move per-cpu variable cpupool to struct sched_resource

2019-08-09 Thread Juergen Gross
Having a pointer to struct cpupool in struct sched_resource instead of per cpu is enough. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 4 +--- xen/common/sched_credit.c | 2 +- xen/common/sched_rt.c | 2 +- xen/common/schedule.c | 8 xen

[Xen-devel] [PATCH v2 40/48] xen/sched: reject switching smt on/off with core scheduling active

2019-08-09 Thread Juergen Gross
When core or socket scheduling are active enabling or disabling smt is not possible as that would require a major host reconfiguration. Add a bool sched_disable_smt_switching which will be set for core or socket scheduling. Signed-off-by: Juergen Gross --- V1: - new patch V2: - EBUSY as return

[Xen-devel] [PATCH v2 14/48] xen/sched: make null scheduler vcpu agnostic.

2019-08-09 Thread Juergen Gross
Switch null scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_null.c | 333 1 file changed, 165 insertions(+), 168 deletions(-) diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c

[Xen-devel] [PATCH v2 03/48] xen/sched: build a linked list of struct sched_unit

2019-08-09 Thread Juergen Gross
for_each_sched_unit_vcpu() which will iterate over all vcpus of a sched_unit (right now only one). This will be needed later for larger scheduling granularity (e.g. cores). Signed-off-by: Juergen Gross --- V2: - add comment (Dario Faggioli) --- xen/common/schedule.c | 60

[Xen-devel] [PATCH v2 47/48] xen/sched: disable scheduling when entering ACPI deep sleep states

2019-08-09 Thread Juergen Gross
softirq handler with a dummy scheduling routine only enabling tasklets to run. Signed-off-by: Juergen Gross --- V2: new patch --- xen/arch/x86/acpi/power.c | 4 xen/common/schedule.c | 31 +-- xen/include/xen/sched.h | 2 ++ 3 files changed, 35 insertions

[Xen-devel] [PATCH v2 08/48] xen/sched: switch vcpu_schedule_lock to unit_schedule_lock

2019-08-09 Thread Juergen Gross
Rename vcpu_schedule_[un]lock[_irq]() to unit_schedule_[un]lock[_irq]() and let it take a sched_unit pointer instead of a vcpu pointer as parameter. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 17 xen/common/sched_credit2.c | 40

[Xen-devel] [PATCH v2 45/48] xen/sched: support differing granularity in schedule_cpu_[add/rm]()

2019-08-09 Thread Juergen Gross
pdata and vdata and loop over those where appropriate. Additionally the scheduling resource(s) must either be merged or split. Signed-off-by: Juergen Gross --- xen/common/cpupool.c | 18 ++-- xen/common/schedule.c | 226 +++--- 2 files changed, 204

[Xen-devel] [PATCH v2 15/48] xen/sched: make rt scheduler vcpu agnostic.

2019-08-09 Thread Juergen Gross
Switch rt scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_rt.c | 356 -- 1 file changed, 174 insertions(+), 182 deletions(-) diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index

[Xen-devel] [PATCH v2 46/48] xen/sched: support core scheduling for moving cpus to/from cpupools

2019-08-09 Thread Juergen Gross
With core scheduling active it is necessary to move multiple cpus at the same time to or from a cpupool in order to avoid split scheduling resources in between. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 100 + xen

[Xen-devel] [PATCH v2 32/48] xen/sched: modify cpupool_domain_cpumask() to be an unit mask

2019-08-09 Thread Juergen Gross
cpupool_domain_cpumask() is used by scheduling to select cpus or to iterate over cpus. In order to support scheduling units spanning multiple cpus let cpupool_domain_cpumask() return a cpumask with only one bit set per scheduling resource. Signed-off-by: Juergen Gross --- xen/common/cpupool.c

<    3   4   5   6   7   8   9   10   11   12   >