lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <756c9cb4-35b9-4523-7ac7-9a70bdf6ddba@loongson.cn>
Date: Tue, 18 Jun 2024 09:47:58 +0800
From: maobibo <maobibo@...ngson.cn>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>,
 Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>,
 kvm@...r.kernel.org, loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: KVM: Delay secondary mmu tlb flush before
 guest entry

Sean,

Thanks for reviewing the patch, we are not familiar with open source 
community, it gives us much helps.

On 2024/6/17 下午10:49, Sean Christopherson wrote:
> On Sat, Jun 15, 2024, Bibo Mao wrote:
>> diff --git a/arch/loongarch/include/asm/kvm_host.h b/arch/loongarch/include/asm/kvm_host.h
>> index c87b6ea0ec47..98078e01dd55 100644
>> --- a/arch/loongarch/include/asm/kvm_host.h
>> +++ b/arch/loongarch/include/asm/kvm_host.h
>> @@ -30,6 +30,7 @@
>>   #define KVM_PRIVATE_MEM_SLOTS		0
>>   
>>   #define KVM_HALT_POLL_NS_DEFAULT	500000
>> +#define KVM_REQ_TLB_FLUSH_GPA		KVM_ARCH_REQ(0)
>>   
>>   #define KVM_GUESTDBG_SW_BP_MASK		\
>>   	(KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)
>> @@ -190,6 +191,7 @@ struct kvm_vcpu_arch {
>>   
>>   	/* vcpu's vpid */
>>   	u64 vpid;
>> +	unsigned long flush_gpa;
> 
> Side topic, GPAs should really use "gpa_t" instead of "unsigned long", otherwise
> 32-bit kernels running on CPUs with 64-bit physical addresses will fail miserably
> (which may or may not be a problem in practice for LoongArch).
Sure, will modify.

> 
>> diff --git a/arch/loongarch/kvm/tlb.c b/arch/loongarch/kvm/tlb.c
>> index 02535df6b51f..55f7f3621e38 100644
>> --- a/arch/loongarch/kvm/tlb.c
>> +++ b/arch/loongarch/kvm/tlb.c
>> @@ -21,12 +21,9 @@ void kvm_flush_tlb_all(void)
>>   	local_irq_restore(flags);
>>   }
>>   
>> +/* Called with irq disabled */
> 
> Rather than add a comment, add:
> 
> 	lockdep_assert_irqs_disabled()
Good point, will modify.

> 
> in the function.
> 
>>   void kvm_flush_tlb_gpa(struct kvm_vcpu *vcpu, unsigned long gpa)
>>   {
>> -	unsigned long flags;
>> -
>> -	local_irq_save(flags);
>>   	gpa &= (PAGE_MASK << 1);
>>   	invtlb(INVTLB_GID_ADDR, read_csr_gstat() & CSR_GSTAT_GID, gpa);
>> -	local_irq_restore(flags);
>>   }
>> diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
>> index 9e8030d45129..ae9ae88c11db 100644
>> --- a/arch/loongarch/kvm/vcpu.c
>> +++ b/arch/loongarch/kvm/vcpu.c
>> @@ -51,6 +51,16 @@ static int kvm_check_requests(struct kvm_vcpu *vcpu)
>>   	return RESUME_GUEST;
>>   }
>>   
>> +/* Check pending request with irq disabled */
> 
> Same thing here.
Will modify in next version.

Regards
Bibo Mao


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ