From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH v1] selftests/mm: add simple VM_PFNMAP tests based on mmap'ing /dev/mem
Date: Fri, 9 May 2025 12:43:49 +0200 [thread overview]
Message-ID: <a0a54f02-bee3-41b8-8c4f-9cfd7ea524ed@redhat.com> (raw)
In-Reply-To: <4efa9948-a523-4597-baa4-c36d18a658b0@redhat.com>
>> 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!
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-05-09 10:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 22:20 David Hildenbrand
2025-05-09 5:35 ` Dev Jain
2025-05-09 7:33 ` David Hildenbrand
2025-05-09 9:49 ` Lorenzo Stoakes
2025-05-09 10:18 ` David Hildenbrand
2025-05-09 10:43 ` David Hildenbrand [this message]
2025-05-09 10:47 ` Lorenzo Stoakes
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=a0a54f02-bee3-41b8-8c4f-9cfd7ea524ed@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mingo@redhat.com \
--cc=peterx@redhat.com \
--cc=shuah@kernel.org \
/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