From mboxrd@z Thu Jan 1 00:00:00 1970 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.4 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 89B70C433E2 for ; Wed, 16 Sep 2020 09:07:37 +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 3345B2087D for ; Wed, 16 Sep 2020 09:07:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b="gle4Mvk/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3345B2087D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kITPQ-0004a8-K7; Wed, 16 Sep 2020 09:07:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kITPP-0004a3-Co for xen-devel@lists.xenproject.org; Wed, 16 Sep 2020 09:07:23 +0000 X-Inumbo-ID: 36b8aa6e-77af-4e8f-93ab-19b751a9e633 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 36b8aa6e-77af-4e8f-93ab-19b751a9e633; Wed, 16 Sep 2020 09:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=5YX9UtN+XRhEjWtiem57UOjMErkg7d2BctOR2pW3s+Y=; b=gle4Mvk/7quJphKeE/J/GVbE+R hIH16EhkURYv7ZEUvBcH2wliZfLA4sO1nfrW8/PEBnGLypmYNi6q62JEXAMPy46d6U+X+Z30XSp0O B05eFPl6vaRpwhKKkpz4o6BCDEXcmFSK3L/OaT2BkPUeRuO8roG5HrIhqrL2gBzE3g0o=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kITPM-0001RS-QW; Wed, 16 Sep 2020 09:07:20 +0000 Received: from [54.239.6.188] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kITPM-0002jY-Gd; Wed, 16 Sep 2020 09:07:20 +0000 Subject: Re: [PATCH V1 14/16] xen/ioreq: Use guest_cmpxchg64() instead of cmpxchg() To: Jan Beulich , Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org, Oleksandr Tyshchenko , Paul Durrant , Stefano Stabellini , Julien Grall References: <1599769330-17656-1-git-send-email-olekstysh@gmail.com> <1599769330-17656-15-git-send-email-olekstysh@gmail.com> <44b19ee1-dc34-3a46-0b4b-7196faadcb5c@suse.com> From: Julien Grall Message-ID: Date: Wed, 16 Sep 2020 10:07:18 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <44b19ee1-dc34-3a46-0b4b-7196faadcb5c@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 16/09/2020 10:04, Jan Beulich wrote: > On 10.09.2020 22:22, Oleksandr Tyshchenko wrote: >> @@ -1325,7 +1327,7 @@ static int hvm_send_buffered_ioreq(struct hvm_ioreq_server *s, ioreq_t *p) >> >> new.read_pointer = old.read_pointer - n * IOREQ_BUFFER_SLOT_NUM; >> new.write_pointer = old.write_pointer - n * IOREQ_BUFFER_SLOT_NUM; >> - cmpxchg(&pg->ptrs.full, old.full, new.full); >> + guest_cmpxchg64(d, &pg->ptrs.full, old.full, new.full); > > But the memory we're updating is shared with s->emulator, not with d, > if I'm not mistaken. It is unfortunately shared with both s->emulator and d when using the legacy interface. For Arm, there is no plan to support the legacy interface, so we should s->emulator and we should be fully protected. Cheers, -- Julien Grall