From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Xiaoyao Li <xiaoyao.li@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>,
David Hildenbrand <david@redhat.com>
Cc: qemu-devel@nongnu.org,
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
Stefan Hajnoczi <stefanha@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH] physmem: replace function name with __func__ in ram_block_discard_range()
Date: Thu, 25 Jan 2024 06:06:18 +0100 [thread overview]
Message-ID: <9943c88e-3ccd-4a3b-bbe0-65a8a58755d1@linaro.org> (raw)
In-Reply-To: <20240125023328.2520888-1-xiaoyao.li@intel.com>
Hi,
On 25/1/24 03:33, Xiaoyao Li wrote:
> Use __func__ to avoid hard-coded function name.
>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Reviewed-by: David Hildenbrand <david@redhat.com>
> ---
> system/physmem.c | 38 +++++++++++++++++---------------------
> 1 file changed, 17 insertions(+), 21 deletions(-)
> if ((start + length) <= rb->max_length) {
> bool need_madvise, need_fallocate;
> if (!QEMU_IS_ALIGNED(length, rb->page_size)) {
> - error_report("ram_block_discard_range: Unaligned length: %zx",
> - length);
> + error_report("%s: Unaligned length: %zx", __func__, length);
Pre-existing, should we enforce 0x prefix for %*x format?
See https://www.qemu.org/docs/master/devel/style.html#printf-flag
and related commit c3e5875afc ("checkpatch: check trace-events code
style") for rationale.
$ git grep '[^x]%zx'
accel/tcg/perf.c:239: fprintf(perfmap, "%"PRIxPTR" %zx
tcg-prologue-buffer\n",
gdbstub/user-target.c:300: g_string_printf(gdbserver_state.str_buf,
"F%zx;", n);
migration/postcopy-ram.c:759: error_report("%s: Failed to wake:
%zx in %s (%s)",
migration/trace-events:100:ram_discard_range(const char *rbname,
uint64_t start, size_t len) "%s: start: %" PRIx64 " %zx"
system/physmem.c:3511: error_report("ram_block_discard_range:
Unaligned length: %zx",
system/physmem.c:3564: "%s:%" PRIx64 " +%zx
(%d)",
system/physmem.c:3571: "%s:%" PRIx64 " +%zx (%d)",
system/physmem.c:3591: "%s:%" PRIx64 " +%zx
(%d)",
system/physmem.c:3598: "%s:%" PRIx64 " +%zx (%d)",
system/physmem.c:3607: "/%zx/" RAM_ADDR_FMT")",
> if (ret) {
> ret = -errno;
> - error_report("ram_block_discard_range: Failed to fallocate "
> - "%s:%" PRIx64 " +%zx (%d)",
> - rb->idstr, start, length, ret);
> + error_report("%s: Failed to fallocate %s:%" PRIx64 " +%zx (%d)",
> + __func__, rb->idstr, start, length, ret);
> goto err;
> }
> #else
> ret = -ENOSYS;
> - error_report("ram_block_discard_range: fallocate not available/file"
> + error_report("%s: fallocate not available/file"
> "%s:%" PRIx64 " +%zx (%d)",
> - rb->idstr, start, length, ret);
> + __func__, rb->idstr, start, length, ret);
> goto err;
> #endif
> }
> @@ -3587,25 +3585,23 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length)
> }
> if (ret) {
> ret = -errno;
> - error_report("ram_block_discard_range: Failed to discard range "
> + error_report("%s: Failed to discard range "
> "%s:%" PRIx64 " +%zx (%d)",
> - rb->idstr, start, length, ret);
> + __func__, rb->idstr, start, length, ret);
> goto err;
> }
> #else
> ret = -ENOSYS;
> - error_report("ram_block_discard_range: MADVISE not available"
> - "%s:%" PRIx64 " +%zx (%d)",
> - rb->idstr, start, length, ret);
> + error_report("%s: MADVISE not available %s:%" PRIx64 " +%zx (%d)",
> + __func__, rb->idstr, start, length, ret);
> goto err;
> #endif
> }
> trace_ram_block_discard_range(rb->idstr, host_startaddr, length,
> need_madvise, need_fallocate, ret);
> } else {
> - error_report("ram_block_discard_range: Overrun block '%s' (%" PRIu64
> - "/%zx/" RAM_ADDR_FMT")",
> - rb->idstr, start, length, rb->max_length);
> + error_report("%s: Overrun block '%s' (%" PRIu64 "/%zx/" RAM_ADDR_FMT")",
> + __func__, rb->idstr, start, length, rb->max_length);
> }
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2024-01-25 5:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 2:33 [PATCH] physmem: replace function name with __func__ in ram_block_discard_range() Xiaoyao Li
2024-01-25 5:06 ` Philippe Mathieu-Daudé [this message]
2024-01-25 8:22 ` David Hildenbrand
2024-01-25 10:35 ` Paolo Bonzini
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=9943c88e-3ccd-4a3b-bbe0-65a8a58755d1@linaro.org \
--to=philmd@linaro.org \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=xiaoyao.li@intel.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).