mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	David Woodhouse <dwmw2@infradead.org>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	x86@kernel.org, boris.ostrovsky@oracle.com, hpa@zytor.com,
	mingo@redhat.com, bp@alien8.de, stable@vger.kernel.org,
	Waiman.Long@hp.com, peterz@infradead.org
Subject: Re: [PATCH 2/2] xen: make xen_qlock_wait() nestable
Date: Wed, 10 Oct 2018 15:38:11 +0200	[thread overview]
Message-ID: <35f0d72b-c4b9-3557-6348-25a8646c6995@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1810101445530.10278@nanos.tec.linutronix.de>

On 10/10/2018 14:47, Thomas Gleixner wrote:
> On Wed, 10 Oct 2018, David Woodhouse wrote:
>> On Wed, 2018-10-10 at 14:30 +0200, Thomas Gleixner wrote:
>>> On Wed, 10 Oct 2018, David Woodhouse wrote:
>>>
>>>> On Mon, 2018-10-01 at 09:16 +0200, Juergen Gross wrote:
>>>>> -       /* If irq pending already clear it and return. */
>>>>> +       /* Guard against reentry. */
>>>>> +       local_irq_save(flags);
>>>>> +
>>>>> +       /* If irq pending already clear it. */
>>>>>         if (xen_test_irq_pending(irq)) {
>>>>>                 xen_clear_irq_pending(irq);
>>>>> -               return;
>>>>> +       } else if (READ_ONCE(*byte) == val) {
>>>>> +               /* Block until irq becomes pending (or a spurious wakeup) */
>>>>> +               xen_poll_irq(irq);
>>>>>         }
>>>>
>>>>
>>>> Does this still allow other IRQs to wake it from xen_poll_irq()?
>>>>
>>>> In the case where process-context code is spinning for a lock without
>>>> disabling interrupts, we *should* allow interrupts to occur still...
>>>> does this?
>>>
>>> Yes. Look at it like idle HLT or WFI. You have to disable interrupt before
>>> checking the condition and then the hardware or in this case the hypervisor
>>> has to bring you back when an interrupt is raised.
>>>
>>> If that would not work then the check would be racy, because the interrupt
>>> could hit and be handled after the check and before going into
>>> HLT/WFI/hypercall and then the thing is out until the next interrupt comes
>>> along, which might be never.
>>
>> Right, but in this case we're calling into the hypervisor to poll for
>> one *specific* IRQ. Everything you say is true for that specific IRQ.
>>
>> My question is what happens to *other* IRQs. We want them, but are they
>> masked? I'm staring at the Xen do_poll() code and haven't quite worked
>> that out...
> 
> Ah, sorry. That of course has to come back like HLT/WFI for any interrupt,
> but I have no idea what the Xen HV is doing there.

The Xen HV is doing it right. It is blocking the vcpu in do_poll() and
any interrupt will unblock it.


Juergen


  reply	other threads:[~2018-10-10 13:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  7:16 [PATCH 0/2] xen: fix two issues in Xen pv qspinlock handling Juergen Gross
2018-10-01  7:16 ` [PATCH 1/2] xen: fix race in xen_qlock_wait() Juergen Gross
2018-10-01  7:37   ` Juergen Gross
2018-10-01  8:54   ` [Xen-devel] " Jan Beulich
2018-10-01  7:16 ` [PATCH 2/2] xen: make xen_qlock_wait() nestable Juergen Gross
2018-10-01  7:38   ` Juergen Gross
2018-10-01  8:57   ` [Xen-devel] " Jan Beulich
     [not found]   ` <5BB1E18802000078001ED127@suse.com>
2018-10-01  9:03     ` Juergen Gross
2018-10-01  9:18       ` Jan Beulich
2018-10-10 11:53   ` David Woodhouse
2018-10-10 12:30     ` Thomas Gleixner
2018-10-10 12:44       ` David Woodhouse
2018-10-10 12:47         ` Thomas Gleixner
2018-10-10 13:38           ` Juergen Gross [this message]
2018-10-10 13:53             ` David Woodhouse
2018-10-01  7:37 ` [PATCH 0/2] xen: fix two issues in Xen pv qspinlock handling Juergen Gross
2018-10-09 14:40 ` David Woodhouse
2018-10-09 14:52   ` Juergen Gross

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=35f0d72b-c4b9-3557-6348-25a8646c6995@suse.com \
    --to=jgross@suse.com \
    --cc=Waiman.Long@hp.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®