Re: [kvm-unit-tests PATCH 2/2] arm64: ensure tlbi is safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jul 14, 2023, at 3:55 AM, Alexandru Elisei <alexandru.elisei@xxxxxxx> wrote:
> 
> !! External Email
> 
> Hi,
> 
> On Sat, Jun 17, 2023 at 01:31:38AM +0000, Nadav Amit wrote:
>> From: Nadav Amit <namit@xxxxxxxxxx>
>> 
>> While no real problem was encountered, having an inline assembly without
>> volatile keyword and output can allow the compiler to ignore it. And
>> without a memory clobber, potentially reorder it.
>> 
>> Add volatile and memory clobber.
>> 
>> Signed-off-by: Nadav Amit <namit@xxxxxxxxxx>
>> ---
>> lib/arm64/asm/mmu.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/lib/arm64/asm/mmu.h b/lib/arm64/asm/mmu.h
>> index 5c27edb..cf94403 100644
>> --- a/lib/arm64/asm/mmu.h
>> +++ b/lib/arm64/asm/mmu.h
>> @@ -14,7 +14,7 @@
>> static inline void flush_tlb_all(void)
>> {
>>      dsb(ishst);
>> -     asm("tlbi       vmalle1is");
> 
> From the gas manual [1]:
> 
> "asm statements that have no output operands and asm goto statements, are
> implicitly volatile."
> 
> Looks to me like both TLBIs fall into this category.
> 
> And I think the "memory" clobber is not needed because the dsb macro before and
> after the TLBI already have it.

You are completely correct. I forgot about the implicit “volatile”.

This one can be dropped.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux