[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <709a64c2-a58a-4d74-bb63-2e1193c2f83b@amd.com>
Date: Sat, 27 Jan 2024 09:36:14 +0530
From: "Nikunj A. Dadhania" <nikunj@....com>
To: Tom Lendacky <thomas.lendacky@....com>, linux-kernel@...r.kernel.org,
x86@...nel.org, kvm@...r.kernel.org
Cc: bp@...en8.de, mingo@...hat.com, tglx@...utronix.de,
dave.hansen@...ux.intel.com, dionnaglaze@...gle.com, pgonda@...gle.com,
seanjc@...gle.com, pbonzini@...hat.com
Subject: Re: [PATCH v7 06/16] virt: sev-guest: Move SNP Guest command mutex
On 1/27/2024 3:41 AM, Tom Lendacky wrote:
> On 12/20/23 09:13, Nikunj A Dadhania wrote:
>> SNP command mutex is used to serialize the shared buffer access, command
>> handling and message sequence number races. Move the SNP guest command
>> mutex out of the sev guest driver and provide accessors to sev-guest
>> driver. Remove multiple lockdep check in sev-guest driver, next patch adds
>> a single lockdep check in snp_send_guest_request().
>>
>> Signed-off-by: Nikunj A Dadhania <nikunj@....com>
>> ---
>> arch/x86/include/asm/sev-guest.h | 3 +++
>> arch/x86/kernel/sev.c | 21 +++++++++++++++++++++
>> drivers/virt/coco/sev-guest/sev-guest.c | 23 +++++++----------------
>> 3 files changed, 31 insertions(+), 16 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/sev-guest.h b/arch/x86/include/asm/sev-guest.h
>> index 27cc15ad6131..2f3cceb88396 100644
>> --- a/arch/x86/include/asm/sev-guest.h
>> +++ b/arch/x86/include/asm/sev-guest.h
>> @@ -81,4 +81,7 @@ struct snp_guest_req {
>> int snp_issue_guest_request(struct snp_guest_req *req, struct snp_req_data *input,
>> struct snp_guest_request_ioctl *rio);
>> +void snp_guest_cmd_lock(void);
>> +void snp_guest_cmd_unlock(void);
>> +
>> #endif /* __VIRT_SEVGUEST_H__ */
>> diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
>> index 6aa0bdf8a7a0..191193924b22 100644
>> --- a/arch/x86/kernel/sev.c
>> +++ b/arch/x86/kernel/sev.c
>> @@ -941,6 +941,21 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa)
>> free_page((unsigned long)vmsa);
>> }
>> +/* SNP Guest command mutex to serialize the shared buffer access and command handling. */
>> +static struct mutex snp_guest_cmd_mutex;
>
> You should probably use:
>
> static DEFINE_MUTEX(snp_guest_cmd_mutex);
>
> That way you can avoid the initialization in snp_init_platform_device().
>
> With that:
>
> Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
Sure, will change.
Regards
Nikunj
Powered by blists - more mailing lists