Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4811278pxk; Wed, 30 Sep 2020 12:17:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybK/dRTvPjLGVwu+b3OLoete0HHucdzL+fheRP/BPP4rbKVHteglkzIcrIWepfQ9EIMfoX X-Received: by 2002:a17:906:c0c8:: with SMTP id bn8mr4294052ejb.256.1601493473082; Wed, 30 Sep 2020 12:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601493473; cv=none; d=google.com; s=arc-20160816; b=DJwxYEqCKml8N+VL4FyZNqoVk6U3e2fQew1/0ZU9tSuGXQVJGFz6CmbQwzRKAO6jwp +ExksQqJh5/ARALx7oQzcjfkpD4IVF17monwefIpVaFQU6IVvSShr1dXRVciZfGE2wzk GgjhrL76blqc3sQAG6Da/LRVAQ6jam6WFxl9eaU+QA5jTxSsWbjbw6YjdV18NMMsR+V4 RGDy0JkiJEMDf86IcDs9sJqNj+CUzSpkJlDe5Bgzd/3aSrxnFNzXP7pzrEgGyHI2sFEf Em7yQq8L8dbfF9mu4nhtFa2QKJsihg1XAIg8Pk2Tl9oqzjwfwaItbOe8JEGUivXFOcUf mmXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RtmRfZ7y8nBNZ3PA43zzzW4qh+I9/h49G6sXpmz2rpo=; b=zdIXn3C5dcexkMMyI6r4RWdiNOPTRIKq3QdtXdxwNSEs2ffjzbPv2q6y2tMonQODTu foMimfYR0GOn1xvS3ewHOtWnBZ9Zxn6KM0nDlIsLpOhOZrxR7x070MGITds30xNWRPMv kqdMlM/L2/I1c/SUeH0s3U3bfburNXockP24pw3xTZxCXcsdA5ZYqywgTylTSB2bm0zm yPFbWUpALmLoR3rtwGXoxkhSekfFrMaOx7H/uJlksUyrOJ/3QyVgMM6GMjP5h2ZdPXh6 5RqHGfHMul/TsviVPPjkrA3FHLVRzz5QYsVaJ638Yyh8xa9gyCL5tEHi7yhYjVWFh0ke 0/ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Rzcblbmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si1928755ejc.261.2020.09.30.12.17.28; Wed, 30 Sep 2020 12:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Rzcblbmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729658AbgI3TOS (ORCPT + 99 others); Wed, 30 Sep 2020 15:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbgI3TOS (ORCPT ); Wed, 30 Sep 2020 15:14:18 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B367DC061755 for ; Wed, 30 Sep 2020 12:14:16 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id s19so1596533plp.3 for ; Wed, 30 Sep 2020 12:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RtmRfZ7y8nBNZ3PA43zzzW4qh+I9/h49G6sXpmz2rpo=; b=RzcblbmwjdEDwS4nVlBSnMeYV3oucKr0Yg2oihoPc3sry29WbbBSq36f1sb4sWZbq6 ebT5bv5Ycd97yxBpVaAj3W8/6ZQVWRhO+mN7w+EBYZEx4OqARl4Q2oo0VjW/iB3YkaQ1 atFsfdBYYXsREXf2viurdW2nYQPZFfnQ74QSDlWmQQAalk0TxDprocqWEXJ2bZTLVEot BiZs14l5Q3IFITEp+T/SBynaiuj+u3RmURydSqtCiOqG3uKCOwA9oG4EBluCCBTI9WZm 9nEeh0DOMPoahkYsiNjJnntIjNbOCBnVKfQSMIGuj7u9v0CMu0EhIZr23TX/jI0kLT23 +fMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RtmRfZ7y8nBNZ3PA43zzzW4qh+I9/h49G6sXpmz2rpo=; b=FTGMv2GoA5u8+CfdC1Fz6Gr9fLlN28+lhSME+HS4XR214gx0ukjf5o+kHEBM75kBDF /eekEJWTsDtd3eMirTL2ckt52n1odl7qrfh9zKYUsFX1wyWEv9a7Hz1u2gdcwSj1ye6H iLKn/NRRDYEI6hUn2ZKN0wi0WPEiGgOdbmr/KcxCc4oVDaXNajXbb0A5rYPCU44d8cLv 16g0UCAFXzxrvJFj5GYMjvNrk4qM1wTJrP9kjwFZ/VTt+UjpwrQ/D+bNpCN18EOpZA7k ELjW1cJpSZO5lQbCeXURC5snuZkgKvrPfWrYbpCKH5eOLson4OBvPRQP6+YJGDxz3coN LDxg== X-Gm-Message-State: AOAM532tZKP40AnYS2YLOb+UDaWOPueITXqPEYs3/5JZZcQO92Nxb6yM pNtqwYbUivc+DpZlWkBD4vsGvJjI1HSIZsT4go1XTQ== X-Received: by 2002:a17:902:c151:b029:d2:42a6:2fb with SMTP id 17-20020a170902c151b02900d242a602fbmr3811478plj.10.1601493256019; Wed, 30 Sep 2020 12:14:16 -0700 (PDT) MIME-Version: 1.0 References: <20200922114311.38804-1-shuo.a.liu@intel.com> <20200922114311.38804-5-shuo.a.liu@intel.com> <20200927105152.GG88650@kroah.com> <6f9a2b83-6904-2290-6c4f-526672390beb@intel.com> <20200930111612.GZ2628@hirez.programming.kicks-ass.net> <20200930161036.GY28786@gate.crashing.org> <20200930171346.GC2628@hirez.programming.kicks-ass.net> In-Reply-To: <20200930171346.GC2628@hirez.programming.kicks-ass.net> From: Nick Desaulniers Date: Wed, 30 Sep 2020 12:14:03 -0700 Message-ID: Subject: Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces To: Peter Zijlstra Cc: Segher Boessenkool , Dave Hansen , Greg Kroah-Hartman , shuo.a.liu@intel.com, LKML , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sean Christopherson , Yu Wang , Reinette Chatre , Yakui Zhao , Dan Williams , Fengwei Yin , Zhi Wang , Zhenyu Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > Since this variable is a local register asm, on entry to the asm the > > compiler guarantees that the value lives in the assigned register (the > > "r8" hardware register in this case). This all works completely fine. > > This is the only guaranteed behaviour for local register asm (well, > > together with analogous behaviour for outputs). > > Right, that's what they're trying to achieve. The hypervisor calling > convention needs that variable in %r8 (which is somewhat unfortunate). > > AFAIK this is the first such use in the kernel, but at least the gcc-4.9 > (our oldest supported version) claims to support this. > > So now we need to know if clang will actually do this too.. Does clang support register local storage? Let's use godbolt.org to find out: https://godbolt.org/z/YM45W5 Looks like yes. You can even check different GCC versions via the dropdown in the top right. The -ffixed-* flags are less well supported in Clang; they need to be reimplemented on a per-backend basis. aarch64 is relatively well supported, but other arches not so much IME. Do we need register local storage here? static inline long bar(unsigned long hcall_id) { long result; asm volatile("movl %1, %%r8d\n\t" "vmcall\n\t" : "=a" (result) : "ir" (hcall_id) : ); return result; } -- Thanks, ~Nick Desaulniers