Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1401801pxb; Wed, 2 Feb 2022 04:17:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzad/jrQOVKjGDb/tpRuBRNt6Rcrfy18rsDQrqIYxGWmuHqjmTjGnzs8/8QjQQ7jmv0nlu8 X-Received: by 2002:a17:90b:33ca:: with SMTP id lk10mr7743677pjb.108.1643804226677; Wed, 02 Feb 2022 04:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643804226; cv=none; d=google.com; s=arc-20160816; b=n40dEgrZf6CdmitTNBqMAyAu9NjSoi6RFhdOsEF7I6eZBORzsqBFHaqpst/fjHqMQv X//Mc8VCZ89t/2zsJeIzL/Va7QciTQ8T6MlFpkNajHgYPrhU0cRssW+vIPYLDjtYmnN0 wUqhux8GbnwK1AxIHOqBYu9DPDx5p7k0NcE9IhoSg3zAjjZ4gqXcpLj6n9E2Mvf/8Hff OM/hPAT9918NIhh67Kezy39K04SryMvQUBz6qpxyzF18c5lnYriX0DrLV0HDfbevJeMN o29qzb+1uopf7LmFeP9DDGizaiwo3gieMg5HV7CnSJZlokbNAhPrN62PXquZ3R9Y9BEs LPWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/K6CrouqNGPSnRyT1f52nHMQEEea+SOxraNSciufZcQ=; b=NthJGX+dcIulF6BzYgZxrf16ObKRHfY6Kew7n6pqBAg6ZrZrAQ9+hSaEe0LZlNpHXR 0Vf9vcWzq99vXcAsepNCyc0s3e+jh3VKoKr8LgPT+QXP9wh3yDS/X5oTXzlNDstU8wt+ uZk+WcgRaHRrlbLZ8sgx7+nMoHJfTaL5TuiVsPrTCHIAoQvoCNzx0NiaiAEjofh3WYwM ULEx3Pk4ccElDqwlWCkx8Ra8u2pyBZOe9Ojq6wtKyuk+4VwwiQU8kJUJsY86ZoVzrMQu 1m+o7k+3a+XBTHE+yGIgpuoUEkpdsqfcn5M9nZKUGD064V+Lx1lDVs7r8yjNFTc6sUkE lS9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L9q2Ipei; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19si20257604pgk.203.2022.02.02.04.16.54; Wed, 02 Feb 2022 04:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L9q2Ipei; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiBAU41 (ORCPT + 99 others); Tue, 1 Feb 2022 15:56:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiBAU4Z (ORCPT ); Tue, 1 Feb 2022 15:56:25 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83386C06173B for ; Tue, 1 Feb 2022 12:56:25 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id f8so16478187pgf.8 for ; Tue, 01 Feb 2022 12:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/K6CrouqNGPSnRyT1f52nHMQEEea+SOxraNSciufZcQ=; b=L9q2IpeiXJQDBJSV9DS3cKiVk1tVp+zkdvqw3ehFZvdheg7PcUbCDRZBPhIyk71rtV LgksLrzm4pydIz/Fseu/imUdzljxVgvdkVfj82Sd3r8xv9COxCiJMoq2nxn6rzvnFHMd wZkiY6iCrOzr5vI0m78Qg7BCkNUD5fLKTPIfj031sIfzRYhme9BtS5u2ayojPEdik5p8 txNvz8+inM0BOrE+lPfj1KMaB+GyyEPRiWeG8U/s3FvZwG/3HYBgr0cgx4oqFS2/NfmI vQMD3QDSzXIxHEA/TP9jLwIYHFQaaDCKnZHqrqpRVaKpaNAcIUxDdvI5w2Mtwb+EmGDM 6ykA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/K6CrouqNGPSnRyT1f52nHMQEEea+SOxraNSciufZcQ=; b=ICbMaVXVG59dg5NgLbewsHCaT7oMA4cuzJXnQ/Gwh5lkt03hv9+VV3ZShBKadWu3aE L2RziDa1LBR1SPYKz91K4+6zyy3s6tRpo0M9IgVPpm5TCGfUFZR1uXILE9jV3uP0wLgX 1mYxHos1RyY7eNgaZGvrWg+XJAIOloZuQIGmt8C5skqMZ4p6y2wQ/OEn5ZHPRSpW/T1V sgc4BXn2pnD2jw8CqjduoBj36Sx8Go7Xd/w3W21/st6jIjohxWPZgXT7Tx57jV6cOgEh Vpo1bmw7U6dQT2iywhmiWHJYqwxZp5sobDgU82fpe7d5gNB1ToaWs/KSP15TE7fwB51X JOMw== X-Gm-Message-State: AOAM532qTfrXmpVp9EvLOzflEq0VFso3mhRBSZSQQyG+sV9slx5ShHl9 O+UMNXArsWsEy1quG0+Wn8H3Zw== X-Received: by 2002:a63:ed10:: with SMTP id d16mr21961918pgi.17.1643748984764; Tue, 01 Feb 2022 12:56:24 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u19sm23445170pfi.150.2022.02.01.12.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 12:56:24 -0800 (PST) Date: Tue, 1 Feb 2022 20:56:20 +0000 From: Sean Christopherson To: Nick Desaulniers Cc: Paolo Bonzini , Nathan Chancellor , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Peter Zijlstra , syzbot+6cde2282daa792c49ab8@syzkaller.appspotmail.com Subject: Re: [PATCH 1/5] Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug Message-ID: References: <20220201010838.1494405-1-seanjc@google.com> <20220201010838.1494405-2-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 01, 2022, Nick Desaulniers wrote: > On Mon, Jan 31, 2022 at 5:08 PM Sean Christopherson wrote: > > > > Add a config option to guard (future) usage of asm_volatile_goto() that > > includes "tied outputs", i.e. "+" constraints that specify both an input > > and output parameter. clang-13 has a bug[1] that causes compilation of > > such inline asm to fail, and KVM wants to use a "+m" constraint to > > implement a uaccess form of CMPXCHG[2]. E.g. the test code fails with > > > > :1:29: error: invalid operand in inline asm: '.long (${1:l}) - .' > > int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; } > > ^ > > :1:29: error: unknown token in expression > > :1:9: note: instantiated into assembly here > > .long () - . > > ^ > > 2 errors generated. > > > > on clang-13, but passes on gcc (with appropriate asm goto support). The > > bug is fixed in clang-14, but won't be backported to clang-13 as the > > changes are too invasive/risky. > > LGTM. > Reviewed-by: Nick Desaulniers > > If you're going to respin the series, consider adding a comment in the > source along the lines of: > ``` > clang-14 and gcc-11 fixed this. > ``` > or w/e. This helps us find (via grep) and remove cruft when the > minimum supported compiler versions are updated. Will do, a new version is definitely needed. > Note: gcc-10 had a bug with the symbolic references to labels when > using tied constraints. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98096 > > Both compilers had bugs here, and it may be worth mentioning that in > the commit message. Is this wording accurate? gcc also had a similar bug[3], fixed in gcc-11, where gcc failed to account for its behavior of assigning two numbers to tied outputs (one for input, one for output) when evaluating symbolic references.