Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fix from Catalin Marinas:
"Fix the TLBI RANGE operand calculation causing live migration under
KVM/arm64 to miss dirty pages due to stale TLB entries"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: tlb: Fix TLBI RANGE operand

+11 -9
+11 -9
arch/arm64/include/asm/tlbflush.h
··· 161 161 #define MAX_TLBI_RANGE_PAGES __TLBI_RANGE_PAGES(31, 3) 162 162 163 163 /* 164 - * Generate 'num' values from -1 to 30 with -1 rejected by the 165 - * __flush_tlb_range() loop below. 164 + * Generate 'num' values from -1 to 31 with -1 rejected by the 165 + * __flush_tlb_range() loop below. Its return value is only 166 + * significant for a maximum of MAX_TLBI_RANGE_PAGES pages. If 167 + * 'pages' is more than that, you must iterate over the overall 168 + * range. 166 169 */ 167 - #define TLBI_RANGE_MASK GENMASK_ULL(4, 0) 168 - #define __TLBI_RANGE_NUM(pages, scale) \ 169 - ((((pages) >> (5 * (scale) + 1)) & TLBI_RANGE_MASK) - 1) 170 + #define __TLBI_RANGE_NUM(pages, scale) \ 171 + ({ \ 172 + int __pages = min((pages), \ 173 + __TLBI_RANGE_PAGES(31, (scale))); \ 174 + (__pages >> (5 * (scale) + 1)) - 1; \ 175 + }) 170 176 171 177 /* 172 178 * TLB Invalidation ··· 385 379 * 3. If there is 1 page remaining, flush it through non-range operations. Range 386 380 * operations can only span an even number of pages. We save this for last to 387 381 * ensure 64KB start alignment is maintained for the LPA2 case. 388 - * 389 - * Note that certain ranges can be represented by either num = 31 and 390 - * scale or num = 0 and scale + 1. The loop below favours the latter 391 - * since num is limited to 30 by the __TLBI_RANGE_NUM() macro. 392 382 */ 393 383 #define __flush_tlb_range_op(op, start, pages, stride, \ 394 384 asid, tlb_level, tlbi_user, lpa2) \