Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Qian Cai <cai@xxxxxx>, Anshuman Khandual <Anshuman.Khandual@xxxxxxx>
- Subject: Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers
- From: Christophe Leroy <christophe.leroy@xxxxxx>
- Date: Fri, 25 Oct 2019 09:11:12 +0200
- Cc: linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxxxx>, Mark Rutland <Mark.Rutland@xxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Steven Price <Steven.Price@xxxxxxx>, Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>, Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, Sri Krishna chowdary <schowdary@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxx>, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Martin Schwidefsky <schwidefsky@xxxxxxxxxx>, Heiko Carstens <heiko.carstens@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Vineet Gupta <vgupta@xxxxxxxxxxxx>, James Hogan <jhogan@xxxxxxxxxx>, Paul Burton <paul.burton@xxxxxxxx>, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, "Kirill A . Shutemov" <kirill@xxxxxxxxxxxxx>, Gerald Schaefer <gerald.schaefer@xxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- In-reply-to: <69256008-2235-4AF1-A3BA-0146C82CCB93@lca.pw>
- References: <ccdd4f7a-c7dc-ca10-d30c-0bc05c7136c7@arm.com> <69256008-2235-4AF1-A3BA-0146C82CCB93@lca.pw>
- User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
Le 25/10/2019 à 07:52, Qian Cai a écrit :
On Oct 24, 2019, at 11:45 PM, Anshuman Khandual <Anshuman.Khandual@xxxxxxx> wrote:
Nothing specific. But just tested this with x86 defconfig with relevant configs
which are required for this test. Not sure if it involved W=1.
No, it will not. It needs to run like,
make W=1 -j 64 2>/tmp/warns
Are we talking about this peace of code ?
+static unsigned long __init get_random_vaddr(void)
+{
+ unsigned long random_vaddr, random_pages, total_user_pages;
+
+ total_user_pages = (TASK_SIZE - FIRST_USER_ADDRESS) / PAGE_SIZE;
+
+ random_pages = get_random_long() % total_user_pages;
+ random_vaddr = FIRST_USER_ADDRESS + random_pages * PAGE_SIZE;
+
+ WARN_ON((random_vaddr > TASK_SIZE) ||
+ (random_vaddr < FIRST_USER_ADDRESS));
+ return random_vaddr;
+}
+
ramdom_vaddr is unsigned,
random_pages is unsigned and lower than total_user_pages
So the max value random_vaddr can get is FIRST_USER_ADDRESS +
((TASK_SIZE - FIRST_USER_ADDRESS - 1) / PAGE_SIZE) * PAGE_SIZE =
TASK_SIZE - 1
And the min value random_vaddr can get is FIRST_USER_ADDRESS (that's
when random_pages = 0)
So the WARN_ON() is just unneeded, isn't it ?
Christophe
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]