From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: keir@xen.org, ian.campbell@citrix.com, tim@xen.org,
ian.jackson@eu.citrix.com, Jan Beulich <JBeulich@suse.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v8 for-xen-4.5 2/2] dpci: Replace tasklet with an softirq (v8)
Date: Mon, 27 Oct 2014 14:00:10 -0400 [thread overview]
Message-ID: <20141027180010.GB12989@laptop.dumpdata.com> (raw)
In-Reply-To: <544E8283.1030907@citrix.com>
On Mon, Oct 27, 2014 at 05:36:03PM +0000, Andrew Cooper wrote:
> On 27/10/14 17:01, Konrad Rzeszutek Wilk wrote:
> > On Mon, Oct 27, 2014 at 11:24:31AM +0000, Jan Beulich wrote:
> >>>>> On 27.10.14 at 12:09, <andrew.cooper3@citrix.com> wrote:
> >>> Can it ever be the case that we are waiting for a remote pcpu to run its
> >>> softirq handler? If so, the time spent looping here could be up to 1
> >>> scheduling timeslice in the worst case, and 30ms is a very long time to
> >>> wait.
> >> Good point - I think this can be the case. But there seems to be a
> >> simple counter measure: The first time we get to this point, send an
> >> event check IPI to the CPU in question (or in the worst case
> >> broadcast one if the CPU can't be determined in a race free way).
> > I can either do this using the wrapper:
> >
> > if ( pt_pirq_softirq_active(pirq_dpci) )
> > {
> > spin_unlock(&d->event_lock);
> > if ( pirq_dpci->cpu >= 0 )
> > {
> > cpu_raise_softirq(pirq_dpci->cpu, HVM_DPCI_SOFTIRQ);
> > pirq_dpci->cpu = -1;
> > }
> > cpu_relax();
> > goto restart;
> >
> > Ought to do it (cpu_raise_softirq will exit out if
> > the 'pirq_dpci->cpu == smp_processor_id()'). It also has some batching checks
> > so that we won't do the IPI if we are in the middle of IPI-ing already
> > an CPU.
> >
> > Or just write it out (and bypass some of the checks 'cpu_raise_softirq'
> > has):
> >
> > if ( pt_pirq_softirq_active(pirq_dpci) )
> > {
> > spin_unlock(&d->event_lock);
> > if ( pirq_dpci->cpu >= 0 && pirq_dpci->cpu != smp_processor_id() )
> > {
> > smp_send_event_check_cpu(pirq_dpci->cpu);
> > pirq_dpci->cpu = -1;
> > }
> > cpu_relax();
> > goto restart;
> >
> >
> > Note:
> >
> > The 'cpu' is stashed whenever 'raise_softirq_for' has been called.
> >
>
> You need to send at most 1 IPI, or you will be pointlessly spamming the
> target pcpu. Therefore, a blind goto restart seems ill-advised.
Right. That is what it does (it sets pirq_dpci->cpu to a negative value
so that we don't try to spam the target).
>
> The second version doesn't necessarily set HVM_DPCI_SOFTIRQ pending,
It does not have to as the target has already done so. That is because
the ->cpu value is set in raise_softirq_for which also sets the
HVM_DPIC_SOFTIRQ pending.
> while the first version suffers a risk of the softirq being caught in a
> batch.
Correct.
>
> Furthermore, with mwait support, the IPI is elided completely, which is
> completely wrong in this situation.
Wait, where did that come from? If we use mwaits IPIs are ignored?
Oh, you mean with the 'batching' support.
>O
> Therefore, I think you need to manually set the HVM_DPCI_SOFTIRQ bit,
> then forcibly send the IPI.
OK, so the second (smp_send_event_check_cpu). And the bit is already
set - but I will add a comment explaining that.
>
> ~Andrew
>
next prev parent reply other threads:[~2014-10-27 18:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 17:19 [PATCH v8 for-xen-4.5] Fix interrupt latency of HVM PCI passthrough devices Konrad Rzeszutek Wilk
2014-10-21 17:19 ` [PATCH v8 for-xen-4.5 1/2] dpci: Move from an hvm_irq_dpci (and struct domain) to an hvm_dirq_dpci model Konrad Rzeszutek Wilk
2014-10-23 8:58 ` Jan Beulich
2014-10-24 1:58 ` Konrad Rzeszutek Wilk
2014-10-24 9:49 ` Jan Beulich
2014-10-24 19:09 ` Konrad Rzeszutek Wilk
2014-10-27 9:25 ` Jan Beulich
2014-10-27 16:36 ` Konrad Rzeszutek Wilk
2014-10-27 16:57 ` Jan Beulich
2014-10-21 17:19 ` [PATCH v8 for-xen-4.5 2/2] dpci: Replace tasklet with an softirq (v8) Konrad Rzeszutek Wilk
2014-10-23 9:36 ` Jan Beulich
2014-10-24 1:58 ` Konrad Rzeszutek Wilk
2014-10-24 10:09 ` Jan Beulich
2014-10-24 20:55 ` Konrad Rzeszutek Wilk
2014-10-25 0:39 ` Konrad Rzeszutek Wilk
2014-10-27 9:36 ` Jan Beulich
2014-10-27 16:36 ` Konrad Rzeszutek Wilk
2014-10-27 9:32 ` Jan Beulich
2014-10-27 10:40 ` Andrew Cooper
2014-10-27 10:59 ` Jan Beulich
2014-10-27 11:09 ` Andrew Cooper
2014-10-27 11:24 ` Jan Beulich
2014-10-27 17:01 ` Konrad Rzeszutek Wilk
2014-10-27 17:36 ` Andrew Cooper
2014-10-27 18:00 ` Konrad Rzeszutek Wilk [this message]
2014-10-27 21:13 ` Konrad Rzeszutek Wilk
2014-10-28 10:43 ` Jan Beulich
2014-10-28 20:07 ` Konrad Rzeszutek Wilk
2014-10-29 8:28 ` Jan Beulich
2014-10-29 21:11 ` Konrad Rzeszutek Wilk
2014-10-30 9:04 ` Jan Beulich
2014-11-02 20:09 ` Konrad Rzeszutek Wilk
2014-11-03 8:46 ` Jan Beulich
2014-10-28 7:58 ` Jan Beulich
2014-10-28 7:53 ` Jan Beulich
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=20141027180010.GB12989@laptop.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=tim@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 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.