From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Qian Cai <cai@lca.pw>, Anshuman Khandual <Anshuman.Khandual@arm.com>
Cc: Mark Rutland <Mark.Rutland@arm.com>,
linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
James Hogan <jhogan@kernel.org>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org, Dave Hansen <dave.hansen@intel.com>,
Paul Mackerras <paulus@samba.org>,
sparclinux@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
linux-s390@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>,
x86@kernel.org, Russell King - ARM Linux <linux@armlinux.org.uk>,
Matthew Wilcox <willy@infradead.org>,
Steven Price <Steven.Price@arm.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Gerald Schaefer <gerald.schaefer@de.ibm.com>,
linux-snps-arc@lists.infradead.org,
Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Mark Brown <broonie@kernel.org>,
"Kirill A . Shutemov" <kirill@shutemov.name>,
Dan Williams <dan.j.williams@intel.com>,
Vlastimil Babka <vbabka@suse.cz>,
linux-arm-kernel@lists.infradead.org,
Sri Krishna chowdary <schowdary@nvidia.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-mips@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
linux-kernel@vger.kernel.org, Paul Burton <paul.burton@mips.com>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Vineet Gupta <vgupta@synopsys.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
linuxppc-dev@lists.ozlabs.org,
"David S. Miller" <davem@davemloft.net>,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers
Date: Fri, 25 Oct 2019 09:11:12 +0200 [thread overview]
Message-ID: <3cfec421-4006-4159-ca32-313ff5196ff9@c-s.fr> (raw)
In-Reply-To: <69256008-2235-4AF1-A3BA-0146C82CCB93@lca.pw>
Le 25/10/2019 à 07:52, Qian Cai a écrit :
>
>
>> On Oct 24, 2019, at 11:45 PM, Anshuman Khandual <Anshuman.Khandual@arm.com> 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
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next prev parent reply other threads:[~2019-10-25 7:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 2:42 [PATCH V7] mm/debug: Add tests validating architecture page table helpers Anshuman Khandual
2019-10-21 2:42 ` Anshuman Khandual
2019-10-22 7:11 ` Christophe Leroy
2019-10-22 11:18 ` Anshuman Khandual
2019-10-24 16:51 ` Qian Cai
2019-10-25 3:46 ` Anshuman Khandual
2019-10-25 5:52 ` Qian Cai
2019-10-25 6:35 ` Anshuman Khandual
2019-10-25 7:11 ` Christophe Leroy [this message]
2019-10-25 8:24 ` Anshuman Khandual
2019-10-25 8:52 ` Christophe Leroy
2019-10-25 10:10 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3cfec421-4006-4159-ca32-313ff5196ff9@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=Anshuman.Khandual@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Steven.Price@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=broonie@kernel.org \
--cc=cai@lca.pw \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=davem@davemloft.net \
--cc=gerald.schaefer@de.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=jgg@ziepe.ca \
--cc=jhogan@kernel.org \
--cc=keescook@chromium.org \
--cc=kirill@shutemov.name \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=paul.burton@mips.com \
--cc=paulus@samba.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=peterz@infradead.org \
--cc=ralf@linux-mips.org \
--cc=rppt@linux.vnet.ibm.com \
--cc=schowdary@nvidia.com \
--cc=schwidefsky@de.ibm.com \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=vgupta@synopsys.com \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).