All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] KVM/arm64: Print emulated register table name when it is unsorted
Date: Wed, 27 Apr 2022 11:21:52 +0100	[thread overview]
Message-ID: <YmkZQE1dUR2ajMeJ@monolith.localdoman> (raw)
In-Reply-To: <871qxja6ho.wl-maz@kernel.org>

Hi,

On Tue, Apr 26, 2022 at 10:18:27PM +0100, Marc Zyngier wrote:
> On Mon, 25 Apr 2022 17:39:03 +0100,
> Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > 
> > When a sysreg table entry is out-of-order, KVM attempts to print the
> > address of the table:
> > 
> > [    0.143881] kvm [1]: sys_reg table (____ptrval____) out of order (0)
> > 
> > Printing the name of the table instead of a pointer is more helpful in this
> > case:
> > 
> > [    0.143881] kvm [1]: sys_reg table sys_reg_descs out of order (0)
> > 
> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> > ---
> >  arch/arm64/kvm/sys_regs.c | 20 +++++++++++---------
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index 57302048afd0..7b62a2daf056 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> > @@ -2188,18 +2188,18 @@ static const struct sys_reg_desc cp15_64_regs[] = {
> >  };
> >  
> >  static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
> > -			       bool is_32)
> > +			       const char *table_name, bool is_32)
> >  {
> >  	unsigned int i;
> >  
> >  	for (i = 0; i < n; i++) {
> >  		if (!is_32 && table[i].reg && !table[i].reset) {
> > -			kvm_err("sys_reg table %p entry %d lacks reset\n", table, i);
> > +			kvm_err("sys_reg table %s entry %d lacks reset\n", table_name, i);
> 
> Instead of passing a table name, could we simply use something like
> %pS? If this works, it would be a good indication of both what table
> and what entry in that table is at fault.

With the change:

-                       kvm_err("sys_reg table %s out of order (%d)\n", table_name, i - 1);
+                       kvm_err("sys_reg table %pS out of order (%d)\n", &table[i - 1], i - 1);


this is what KVM prints with %pS if the second entry is out-of-order:

[    0.143698] kvm [1]: sys_reg table sys_reg_descs+0x50/0x7490 out of order (1)

There's redundant information now, the entry can be calculated from the
table offset, but printing the offset directly is certainly convenient.

I like it more than passing the table name, if you agree I'll send a v2
with this change.

Thanks,
Alex
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: james.morse@arm.com, suzuki.poulose@arm.com,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 2/2] KVM/arm64: Print emulated register table name when it is unsorted
Date: Wed, 27 Apr 2022 11:21:52 +0100	[thread overview]
Message-ID: <YmkZQE1dUR2ajMeJ@monolith.localdoman> (raw)
In-Reply-To: <871qxja6ho.wl-maz@kernel.org>

Hi,

On Tue, Apr 26, 2022 at 10:18:27PM +0100, Marc Zyngier wrote:
> On Mon, 25 Apr 2022 17:39:03 +0100,
> Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > 
> > When a sysreg table entry is out-of-order, KVM attempts to print the
> > address of the table:
> > 
> > [    0.143881] kvm [1]: sys_reg table (____ptrval____) out of order (0)
> > 
> > Printing the name of the table instead of a pointer is more helpful in this
> > case:
> > 
> > [    0.143881] kvm [1]: sys_reg table sys_reg_descs out of order (0)
> > 
> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> > ---
> >  arch/arm64/kvm/sys_regs.c | 20 +++++++++++---------
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index 57302048afd0..7b62a2daf056 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> > @@ -2188,18 +2188,18 @@ static const struct sys_reg_desc cp15_64_regs[] = {
> >  };
> >  
> >  static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
> > -			       bool is_32)
> > +			       const char *table_name, bool is_32)
> >  {
> >  	unsigned int i;
> >  
> >  	for (i = 0; i < n; i++) {
> >  		if (!is_32 && table[i].reg && !table[i].reset) {
> > -			kvm_err("sys_reg table %p entry %d lacks reset\n", table, i);
> > +			kvm_err("sys_reg table %s entry %d lacks reset\n", table_name, i);
> 
> Instead of passing a table name, could we simply use something like
> %pS? If this works, it would be a good indication of both what table
> and what entry in that table is at fault.

With the change:

-                       kvm_err("sys_reg table %s out of order (%d)\n", table_name, i - 1);
+                       kvm_err("sys_reg table %pS out of order (%d)\n", &table[i - 1], i - 1);


this is what KVM prints with %pS if the second entry is out-of-order:

[    0.143698] kvm [1]: sys_reg table sys_reg_descs+0x50/0x7490 out of order (1)

There's redundant information now, the entry can be calculated from the
table offset, but printing the offset directly is certainly convenient.

I like it more than passing the table name, if you agree I'll send a v2
with this change.

Thanks,
Alex

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-27 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 16:39 [PATCH 0/2] KVM/arm64: sys_reg_table_init() small improvements Alexandru Elisei
2022-04-25 16:39 ` Alexandru Elisei
2022-04-25 16:39 ` [PATCH 1/2] KVM/arm64: Don't BUG_ON() if emulated register table is unsorted Alexandru Elisei
2022-04-25 16:39   ` Alexandru Elisei
2022-04-25 16:39 ` [PATCH 2/2] KVM/arm64: Print emulated register table name when it " Alexandru Elisei
2022-04-25 16:39   ` Alexandru Elisei
2022-04-26 21:18   ` Marc Zyngier
2022-04-26 21:18     ` Marc Zyngier
2022-04-27 10:21     ` Alexandru Elisei [this message]
2022-04-27 10:21       ` Alexandru Elisei
2022-04-27 20:56       ` Marc Zyngier
2022-04-27 20:56         ` Marc Zyngier
2022-04-25 16:39 ` [PATCH 2/2] KVM/arm64: Print sysreg table name when table is not sorted Alexandru Elisei
2022-04-25 16:39   ` Alexandru Elisei
2022-04-26  9:04   ` Alexandru Elisei
2022-04-26  9:04     ` Alexandru Elisei

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=YmkZQE1dUR2ajMeJ@monolith.localdoman \
    --to=alexandru.elisei@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@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 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.