From: David Hildenbrand <david@redhat.com>
To: Eiichi Tsukata <eiichi.tsukata@nutanix.com>,
pbonzini@redhat.com, marcandre.lureau@redhat.com,
berrange@redhat.com, thuth@redhat.com, philmd@linaro.org,
peterx@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] physmem: use PR_SET_VMA_ANON_NAME to set ram block name
Date: Tue, 11 Apr 2023 09:51:54 +0200 [thread overview]
Message-ID: <2f1ba40f-db8f-8bdc-c93b-643939e06189@redhat.com> (raw)
In-Reply-To: <20230411041158.66728-1-eiichi.tsukata@nutanix.com>
On 11.04.23 06:11, Eiichi Tsukata wrote:
> Use linux specific PR_SET_VMA_ANON_NAME (introduced in v5.17) to set ram
> block name in the kernel. This makes each ram block distinguishable and
> can help debugging and inspection. The names of ram blocks are shown in
> /proc/pid/maps like this:
>
> 7f00e9400000-7f00f1400000 rw-p 00000000 00:00 0 [anon:pc.ram]
> 7f0115200000-7f0115201000 rw-p 00000000 00:00 0 [anon:/rom@etc/acpi/rsdp]
> 7f0115400000-7f0115410000 rw-p 00000000 00:00 0 [anon:/rom@etc/table-loader]
> 7f0115600000-7f0115800000 rw-p 00000000 00:00 0 [anon:/rom@etc/acpi/tables]
> 7f0115a00000-7f0115a40000 rw-p 00000000 00:00 0 [anon:e1000.rom]
> ...
>
> Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
> ---
> meson.build | 2 ++
> softmmu/physmem.c | 9 +++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index 29f8644d6d..aca889f5f0 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2040,6 +2040,8 @@ config_host_data.set('HAVE_OPTRESET',
> cc.has_header_symbol('getopt.h', 'optreset'))
> config_host_data.set('HAVE_IPPROTO_MPTCP',
> cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
> +config_host_data.set('CONFIG_PRCTL_PR_SET_VMA_ANON_NAME',
> + cc.has_header_symbol('sys/prctl.h', 'PR_SET_VMA_ANON_NAME'))
Nit: I'd suggest placing that directly next to the
CONFIG_PRCTL_PR_SET_TIMERSLACK check.
>
> # has_member
> config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index e35061bba4..4fe3e14193 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -80,6 +80,10 @@
> #include <daxctl/libdaxctl.h>
> #endif
>
> +#ifdef CONFIG_PRCTL_PR_SET_VMA_ANON_NAME
> +#include <sys/prctl.h>
> +#endif
> +
> //#define DEBUG_SUBPAGE
>
> /* ram_list is read under rcu_read_lock()/rcu_read_unlock(). Writes
> @@ -1810,6 +1814,11 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
> return;
> }
> memory_try_enable_merging(new_block->host, new_block->max_length);
> +#ifdef CONFIG_PRCTL_PR_SET_VMA_ANON_NAME
> + prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME,
> + (unsigned long) new_block->host, new_block->max_length,
> + (unsigned long) new_block->mr->name);
We might not have anon memory. I assume that we expect that the prctl
will simply silently fail (maybe worth a comment) in case we have !anon
memory.
I assume new_block->mr->name should be set in all cases we care about,
so LGTM.
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-04-11 7:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 4:11 [PATCH] physmem: use PR_SET_VMA_ANON_NAME to set ram block name Eiichi Tsukata
2023-04-11 7:51 ` David Hildenbrand [this message]
2023-04-11 17:00 ` Peter Xu
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=2f1ba40f-db8f-8bdc-c93b-643939e06189@redhat.com \
--to=david@redhat.com \
--cc=berrange@redhat.com \
--cc=eiichi.tsukata@nutanix.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.