Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7735277rwb; Tue, 6 Dec 2022 09:11:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf4QZ2Z9ToZfPv9gSuLRyz6KaI0AngpPTROWMWB5cI2mLpbWcUMeswePy0DiY1P0fPmQ5WDE X-Received: by 2002:a17:906:5a0c:b0:7c0:faca:4d5e with SMTP id mx12-20020a1709065a0c00b007c0faca4d5emr6564061ejc.140.1670346718889; Tue, 06 Dec 2022 09:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670346718; cv=none; d=google.com; s=arc-20160816; b=GSYQdBU/KpII/UhQ3/ypKdaZuyj281utigbYmy4I1Qe9GpTRBykkkJ7X61o8C9R1AM xeKyQUY/ZqiTSysoxoiIGxbonEGBLMbH25Nb9npQRaQ7gnMdInUwLNUOor/MgVY5HwK1 nZNUVkp0mWQhqXzmjOv7VMkol/Jr5mqBiS/2iHhx4lmRDuFMnPTp7qPBffBs+D3Aj6rA 3+T9sQa7gJtVB2D1c76B5Xtryi5eSt+KLmFgxem7z6HLRs/TRzLU7h+KqiheeJcfhLWq YSooFEC7IqoYNRXkWuMsNYNOX4dx8WatzLdBOgwYbGMj2qobOLUmk32RhCAJn0VazxeT 1+LQ== 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=ov+WjnBNqjWs1af+hraj4YEzPtdcPglGlTeqAHbyJPo=; b=pIad2xpQWrD2rhoslOJT8unx//v17yQ5EfzZC4dQWydRhhdpKOJdtd2qdNRu3UVa9X v/gkMyE/DJYuuAsQCQQeessjW+zqoETFbDZ6p/xTFWV2RwqIo7hBHtUqgBajJ2ZPgB1G 1PeJKs+O0La6JNntAnzrBBwNa41MRwYFVEKN5qbCf36XwfYij4d9DjxrDKHMdndt6+aQ xm3iT15+7+dkAG3sRObRt+fzt5DCkiurOS3ndbWLNjRr21sRj7NYG+qIf3DF36aUhB9M AhZhCLGs6wSkouCTupBnqytGjhJ3A0lF5o/ByqxXq/k7WBcA5q/4cWl6Z7NYuzEsbY6r lyjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=FHOo4H2D; 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 gn25-20020a1709070d1900b007c10d4cc297si1692172ejc.85.2022.12.06.09.11.40; Tue, 06 Dec 2022 09:11:58 -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=FHOo4H2D; 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 S235171AbiLFRIT (ORCPT + 77 others); Tue, 6 Dec 2022 12:08:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234387AbiLFRIE (ORCPT ); Tue, 6 Dec 2022 12:08:04 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 874B817E1E for ; Tue, 6 Dec 2022 09:08:03 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso18657108pjt.0 for ; Tue, 06 Dec 2022 09:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ov+WjnBNqjWs1af+hraj4YEzPtdcPglGlTeqAHbyJPo=; b=FHOo4H2DwPVm0CqEEA/q06AKzsUcuFmns83OwxgFGIlQelD4uW5LjTsSKxm0wDywSo CQLr7zoLiDaNDQqazIfwY0Y88qaUB3U9q+7hJQhgzGf+vTlbHUjOA53/5mmCLsvR5DFE CCg6uJg8vLWc65bLwJCwfbpJsQAjqbA69DON+HB5v/hGkMTFeFr7P0SsN2T9NbD1rt3A IQ12K15mbR5Ky+YEA4ynHwL/+b7LeHLPZR8rpGHMWFmABulKYekzfC8d1Yduo3GqmLHm PfEMqWu43iwjJe0PDy2epKU1ZPFRX2nclunN0Ae8b9SuFP6XROxonn9ANoLhBSZMEy/B wS7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ov+WjnBNqjWs1af+hraj4YEzPtdcPglGlTeqAHbyJPo=; b=uYTlngEiZvhTnRfinSu+V7p/4IHfFNPjFLlpF88U3zqHKo4lTd0WHh+Ru/qqwEZjoL cPmooLdA3Q327DJElq5L1Tu5JdG6ErN3h7DX4/df/wSQ/P5k+j+JhUa6MqhYclN3eDYy OlQpu8+8HxdDJkuGx9t6FzHrGpFPLRY4YceUlAG8rFL7khoxHPkfSne+CC25zQGssK1E 6Cp6GSQxB/FypIx1SGf+S6L7BUXAtP+KmGjSgH13fR0cQskDoCMbWJM5foQd2OZeoMen bciiRbuR+3Jqb0sIEr7LwoxnEmb9MnJzYUFqL7cDidmMMVAGiJ7AA7sPwUI+CEwYOopL ZSXQ== X-Gm-Message-State: ANoB5pnL7zPA0n0YTYONNoIjd7XU2pNBbgTyfG+fKAUlP2Zt0sjkh8HP NzamZt7o3L9YclG39ooxtEDNhQ== X-Received: by 2002:a17:902:c1ca:b0:189:e149:a1b2 with SMTP id c10-20020a170902c1ca00b00189e149a1b2mr7524064plc.17.1670346482909; Tue, 06 Dec 2022 09:08:02 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id p3-20020a1709026b8300b001898ee9f723sm12908572plk.2.2022.12.06.09.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 09:08:02 -0800 (PST) Date: Tue, 6 Dec 2022 17:07:58 +0000 From: Sean Christopherson To: Alexey Kardashevskiy Cc: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Venu Busireddy , Tony Luck , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Michael Sterritt , Michael Roth , Mario Limonciello , Ingo Molnar , Heiko Carstens , Greg Kroah-Hartman , Dave Hansen , Borislav Petkov , Andrew Cooper , "Jason A. Donenfeld" , "H. Peter Anvin" Subject: Re: [PATCH kernel 1/3] x86/amd/dr_addr_mask: Cache values in percpu variables Message-ID: References: <20221201021948.9259-1-aik@amd.com> <20221201021948.9259-2-aik@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 06, 2022, Alexey Kardashevskiy wrote: > > On 2/12/22 03:58, Sean Christopherson wrote: > > On Thu, Dec 01, 2022, Alexey Kardashevskiy wrote: > > > diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h > > > index cfdf307ddc01..c4324d0205b5 100644 > > > --- a/arch/x86/include/asm/debugreg.h > > > +++ b/arch/x86/include/asm/debugreg.h > > > @@ -127,6 +127,7 @@ static __always_inline void local_db_restore(unsigned long dr7) > > > #ifdef CONFIG_CPU_SUP_AMD > > > extern void set_dr_addr_mask(unsigned long mask, int dr); > > > +extern unsigned long get_dr_addr_mask(int dr); > > > #else > > > static inline void set_dr_addr_mask(unsigned long mask, int dr) { } > > > > KVM_AMD doesn't depend on CPU_SUP_AMD, i.e. this needs a stub. Or we need to add > > a dependency. > > The new symbol is under CONFIG_CPU_SUP_AMD and so is its only user > arch/x86/kernel/cpu/amd.c: > > arch/x86/kernel/cpu/Makefile: > obj-$(CONFIG_CPU_SUP_AMD) += amd.o > > > Is this enough dependency or we need something else? (if enough, I'll put it > into the next commit log). No, it's actually the opposite, the issue is precisely that the symbol is buried under CPU_SUP_AMD. KVM_AMD doesn't currently depend on CPU_SUP_AMD, and so the usage in sev_es_prepare_switch_to_guest() fails to compile if CPU_SUP_AMD=n and KVM_AMD={Y,M}. config KVM_AMD tristate "KVM for AMD processors support" depends on KVM I actually just submitted a patch[*] to "fix" that since KVM requires the CPU vendor to be AMD or Hygon at runtime. Although that patch is buried in the middle of a large series, it doesn't have any dependencies. So, if this series is routed through the KVM tree, it should be straightforward to just pull that patch into this series, and whichever series lands first gets the honor of applying that patch. If this series is routed through the tip tree, the best option may be to just add a stub to avoid potential conflicts, and then we can rip the stub out later. [*] https://lore.kernel.org/all/20221201232655.290720-12-seanjc@google.com