From: Alexey Kardashevskiy <aik@amd.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org,
Venu Busireddy <venu.busireddy@oracle.com>,
Tony Luck <tony.luck@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Michael Sterritt <sterritt@google.com>,
Michael Roth <michael.roth@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Ingo Molnar <mingo@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Borislav Petkov <bp@alien8.de>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH kernel 1/3] x86/amd/dr_addr_mask: Cache values in percpu variables
Date: Wed, 7 Dec 2022 11:50:01 +1100 [thread overview]
Message-ID: <aa6bdae6-b1ad-238e-d9be-f6c2e7b47ef0@amd.com> (raw)
In-Reply-To: <Y4927u7hjK+REsNr@google.com>
On 7/12/22 04:07, Sean Christopherson wrote:
> 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}.
Ouch, you are one step ahead, 2/3 fails, not this one. My bad. I'll add
a stub anyway.
btw I want to do "s/int dr/unsigned int dr/" since I am using an array
now. Does it have to be patch#1 "fix set_dr_addr_mask" and then patch#2
"add get_dr_addr_mask" or one patch will do? Thanks,
>
> 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F20221201232655.290720-12-seanjc%40google.com&data=05%7C01%7CAlexey.Kardashevskiy%40amd.com%7C6ee92cb78f8f446b887908dad7ac6fca%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638059432896741545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=25f18IS6z9HEf0Qtt%2BFDxZdtbTVPg%2FVulsFGhWLH0Rg%3D&reserved=0
--
Alexey
next prev parent reply other threads:[~2022-12-07 0:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 2:19 [PATCH kernel 0/3] KVM: SEV: Enable AMD SEV-ES DebugSwap Alexey Kardashevskiy
2022-12-01 2:19 ` [PATCH kernel 1/3] x86/amd/dr_addr_mask: Cache values in percpu variables Alexey Kardashevskiy
2022-12-01 16:58 ` Sean Christopherson
2022-12-01 19:45 ` Andrew Cooper
2022-12-06 7:14 ` Alexey Kardashevskiy
2022-12-06 17:07 ` Sean Christopherson
2022-12-07 0:50 ` Alexey Kardashevskiy [this message]
2022-12-07 18:55 ` Borislav Petkov
2022-12-08 6:11 ` Alexey Kardashevskiy
2022-12-08 10:35 ` Borislav Petkov
2022-12-01 2:19 ` [PATCH kernel 2/3] KVM: SEV: Enable DebugSwap Alexey Kardashevskiy
2022-12-01 17:37 ` Sean Christopherson
2022-12-09 2:28 ` Alexey Kardashevskiy
2022-12-01 2:19 ` [PATCH kernel 3/3] x86/sev: Do not handle #VC for DR7 read/write Alexey Kardashevskiy
2022-12-01 17:38 ` Sean Christopherson
2022-12-07 19:01 ` Borislav Petkov
2022-12-07 19:07 ` Sean Christopherson
2022-12-08 7:14 ` Alexey Kardashevskiy
2022-12-08 11:01 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa6bdae6-b1ad-238e-d9be-f6c2e7b47ef0@amd.com \
--to=aik@amd.com \
--cc=Jason@zx2c4.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=sterritt@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tony.luck@intel.com \
--cc=venu.busireddy@oracle.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).