xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Juergen Gross <jgross@suse.com>, xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Jan Beulich <jbeulich@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v8 3/3] xen/events: do some cleanups in evtchn_fifo_set_pending()
Date: Fri, 27 Nov 2020 14:23:00 +0000	[thread overview]
Message-ID: <0ab6f8b5-1a9a-845e-3935-a660e5c7fc16@xen.org> (raw)
In-Reply-To: <20201125105122.3650-4-jgross@suse.com>



On 25/11/2020 10:51, Juergen Gross wrote:
> evtchn_fifo_set_pending() can be simplified a little bit.

The commit message is quite light... For posterity, it would be good to 
explain why the simplication can be done. In particular, there is a 
chance in behavior after this patch.

> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V8:
> - new patch
> ---
>   xen/common/event_fifo.c | 34 +++++++++++++++-------------------
>   1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
> index 443593c3b3..77609539b1 100644
> --- a/xen/common/event_fifo.c
> +++ b/xen/common/event_fifo.c
> @@ -175,6 +175,18 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
>           return;
>       }
>   
> +    /*
> +     * Control block not mapped.  The guest must not unmask an
> +     * event until the control block is initialized, so we can
> +     * just drop the event.
> +     */
> +    if ( unlikely(!v->evtchn_fifo->control_block) )

Sort of unrelated, AFAICT, v->evtchn_fifo->control_block can be set 
concurrently to this access.

Thankfully, once the control block is mapped, it can't be unmapped. 
However, there is still a possibility that you may see half of the update.

Shouldn't the field access with ACCESS_ONCE()?

Cheers,

-- 
Julien Grall


  parent reply	other threads:[~2020-11-27 14:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 10:51 [PATCH v8 0/3] xen/events: further locking adjustments Juergen Gross
2020-11-25 10:51 ` [PATCH v8 1/3] xen/events: modify struct evtchn layout Juergen Gross
2020-11-27 11:42   ` Jan Beulich
2020-11-27 11:57     ` Julien Grall
2020-11-27 12:41       ` Jan Beulich
2020-11-25 10:51 ` [PATCH v8 2/3] xen/events: rework fifo queue locking Juergen Gross
2020-11-27 13:11   ` Jan Beulich
2020-11-27 13:31     ` Jürgen Groß
2020-11-27 13:58   ` Julien Grall
2020-11-27 14:03     ` Jan Beulich
2020-11-27 14:05     ` Jürgen Groß
2020-11-27 14:11       ` Julien Grall
2020-11-27 14:14         ` Jürgen Groß
2020-11-27 14:26           ` Julien Grall
2020-11-25 10:51 ` [PATCH v8 3/3] xen/events: do some cleanups in evtchn_fifo_set_pending() Juergen Gross
2020-11-27 13:27   ` Jan Beulich
2020-11-27 13:52     ` Jürgen Groß
2020-11-27 14:23   ` Julien Grall [this message]
2020-11-27 14:39     ` Jürgen Groß
2020-11-27 14:48       ` Jan Beulich
2020-11-27 15:17         ` Julien Grall
2020-11-27 15:36           ` Jan Beulich
2020-11-27 14:50       ` Julien Grall

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=0ab6f8b5-1a9a-845e-3935-a660e5c7fc16@xen.org \
    --to=julien@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=sstabellini@kernel.org \
    --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).