Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8188CC63798 for ; Fri, 27 Nov 2020 14:49:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23DC1221EB for ; Fri, 27 Nov 2020 14:49:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="bQ4OT7Gt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23DC1221EB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.39541.72466 (Exim 4.92) (envelope-from ) id 1kif3T-0001Yn-CK; Fri, 27 Nov 2020 14:48:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 39541.72466; Fri, 27 Nov 2020 14:48:59 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kif3T-0001Yg-90; Fri, 27 Nov 2020 14:48:59 +0000 Received: by outflank-mailman (input) for mailman id 39541; Fri, 27 Nov 2020 14:48:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kif3S-0001Yb-84 for xen-devel@lists.xenproject.org; Fri, 27 Nov 2020 14:48:58 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9dfb9086-fb0a-44bf-afcf-371c0ac5d62b; Fri, 27 Nov 2020 14:48:57 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6D4B6AC55; Fri, 27 Nov 2020 14:48:56 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kif3S-0001Yb-84 for xen-devel@lists.xenproject.org; Fri, 27 Nov 2020 14:48:58 +0000 X-Inumbo-ID: 9dfb9086-fb0a-44bf-afcf-371c0ac5d62b Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9dfb9086-fb0a-44bf-afcf-371c0ac5d62b; Fri, 27 Nov 2020 14:48:57 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606488536; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VmazSFssDUXD5aQuFD5sQTaVVUyogC9qfmDS3M1uctE=; b=bQ4OT7GtxBDbAIW4Mz2FOhso3gTCZxwN1nGXOpHHrM9z58OKAtHLO15q5lL8yOoX2RVu9k eivE8bFphs2n0ZyQmQ8tSWiUFLslGoFC3avCEtn+xMuI9CyeqbAsG2Xfq8Y2vJeJRM53j/ 3/wlYG3PLvJC7Wbv4vxNowC7jHWjFgE= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6D4B6AC55; Fri, 27 Nov 2020 14:48:56 +0000 (UTC) Subject: Re: [PATCH v8 3/3] xen/events: do some cleanups in evtchn_fifo_set_pending() To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , Julien Grall Cc: Andrew Cooper , George Dunlap , Ian Jackson , Stefano Stabellini , Wei Liu , xen-devel@lists.xenproject.org References: <20201125105122.3650-1-jgross@suse.com> <20201125105122.3650-4-jgross@suse.com> <0ab6f8b5-1a9a-845e-3935-a660e5c7fc16@xen.org> From: Jan Beulich Message-ID: <29c8daf7-8af4-df16-716e-113bcc3e96a1@suse.com> Date: Fri, 27 Nov 2020 15:48:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 27.11.2020 15:39, Jürgen Groß wrote: > On 27.11.20 15:23, Julien Grall wrote: >> On 25/11/2020 10:51, Juergen Gross wrote: >>> --- 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()? > > Shouldn't this be another patch? Especially as the writing side needs > the same treatment. Indeed. As said on several different occasions - our code base is full of places where we chance torn accesses, if there really was a compiler to let us down on this. This recurring pattern shouldn't lead to unrelated patches getting bloated, unless _all_ affected sites get touched anyway. Jan