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=-6.6 required=3.0 tests=BAYES_00, 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 4D472C433DF for ; Thu, 20 Aug 2020 09:25:36 +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 23F892224D for ; Thu, 20 Aug 2020 09:25:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23F892224D Authentication-Results: mail.kernel.org; dmarc=none (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 localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k8gou-0005oV-1e; Thu, 20 Aug 2020 09:25:16 +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 1k8gos-0005oQ-RL for xen-devel@lists.xenproject.org; Thu, 20 Aug 2020 09:25:14 +0000 X-Inumbo-ID: bffea2b1-1489-4626-81d3-b75ed5fbf969 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bffea2b1-1489-4626-81d3-b75ed5fbf969; Thu, 20 Aug 2020 09:25:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CC4AEAC7D; Thu, 20 Aug 2020 09:25:39 +0000 (UTC) Subject: Re: [PATCH] xen: Introduce cmpxchg64() and guest_cmpxchg64() To: Julien Grall Cc: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , xen-devel@lists.xenproject.org, Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Andrew Cooper , Wei Liu , Oleksandr Tyshchenko References: <20200815172143.1327-1-julien@xen.org> <20200817092406.GO975@Air-de-Roger> <20200817103306.GA828@Air-de-Roger> <20200817114730.GB828@Air-de-Roger> <67e0c0f1-d85f-ad4d-d6bb-cee3603962f4@xen.org> <0fc30c51-9a7b-6421-ecdf-dbdbb76480f7@suse.com> <7f37a386-d758-ac3e-c32b-f7bb1b523f52@xen.org> From: Jan Beulich Message-ID: <7998876a-d909-6987-8edf-542798f7eee8@suse.com> Date: Thu, 20 Aug 2020 11:25:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <7f37a386-d758-ac3e-c32b-f7bb1b523f52@xen.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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 20.08.2020 11:14, Julien Grall wrote: > > > On 19/08/2020 10:22, Jan Beulich wrote: >> On 17.08.2020 15:03, Julien Grall wrote: >>> On 17/08/2020 12:50, Roger Pau Monné wrote: >>>> On Mon, Aug 17, 2020 at 12:05:54PM +0100, Julien Grall wrote: >>>>> The only way I could see to make it work would be to use the same trick as >>>>> we do for {read, write}_atomic() (see asm-arm/atomic.h). We are using union >>>>> and void pointer to prevent explicit cast. >>>> >>>> I'm mostly worried about common code having assumed that cmpxchg >>>> does also handle 64bit sized parameters, and thus failing to use >>>> cmpxchg64 when required. I assume this is not much of a deal as then >>>> the Arm 32 build would fail, so it should be fairly easy to catch >>>> those. >>> FWIW, this is not very different to the existing approach. If one would >>> use cmpxchg() with 64-bit, then it would fail to compile. >> >> A somewhat related question then: Do you really need both the >> guest_* and the non-guest variants? Limiting things to plain >> cmpxchg() would further reduce the risk of someone picking the >> wrong one without right away noticing the build issue on Arm32. >> For guest_cmpxchg{,64}() I think there's less of a risk. > > For the IOREQ code, we will need the guest_* version that is built on > top of the non-guest variant. > > I would like at least consistency between the two variants. IOW, if we > decide to use the name guest_cmpxchg64(), then I would like to use > cmpxchg64(). On Arm, that is. There wouldn't be any need to expose cmpxchg64() for use in common code, and hence not at all on x86, I guess? Jan