All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Paul Durrant <paul@xen.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
Date: Fri, 25 Nov 2022 09:43:59 +0100	[thread overview]
Message-ID: <516fb872-bc79-ad8a-233b-b821265c1911@suse.com> (raw)
In-Reply-To: <Y3+JwEtSHTRhngN1@Air-de-Roger>

On 24.11.2022 16:12, Roger Pau Monné wrote:
> On Thu, Nov 24, 2022 at 12:16:13PM +0100, Jan Beulich wrote:
>> On 24.11.2022 10:33, Roger Pau Monné wrote:
>>> On Thu, Nov 24, 2022 at 10:11:05AM +0100, Jan Beulich wrote:
>>>> On 24.11.2022 10:06, Roger Pau Monné wrote:
>>>>> On Thu, Nov 24, 2022 at 09:42:40AM +0100, Roger Pau Monné wrote:
>>>>>> On Thu, Nov 24, 2022 at 08:59:00AM +0100, Jan Beulich wrote:
>>>>>>> - problematic wrt evtchn_upcall_pending, once set, preventing event
>>>>>>>   injection later on.
>>>>>>> As you may have inferred already, I'm inclined to suggest to drop the
>>>>>>> the is_vcpu_online() check from hvm_set_callback_via().
>>>>>>>
>>>>>>> One related question here is whether vlapic_do_init() shouldn't have
>>>>>>> the non-architectural side effect of clearing evtchn_upcall_pending.
>>>>>>> While this again violates the principle of the hypervisor only ever
>>>>>>> setting that bit, it would deal with the risk of no further event
>>>>>>> injection once the flag is set, considering that vlapic_do_init()
>>>>>>> clears IRR (and ISR).
>>>>>>
>>>>>> That would seem sensible to me, and was kind of what I was suggesting
>>>>>> in:
>>>>>>
>>>>>> https://lore.kernel.org/xen-devel/Y3eO0bMKRPYJc2yQ@Air-de-Roger/
>>>>>
>>>>> Another option would be for vcpu_mark_events_pending() to
>>>>> unconditionally call hvm_assert_evtchn_irq() regardless of the state
>>>>> of evtchn_upcall_pending.
>>>>
>>>> I think you said so before, and ...
>>>>
>>>>>  This will create some spurious events.
>>>>
>>>> ... I continue to be afraid of s/some/many/.
>>>
>>> Not _that_ many I think, as we can only queue one pending interrupt in
>>> IRR.
>>
>> We need to be careful here - the kernel treating it as "edge" (like
>> any other interrupt coming directly from the LAPIC), it ack-s it
>> before calling the handler, i.e. before evtchn_upcall_pending would
>> have a chance to be cleared. See Linux'es sysvec_xen_hvm_callback().
> 
> Hm, that's not how I handle it on FreeBSD, where the vector is acked
> after calling the handler (evtchn_upcall_pending gets cleared before
> the EOI).  Maybe there's some corner case I'm missing that requires
> the EOI to be performed before clearing evtchn_upcall_pending?

I think for the purpose of the one vector doing the EOI late is okay,
but aiui the goal of doing it early for edge triggered interrupts in
general (and yet more generally as early as possible) is to unmask
lower priority vectors as well. Of course that's useful only if IRQs
as a whole are unmasked during (part of) the handling.

Jan


  reply	other threads:[~2022-11-25  8:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 10:31 [PATCH] x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled Jan Beulich
2022-11-18 12:31 ` Juergen Gross
2022-11-18 12:33 ` Andrew Cooper
2022-11-18 12:51   ` Roger Pau Monné
2022-11-18 12:54   ` Jan Beulich
2022-11-18 13:55     ` Roger Pau Monné
2022-11-18 13:58       ` Jan Beulich
2022-11-18 14:09         ` Roger Pau Monné
2022-11-18 14:27     ` Andrew Cooper
2022-11-21  8:56       ` Jan Beulich
2022-11-21 12:23         ` Andrew Cooper
2022-11-21 12:34           ` Jan Beulich
2022-11-23 12:03             ` Roger Pau Monné
2022-11-24  7:59               ` Jan Beulich
2022-11-24  8:42                 ` Roger Pau Monné
2022-11-24  9:06                   ` Roger Pau Monné
2022-11-24  9:11                     ` Jan Beulich
2022-11-24  9:33                       ` Roger Pau Monné
2022-11-24 11:16                         ` Jan Beulich
2022-11-24 15:12                           ` Roger Pau Monné
2022-11-25  8:43                             ` Jan Beulich [this message]
2022-11-25  9:00                               ` Roger Pau Monné
2022-11-25  9:09                                 ` Jan Beulich
2022-11-24  9:06                   ` Jan Beulich
2022-12-05 13:44           ` Jan Beulich
2022-11-18 14:26 ` Roger Pau Monné
2022-11-21  8:33   ` Jan Beulich
2022-11-21 10:53     ` Roger Pau Monné
2022-11-21 11:14       ` Jan Beulich
2022-11-21 12:06     ` 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=516fb872-bc79-ad8a-233b-b821265c1911@suse.com \
    --to=jbeulich@suse.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=paul@xen.org \
    --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 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.