From: Paul Durrant <paul@xen.org>
To: xen-devel@lists.xenproject.org
Cc: "Paul Durrant" <pdurrant@amazon.com>, "Wei Liu" <wl@xen.org>,
"Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v2 06/12] viridian: use softirq batching in hvcall_ipi()
Date: Fri, 20 Nov 2020 09:48:54 +0000 [thread overview]
Message-ID: <20201120094900.1489-7-paul@xen.org> (raw)
In-Reply-To: <20201120094900.1489-1-paul@xen.org>
From: Paul Durrant <pdurrant@amazon.com>
vlapic_ipi() uses a softirq batching mechanism to improve the efficiency of
sending a IPIs to large number of processors. This patch modifies send_ipi()
(the worker function called by hvcall_ipi()) to also make use of the
mechanism when there multiple bits set the hypercall_vpmask.
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Wei Liu <wl@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
v2:
- Don't add the 'nr' field to struct hypercall_vpmask and use
bitmap_weight() instead
---
xen/arch/x86/hvm/viridian/viridian.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index d8d8ecc89c80..d6f47b28c1e6 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -11,6 +11,7 @@
#include <xen/hypercall.h>
#include <xen/domain_page.h>
#include <xen/param.h>
+#include <xen/softirq.h>
#include <asm/guest/hyperv-tlfs.h>
#include <asm/paging.h>
#include <asm/p2m.h>
@@ -570,6 +571,11 @@ static unsigned int vpmask_next(struct hypercall_vpmask *vpmask, unsigned int vp
(vp) < HVM_MAX_VCPUS; \
(vp) = vpmask_next(vpmask, vp) )
+static unsigned int vpmask_nr(const struct hypercall_vpmask *vpmask)
+{
+ return bitmap_weight(vpmask->mask, HVM_MAX_VCPUS);
+}
+
/*
* Windows should not issue the hypercalls requiring this callback in the
* case where vcpu_id would exceed the size of the mask.
@@ -653,10 +659,17 @@ static int hvcall_flush(union hypercall_input *input,
static void send_ipi(struct hypercall_vpmask *vpmask, uint8_t vector)
{
struct domain *currd = current->domain;
+ unsigned int nr = vpmask_nr(vpmask);
unsigned int vp;
+ if ( nr > 1 )
+ cpu_raise_softirq_batch_begin();
+
for_each_vp ( vpmask, vp )
vlapic_set_irq(vcpu_vlapic(currd->vcpu[vp]), vector, 0);
+
+ if ( nr > 1 )
+ cpu_raise_softirq_batch_finish();
}
static int hvcall_ipi(union hypercall_input *input,
--
2.20.1
next prev parent reply other threads:[~2020-11-20 9:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 9:48 [PATCH v2 00/12] viridian: add support for ExProcessorMasks Paul Durrant
2020-11-20 9:48 ` [PATCH v2 01/12] viridian: don't blindly write to 32-bit registers is 'mode' is invalid Paul Durrant
2020-11-20 14:20 ` Jan Beulich
2020-11-20 14:25 ` Durrant, Paul
2020-11-20 9:48 ` [PATCH v2 02/12] viridian: move flush hypercall implementation into separate function Paul Durrant
2020-11-20 9:48 ` [PATCH v2 03/12] viridian: move IPI " Paul Durrant
2020-11-20 9:48 ` [PATCH v2 04/12] viridian: introduce a per-cpu hypercall_vpmask and accessor functions Paul Durrant
2020-11-20 9:48 ` [PATCH v2 05/12] viridian: use hypercall_vpmask in hvcall_ipi() Paul Durrant
2020-11-20 15:09 ` Jan Beulich
2020-11-20 15:12 ` Durrant, Paul
2020-11-20 9:48 ` Paul Durrant [this message]
2020-11-20 15:11 ` [PATCH v2 06/12] viridian: use softirq batching " Jan Beulich
2020-11-20 9:48 ` [PATCH v2 07/12] xen/include: import sizeof_field() macro from Linux stddef.h Paul Durrant
2020-11-20 15:15 ` Jan Beulich
2020-11-20 15:24 ` Paul Durrant
2020-11-20 9:48 ` [PATCH v2 08/12] viridian: add ExProcessorMasks variants of the flush hypercalls Paul Durrant
2020-11-24 16:55 ` Jan Beulich
2020-11-24 18:40 ` Paul Durrant
2020-11-20 9:48 ` [PATCH v2 09/12] viridian: add ExProcessorMasks variant of the IPI hypercall Paul Durrant
2020-11-24 16:58 ` Jan Beulich
2020-11-20 9:48 ` [PATCH v2 10/12] viridian: log initial invocation of each type of hypercall Paul Durrant
2020-11-20 9:48 ` [PATCH v2 11/12] viridian: add a new '_HVMPV_ex_processor_masks' bit into HVM_PARAM_VIRIDIAN Paul Durrant
2020-11-20 9:49 ` [PATCH v2 12/12] xl / libxl: add 'ex_processor_mask' into 'libxl_viridian_enlightenment' Paul Durrant
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=20201120094900.1489-7-paul@xen.org \
--to=paul@xen.org \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=pdurrant@amazon.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).