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=-5.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 68708C2D0A8 for ; Wed, 30 Sep 2020 06:26: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 1B2952075A for ; Wed, 30 Sep 2020 06:26:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="m0ON7+O0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B2952075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none 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.431.1301 (Exim 4.92) (envelope-from ) id 1kNVZ1-0007U4-6S; Wed, 30 Sep 2020 06:26:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 431.1301; Wed, 30 Sep 2020 06:26:07 +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 1kNVZ1-0007Tx-2f; Wed, 30 Sep 2020 06:26:07 +0000 Received: by outflank-mailman (input) for mailman id 431; Wed, 30 Sep 2020 06:26:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNVYz-0007TQ-JP for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 06:26:05 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ec6f1e47-8013-4089-8f09-6d66f70f17de; Wed, 30 Sep 2020 06:26:05 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3D1F9B163; Wed, 30 Sep 2020 06:26:04 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNVYz-0007TQ-JP for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 06:26:05 +0000 X-Inumbo-ID: ec6f1e47-8013-4089-8f09-6d66f70f17de Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ec6f1e47-8013-4089-8f09-6d66f70f17de; Wed, 30 Sep 2020 06:26:05 +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=1601447164; h=from:from:reply-to:subject:subject: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=8iVKlrraCKO0fSyoRY7g721MHT9d02MylafBD5K4sYI=; b=m0ON7+O0sCLaOepQ/wuz+f4+V5ei0u8ryHVFDtta4rdHAiI5kzOoFThsvQ7IZUthedTV6z VX8kZjMF/iN2E3oG0RVKVETzJ71YkuPtgkP6zdIZSyiIB2f8tki1T3Akjd7BlaqGa7zV82 QyRuEwaqhensXLQGVDF0wutvowKazVs= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3D1F9B163; Wed, 30 Sep 2020 06:26:04 +0000 (UTC) Subject: Re: [PATCH 11/12] evtchn: convert vIRQ lock to an r/w one To: Julien Grall Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , George Dunlap , Ian Jackson , Wei Liu , Stefano Stabellini References: <0d5ffc89-4b04-3e06-e950-f0cb171c7419@suse.com> <6e529147-2a76-bc28-ac16-21fc9a2c8f03@suse.com> <56faf769-d305-22d3-c3fe-2f9d767f0f07@xen.org> <60490a6c-593b-7aed-5e83-b0418500eed2@suse.com> From: Jan Beulich Message-ID: <03d30b08-c0ce-0d24-444d-ec20f3528039@suse.com> Date: Wed, 30 Sep 2020 08:26:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 29.09.2020 19:18, Julien Grall wrote: > On 29/09/2020 14:37, Jan Beulich wrote: >> On 29.09.2020 15:03, Julien Grall wrote: >>> I am thinking that it may be easier to hold the write lock when doing >>> the update. >> >> ... perhaps this is indeed better. I have to admit that I never >> fully understood the benefit of using spin_barrier() in this code >> (as opposed to the use in evtchn_destroy()). > > I am not entirely sure either. It looks like it is an attempt to make > v->virq_to_evtchn[X] visible without holding a lock. > > Any holder of the lock after spin_barrier() has completed will read 0 > and not try to use the lock. I'm not sure I follow: A holder of the lock is obviously already making use of the lock. Or are you talking of two different locks here (recall that before XSA-343 there was just one lock involved in sending)? > But the update of v->virq_to_evtchn[X] should have used either > ACCESS_ONCE() or write_atomic(). Of course, like in so many other places in the code base. Jan