Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4524785pxu; Mon, 21 Dec 2020 15:07:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNukOxZH3FLHB8Q+Cc4l3xW+kuknzNyiCLFyVDuGUCsZZdxAx8vVqFK/q+aNveD7oBXLiB X-Received: by 2002:aa7:c253:: with SMTP id y19mr17669662edo.179.1608592029881; Mon, 21 Dec 2020 15:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608592029; cv=none; d=google.com; s=arc-20160816; b=XFPfuXdOuwm4BbMAD8tlZIteizCzs6HAGVrOoKZblL5VuIl0GEGT3igJ/JtKA7UT0z xNWLrzeOK4oQUxVeEbLGEZwx10iJhjPfUoVejJiGkS+zKh2472Thr33K/BKFeCtlDW1c GtmEdd/4IEr+Q7iWV7GvWF+FKBJFXgrIY/PzcGp9KTXmWjp/5/e5FS99Iy5nft0SlvAc hH+7+IjbaKeBOIKHvJ9dXgJpQr+OHAez+RJtPLIthvh3z2uDYyZNCcQo03nLMTGUOlA+ 6aZFxNq3MUa/3bfgaZDe5DTFHR7ckZicwFGBstJWxxzTjvqB0MF0PZZuOzBc8TDaUcCY E7GA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LeoeYnCQ4DjHLLXlMxxQJshzAfmMhw5UEdcS2SRtSy4=; b=IzSOut1XS0eADT2M9hFUqTcChdOuZLULAXpRJITkrCI+I0RE3659k74H9a/mRAMzOu acc7PfLGg4OB0wWh3n6KFZpfWYfbukn9Ks0KllWdr8A3x6YWa3WEX5pdn+zcoVpbkKzK FPigfeknzRMPOcuMVbpo9Cov4IzZlZNoMbUCCXRRCtIlJ4MYDopLlu7ZTqjzwGOPlKZf eaVtTSw2lVCW95H85nYa/KkJgGLaCAvJm15Zu37D7rkJXNIplBR3XehL9Pl+Rg2ZBAzj sWWrfLUZ+dY1qiy5rgCoR+IzjR5nKsIf9Iw0xLntvd6U2FC+61cC3pc+FJy1NOFO3mI0 50OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ftr369q9; 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 lt15si9673008ejb.499.2020.12.21.15.06.46; Mon, 21 Dec 2020 15:07:09 -0800 (PST) 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=Ftr369q9; 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 S1726016AbgLUXF7 (ORCPT + 99 others); Mon, 21 Dec 2020 18:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgLUXF6 (ORCPT ); Mon, 21 Dec 2020 18:05:58 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D5BEC0613D3 for ; Mon, 21 Dec 2020 15:05:16 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id j1so6422280pld.3 for ; Mon, 21 Dec 2020 15:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=LeoeYnCQ4DjHLLXlMxxQJshzAfmMhw5UEdcS2SRtSy4=; b=Ftr369q9NwaPNhLcUHiuHQkp7Le7NZyiC2K8bG8lqMkcSxIRbREQK8cxCw70jEIuk8 fpp3rw8vRTQdVoVnGfKISRtuIiESfmbNppyrNt8ynyBTm/fFNSZWNe9NKKFHw73j2EOi MciYSOFxYWYGeua+iAl+sW7GAK8JrXbknG6J5fSWd/+uKj4puUY2R/kqJLt5B7gat645 mFkkWbw+S99Am+DWBg9bzDUErbsm1cfqhI3LHqFmbGfFfpBgiYecSmBxz9y9acucMYSW kC9nVAF30TWUs4Z64IX6kLG10PsWpyV8VfQsp48dJmOXPKl2O54EjArdzjDyf6ZTztJJ Nl9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=LeoeYnCQ4DjHLLXlMxxQJshzAfmMhw5UEdcS2SRtSy4=; b=JJR+40tgwVHhn/PczdCB5Tq6lvxt6/1XX0cRKHMmX7PWa7qqMryt5fGecBfgryRa6t r2Mdkh0PCl/jxuUL8jcAKhet0F63sWn/NEIEf89GgiamIumoesw0p93BcrC9dI09PsRB 5hzEAUh7tlGx2tXrjsbCbuCVtsbwqNiYzS7fhLlamao/AErAw5Ro8UBpJOPXyAXd1iUk 7zU1C02QbWE85mu8p/OrFOLE1A+WLWYXgOeZqEFcZwusOBhGsl8kW7gjhW3UWOHONLho CAV2HsMKAtTL/1AXYhIDXsTlYKmkMPjjIza4rPn68dCLR3K30+/Cxkf5s3TCqiRRPkQu WDBQ== X-Gm-Message-State: AOAM531mJCDnMloD8h9b7ooAW2poK04XC3sodx/hNqj0MNMrU6oa/Bbw OkWhN0sOWpOBhfZJjHqo9BzQJg== X-Received: by 2002:a17:902:9b91:b029:db:f003:c5eb with SMTP id y17-20020a1709029b91b02900dbf003c5ebmr18176770plp.1.1608591915873; Mon, 21 Dec 2020 15:05:15 -0800 (PST) Received: from google.com ([2620:15c:f:10:1ea0:b8ff:fe73:50f5]) by smtp.gmail.com with ESMTPSA id w27sm14034183pfq.104.2020.12.21.15.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 15:05:15 -0800 (PST) Date: Mon, 21 Dec 2020 15:05:08 -0800 From: Sean Christopherson To: Krish Sadhukhan Cc: Uros Bizjak , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini Subject: Re: [PATCH v3] KVM/x86: Move definition of __ex to x86.h Message-ID: References: <20201221194800.46962-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 21, 2020, Krish Sadhukhan wrote: > > On 12/21/20 11:48 AM, Uros Bizjak wrote: > > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h > > index c5ee0f5ce0f1..5b16d2b5c3bc 100644 > > --- a/arch/x86/kvm/x86.h > > +++ b/arch/x86/kvm/x86.h > > @@ -8,6 +8,30 @@ > > #include "kvm_cache_regs.h" > > #include "kvm_emulate.h" > > +asmlinkage void kvm_spurious_fault(void); > > + > > +/* > > + * Handle a fault on a hardware virtualization (VMX or SVM) instruction. > > + * > > + * Hardware virtualization extension instructions may fault if a reboot turns > > + * off virtualization while processes are running. Usually after catching the > > + * fault we just panic; during reboot instead the instruction is ignored. > > + */ > > +#define __ex(insn) \ > > > While the previous name was too elaborate, this new name is very cryptic.? > Unless we are saving for space,it's better to give a somewhat descriptive > name. We are saving for space in a way. Not so much to actually save lines of code, but to avoid stealing the focus from the code that matters. __ex() is cryptic for the completely unfamiliar, but I'm worried that anything more verbose will harm the readability of the code where it is used, which is usually what's more important in the long run. __ex() does have some meaning, as it's connected to the various ex_handler_*() helpers. ex_handle() is the best semi-verbose alternative that I can think of, but even that is too long for my liking when reading the inline asm flows. And it's not like ex_handle() tells the whole story; the reader still has to go to the definition to understand what it does, or worse, will make incorrect assumptions about how exceptions are handled. E.g. with the short version, my eyes gravitate toward vmxoff/vmsave without getting stuck on the verbose wrapper. asm volatile (__ex("vmxoff")); asm volatile(__ex("vmsave") : : "a" (__sme_page_pa(sd->save_area)) : "memory"); vs. asm volatile (ex_handle("vmxoff")); asm volatile(ex_handle("vmsave") : : "a" (__sme_page_pa(sd->save_area)) : "memory");