[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e25a6188-8baa-49c9-8df1-5536a0c8640c@lucifer.local>
Date: Fri, 9 May 2025 11:47:06 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Shuah Khan <shuah@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH v1] selftests/mm: add simple VM_PFNMAP tests based on
mmap'ing /dev/mem
On Fri, May 09, 2025 at 12:43:49PM +0200, David Hildenbrand wrote:
> > > Is this not pretty much equivalent to a volatile read where you're forcing
> > > the compiler to not optimise this unused thing away? In guard-regions I set:
> > >
> > > #define FORCE_READ(x) (*(volatile typeof(x) *)x)
> > >
> > > For this purpose, which would make this:
> > >
> > > FORCE_READ(addr);
> > > FORCE_READ(&addr[pagesize]);
> >
> > Hmmm, a compiler might be allowed to optimize out a volatile read.
>
> Looking into this, the compiler should not be allowed to do that. So
> FORCE_READ() should work!
Yeah, was going to say I thought the compiler was explicitly forbidden from
doing this so is a rare case of 'volatile considered harmful' not being
quite so harmful :P
>
> --
> Cheers,
>
> David / dhildenb
>
Powered by blists - more mailing lists