From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Bernhard Beschow <shentey@gmail.com>
Cc: qemu-devel@nongnu.org,
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
qemu-rust@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/2] rust/hw/char/pl011/src/device: Implement logging
Date: Mon, 31 Mar 2025 10:18:05 +0100 [thread overview]
Message-ID: <Z-pdzUBa4CrBourR@redhat.com> (raw)
In-Reply-To: <20250330205857.1615-3-shentey@gmail.com>
On Sun, Mar 30, 2025 at 10:58:57PM +0200, Bernhard Beschow wrote:
> Now that there is logging support in Rust for QEMU, use it in the pl011 device.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> rust/hw/char/pl011/src/device.rs | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
> index bf88e0b00a..d5470fae11 100644
> --- a/rust/hw/char/pl011/src/device.rs
> +++ b/rust/hw/char/pl011/src/device.rs
> @@ -8,9 +8,11 @@
> chardev::{CharBackend, Chardev, Event},
> impl_vmstate_forward,
> irq::{IRQState, InterruptSource},
> + log::{LOG_GUEST_ERROR, LOG_UNIMP},
> memory::{hwaddr, MemoryRegion, MemoryRegionOps, MemoryRegionOpsBuilder},
> prelude::*,
> qdev::{Clock, ClockEvent, DeviceImpl, DeviceState, Property, ResetType, ResettablePhasesImpl},
> + qemu_log_mask,
> qom::{ObjectImpl, Owned, ParentField},
> static_assert,
> sysbus::{SysBusDevice, SysBusDeviceImpl},
> @@ -298,8 +300,7 @@ pub(self) fn write(
> DMACR => {
> self.dmacr = value;
> if value & 3 > 0 {
> - // qemu_log_mask(LOG_UNIMP, "pl011: DMA not implemented\n");
> - eprintln!("pl011: DMA not implemented");
> + qemu_log_mask!(LOG_UNIMP, "pl011: DMA not implemented\n");
> }
> }
> }
> @@ -535,7 +536,7 @@ fn read(&self, offset: hwaddr, _size: u32) -> u64 {
> u64::from(device_id[(offset - 0xfe0) >> 2])
> }
> Err(_) => {
> - // qemu_log_mask(LOG_GUEST_ERROR, "pl011_read: Bad offset 0x%x\n", (int)offset);
> + qemu_log_mask!(LOG_GUEST_ERROR, "pl011_read: Bad offset {offset}\n");
> 0
> }
> Ok(field) => {
> @@ -567,7 +568,10 @@ fn write(&self, offset: hwaddr, value: u64, _size: u32) {
> .borrow_mut()
> .write(field, value as u32, &self.char_backend);
> } else {
> - eprintln!("write bad offset {offset} value {value}");
> + qemu_log_mask!(
> + LOG_GUEST_ERROR,
> + "pl011_write: Bad offset {offset} value {value}\n"
> + );
> }
General conceptual question ..... I've never understood what the dividing
line is between use of 'qemu_log_mask' and trace points. The latter can be
optionally built to feed into qemu log, as well as the other dynamic trace
backends.
Is there a compelling reason to use 'qemu_log', that isn't acceptable for
trace probe points ?
This is an indirect way of asking whether qemu_log_mask should be exposed
to rust, or would exposing tracing be sufficient ?
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-03-31 9:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-30 20:58 [PATCH 0/2] Initial logging support for Rust Bernhard Beschow
2025-03-30 20:58 ` [PATCH 1/2] rust/qemu-api: Add initial logging support based on C API Bernhard Beschow
2025-03-31 9:53 ` Paolo Bonzini
2025-04-01 10:51 ` Bernhard Beschow
2025-04-08 20:58 ` Bernhard Beschow
2025-05-12 15:32 ` Paolo Bonzini
2025-05-19 8:13 ` Manos Pitsidianakis
2025-05-20 9:57 ` Paolo Bonzini
2025-06-10 20:51 ` Bernhard Beschow
2025-03-30 20:58 ` [PATCH 2/2] rust/hw/char/pl011/src/device: Implement logging Bernhard Beschow
2025-03-31 9:18 ` Daniel P. Berrangé [this message]
2025-04-02 9:33 ` Bernhard Beschow
2025-04-02 13:27 ` Daniel P. Berrangé
2025-04-03 9:46 ` Bernhard Beschow
2025-05-02 16:48 ` Peter Maydell
2025-05-08 17:14 ` Daniel P. Berrangé
2025-05-12 10:45 ` Peter Maydell
2025-04-02 14:13 ` BALATON Zoltan
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=Z-pdzUBa4CrBourR@redhat.com \
--to=berrange@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=shentey@gmail.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).