[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<GV1PR08MB10521E68C886E8E6155AEE49EFB75A@GV1PR08MB10521.eurprd08.prod.outlook.com>
Date: Wed, 11 Jun 2025 12:25:50 +0000
From: Yeo Reum Yun <YeoReum.Yun@....com>
To: Mark Brown <broonie@...nel.org>
CC: Catalin Marinas <Catalin.Marinas@....com>, "pcc@...gle.com"
<pcc@...gle.com>, "will@...nel.org" <will@...nel.org>, Anshuman Khandual
<Anshuman.Khandual@....com>, Joey Gouly <Joey.Gouly@....com>, Yury Khrustalev
<Yury.Khrustalev@....com>, "maz@...nel.org" <maz@...nel.org>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>, "frederic@...nel.org"
<frederic@...nel.org>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "surenb@...gle.com" <surenb@...gle.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>
Subject: Re: [PATCH v6 6/9] kselftest/arm64/mte: add address tag related macro
and function
Hi Mark,
> Ah, this is where the time.h inclusion came from - it just got split
> into the wrong patch. I would move that srandom() into the main()
> function, we don't need to reset the RNG every time we generate a tag
> and since time() has a resolution of a second depending on how fast the
> machine is we might manage to end up setting exactly the same value for
> every tag insertion the program does which would seem to defeat the
> point of using a RNG here.
You're right. but what I calling the every main() with srandom()
seems weird for me.
I think it would be better to call srandom() in mte_default_setup()
which is called only one time in testcase...
--
Sincerely,
Yeoreum Yun
________________________________________
From: Mark Brown
Sent: Wednesday, June 11, 2025 12:58
To: Yeo Reum Yun
Cc: Catalin Marinas; pcc@...gle.com; will@...nel.org; Anshuman Khandual; Joey Gouly; Yury Khrustalev; maz@...nel.org; oliver.upton@...ux.dev; frederic@...nel.org; akpm@...ux-foundation.org; surenb@...gle.com; linux-arm-kernel@...ts.infradead.org; linux-kernel@...r.kernel.org; linux-doc@...r.kernel.org
Subject: Re: [PATCH v6 6/9] kselftest/arm64/mte: add address tag related macro and function
On Wed, Jun 11, 2025 at 10:41:04AM +0100, Yeoreum Yun wrote:
> Add address tag related macro and function to test MTE_FAR feature.
> +void *mte_insert_atag(void *ptr)
> +{
> + unsigned char atag;
> +
> + srandom(time(NULL));
> + atag = mtefar_support ? (random() % MT_ATAG_MASK) + 1 : 0;
> + return (void *)MT_SET_ATAG((unsigned long)ptr, atag);
> +}
Ah, this is where the time.h inclusion came from - it just got split
into the wrong patch. I would move that srandom() into the main()
function, we don't need to reset the RNG every time we generate a tag
and since time() has a resolution of a second depending on how fast the
machine is we might manage to end up setting exactly the same value for
every tag insertion the program does which would seem to defeat the
point of using a RNG here.
Powered by blists - more mailing lists