From: Dario Faggioli <dfaggioli@suse.com> To: xen-devel@lists.xenproject.org Cc: "Juergen Gross" <jgross@suse.com>, "Stefano Stabellini" <sstabellini@kernel.org>, "Wei Liu" <wei.liu2@citrix.com>, "Andrew Cooper" <andrew.cooper3@citrix.com>, "George Dunlap" <george.dunlap@citrix.com>, "Julien Grall" <julien.grall@arm.com>, "Jan Beulich" <jbeulich@suse.com>, "Roger Pau Monné" <roger.pau@citrix.com> Subject: [PATCH 2/2] xen: sched: we never get into context_switch() with prev==next Date: Sat, 20 Apr 2019 17:24:47 +0200 [thread overview] Message-ID: <155577388740.25746.3780283868034526234.stgit@wayrath> (raw) In-Reply-To: <155577364571.25746.11988517450711182732.stgit@wayrath> In schedule(), if we pick, as the next vcpu to run (next) the same one that is running already (prev), we never get to call context_switch(). We can, therefore, get rid of all the `if`-s testing prev and next being different, trading them with an ASSERT() (on ARM, the ASSERT() was even already there!) Signed-off-by: Dario Faggioli <dfaggioli@suse.com> Suggested-by: Juergen Gross <jgross@suse.com> --- Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Julien Grall <julien.grall@arm.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Cc: "Roger Pau Monné" <roger.pau@citrix.com> Cc: George Dunlap <george.dunlap@citrix.com> Cc: Juergen Gross <jgross@suse.com> --- xen/arch/arm/domain.c | 3 +-- xen/arch/x86/domain.c | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 6dc633ed50..915ae0b4c6 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -343,8 +343,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) ASSERT(prev != next); ASSERT(!vcpu_cpu_dirty(next)); - if ( prev != next ) - update_runstate_area(prev); + update_runstate_area(prev); local_irq_disable(); diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 9eaa978ce5..d2d9f2fc3c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1721,6 +1721,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) const struct domain *prevd = prev->domain, *nextd = next->domain; unsigned int dirty_cpu = next->dirty_cpu; + ASSERT(prev != next); ASSERT(local_irq_is_enabled()); get_cpu_info()->use_pv_cr3 = false; @@ -1732,12 +1733,9 @@ void context_switch(struct vcpu *prev, struct vcpu *next) flush_mask(cpumask_of(dirty_cpu), FLUSH_VCPU_STATE); } - if ( prev != next ) - { - _update_runstate_area(prev); - vpmu_switch_from(prev); - np2m_schedule(NP2M_SCHEDLE_OUT); - } + _update_runstate_area(prev); + vpmu_switch_from(prev); + np2m_schedule(NP2M_SCHEDLE_OUT); if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm.tm_list) ) pt_save_timer(prev); @@ -1794,14 +1792,10 @@ void context_switch(struct vcpu *prev, struct vcpu *next) context_saved(prev); - if ( prev != next ) - { - _update_runstate_area(next); - - /* Must be done with interrupts enabled */ - vpmu_switch_to(next); - np2m_schedule(NP2M_SCHEDLE_IN); - } + _update_runstate_area(next); + /* Must be done with interrupts enabled */ + vpmu_switch_to(next); + np2m_schedule(NP2M_SCHEDLE_IN); /* Ensure that the vcpu has an up-to-date time base. */ update_vcpu_system_time(next); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Dario Faggioli <dfaggioli@suse.com> To: xen-devel@lists.xenproject.org Cc: "Juergen Gross" <jgross@suse.com>, "Stefano Stabellini" <sstabellini@kernel.org>, "Wei Liu" <wei.liu2@citrix.com>, "Andrew Cooper" <andrew.cooper3@citrix.com>, "George Dunlap" <george.dunlap@citrix.com>, "Julien Grall" <julien.grall@arm.com>, "Jan Beulich" <jbeulich@suse.com>, "Roger Pau Monné" <roger.pau@citrix.com> Subject: [Xen-devel] [PATCH 2/2] xen: sched: we never get into context_switch() with prev==next Date: Sat, 20 Apr 2019 17:24:47 +0200 [thread overview] Message-ID: <155577388740.25746.3780283868034526234.stgit@wayrath> (raw) Message-ID: <20190420152447.B3GaMoahuu6AzQ4jzbEb7pgtfRP9AoUOtx2j-uYN3QQ@z> (raw) In-Reply-To: <155577364571.25746.11988517450711182732.stgit@wayrath> In schedule(), if we pick, as the next vcpu to run (next) the same one that is running already (prev), we never get to call context_switch(). We can, therefore, get rid of all the `if`-s testing prev and next being different, trading them with an ASSERT() (on ARM, the ASSERT() was even already there!) Signed-off-by: Dario Faggioli <dfaggioli@suse.com> Suggested-by: Juergen Gross <jgross@suse.com> --- Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Julien Grall <julien.grall@arm.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Cc: "Roger Pau Monné" <roger.pau@citrix.com> Cc: George Dunlap <george.dunlap@citrix.com> Cc: Juergen Gross <jgross@suse.com> --- xen/arch/arm/domain.c | 3 +-- xen/arch/x86/domain.c | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 6dc633ed50..915ae0b4c6 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -343,8 +343,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) ASSERT(prev != next); ASSERT(!vcpu_cpu_dirty(next)); - if ( prev != next ) - update_runstate_area(prev); + update_runstate_area(prev); local_irq_disable(); diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 9eaa978ce5..d2d9f2fc3c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1721,6 +1721,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) const struct domain *prevd = prev->domain, *nextd = next->domain; unsigned int dirty_cpu = next->dirty_cpu; + ASSERT(prev != next); ASSERT(local_irq_is_enabled()); get_cpu_info()->use_pv_cr3 = false; @@ -1732,12 +1733,9 @@ void context_switch(struct vcpu *prev, struct vcpu *next) flush_mask(cpumask_of(dirty_cpu), FLUSH_VCPU_STATE); } - if ( prev != next ) - { - _update_runstate_area(prev); - vpmu_switch_from(prev); - np2m_schedule(NP2M_SCHEDLE_OUT); - } + _update_runstate_area(prev); + vpmu_switch_from(prev); + np2m_schedule(NP2M_SCHEDLE_OUT); if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm.tm_list) ) pt_save_timer(prev); @@ -1794,14 +1792,10 @@ void context_switch(struct vcpu *prev, struct vcpu *next) context_saved(prev); - if ( prev != next ) - { - _update_runstate_area(next); - - /* Must be done with interrupts enabled */ - vpmu_switch_to(next); - np2m_schedule(NP2M_SCHEDLE_IN); - } + _update_runstate_area(next); + /* Must be done with interrupts enabled */ + vpmu_switch_to(next); + np2m_schedule(NP2M_SCHEDLE_IN); /* Ensure that the vcpu has an up-to-date time base. */ update_vcpu_system_time(next); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-04-20 15:24 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-20 15:24 [PATCH 0/2] xen: sched/Credit2: small and trivial improvements Dario Faggioli 2019-04-20 15:24 ` [Xen-devel] " Dario Faggioli 2019-04-20 15:24 ` [PATCH 1/2] xen: credit2: avoid using cpumask_weight() in hot-paths Dario Faggioli 2019-04-20 15:24 ` [Xen-devel] " Dario Faggioli 2019-04-23 9:44 ` Andrew Cooper 2019-04-23 9:44 ` [Xen-devel] " Andrew Cooper 2019-04-26 13:01 ` Dario Faggioli 2019-04-26 13:01 ` [Xen-devel] " Dario Faggioli 2019-04-23 9:48 ` Andrii Anisov 2019-04-23 9:48 ` [Xen-devel] " Andrii Anisov 2019-04-20 15:24 ` Dario Faggioli [this message] 2019-04-20 15:24 ` [Xen-devel] [PATCH 2/2] xen: sched: we never get into context_switch() with prev==next Dario Faggioli 2019-04-21 17:08 ` Julien Grall 2019-04-21 17:08 ` [Xen-devel] " Julien Grall 2019-04-23 9:13 ` Andrii Anisov 2019-04-23 9:13 ` [Xen-devel] " Andrii Anisov 2019-04-23 9:47 ` Andrew Cooper 2019-04-23 9:47 ` [Xen-devel] " Andrew Cooper 2019-04-23 10:33 ` Andrii Anisov 2019-04-23 10:33 ` [Xen-devel] " Andrii Anisov 2019-04-26 15:13 ` Dario Faggioli 2019-04-26 15:13 ` [Xen-devel] " Dario Faggioli 2019-04-26 16:22 ` Julien Grall 2019-04-26 16:22 ` [Xen-devel] " Julien Grall 2019-04-26 16:26 ` Andrew Cooper 2019-04-26 16:26 ` [Xen-devel] " Andrew Cooper 2019-05-08 10:03 ` Andrii Anisov 2019-05-08 10:03 ` [Xen-devel] " Andrii Anisov 2019-04-23 9:50 ` George Dunlap 2019-04-23 9:50 ` [Xen-devel] " George Dunlap 2019-04-23 9:56 ` Juergen Gross 2019-04-23 9:56 ` [Xen-devel] " Juergen Gross 2019-04-26 12:58 ` Dario Faggioli 2019-04-26 12:58 ` [Xen-devel] " Dario Faggioli 2019-04-23 10:00 ` Andrew Cooper 2019-04-23 10:00 ` [Xen-devel] " Andrew Cooper
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=155577388740.25746.3780283868034526234.stgit@wayrath \ --to=dfaggioli@suse.com \ --cc=andrew.cooper3@citrix.com \ --cc=george.dunlap@citrix.com \ --cc=jbeulich@suse.com \ --cc=jgross@suse.com \ --cc=julien.grall@arm.com \ --cc=roger.pau@citrix.com \ --cc=sstabellini@kernel.org \ --cc=wei.liu2@citrix.com \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.