From: "Woods, Brian" <Brian.Woods@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Paul Durrant <paul.durrant@citrix.com>,
"Woods, Brian" <Brian.Woods@amd.com>,
"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH] AMD IOMMU: fix debug console IOMMU intremap output
Date: Wed, 5 Dec 2018 19:56:27 +0000 [thread overview]
Message-ID: <20181205195622.GA20119@amd.com> (raw)
In-Reply-To: <5C0793BB020000780020309C@prv1-mh.provo.novell.com>
On Wed, Dec 05, 2018 at 02:00:43AM -0700, Jan Beulich wrote:
> >>> On 04.12.18 at 22:47, <Brian.Woods@amd.com> wrote:
> > --- a/xen/drivers/passthrough/amd/iommu_intr.c
> > +++ b/xen/drivers/passthrough/amd/iommu_intr.c
> > @@ -665,6 +665,24 @@ int __init amd_setup_hpet_msi(struct msi_desc *msi_desc)
> > return rc;
> > }
> >
> > +
> > +static bool intremap_table_empty(const u32 *table)
>
> uint32_t here please and ...
>
> > +{
> > + u32 count;
>
> ... since a fixed width type isn't needed here in the first place,
> unsigned int here. (This is notwithstanding the fact that I
> assume you've merely cloned dump_intremap_table().)
Gah, I did copy/clone dump_intremap_table, if I keep the same code
strucutre I'll use you ahd Paul's suggestions.
> > + if ( !table )
> > + return true;
> > +
> > + for ( count = 0; count < INTREMAP_ENTRIES; count++ )
> > + {
> > + if ( table[count] )
> > + return false;
> > + }
> > + return true;
>
> Blank line above here please.
>
> > +}
> > +
> > +
> > +
> > static void dump_intremap_table(const u32 *table)
>
> No multiple consecutive blank lines in general please (there may
> be extremely limited cases where exceptions are possible).
>
> > @@ -687,13 +705,17 @@ static int dump_intremap_mapping(u16 seg, struct ivrs_mappings *ivrs_mapping)
> > if ( !ivrs_mapping )
> > return 0;
> >
> > - printk(" %04x:%02x:%02x:%u:\n", seg,
> > - PCI_BUS(ivrs_mapping->dte_requestor_id),
> > - PCI_SLOT(ivrs_mapping->dte_requestor_id),
> > - PCI_FUNC(ivrs_mapping->dte_requestor_id));
> > -
> > spin_lock_irqsave(&(ivrs_mapping->intremap_lock), flags);
> > - dump_intremap_table(ivrs_mapping->intremap_table);
> > +
> > + if ( !intremap_table_empty(ivrs_mapping->intremap_table) ) {
>
> Brace on its own line please.
>
> > + printk(" %04x:%02x:%02x:%u:\n", seg,
> > + PCI_BUS(ivrs_mapping->dte_requestor_id),
> > + PCI_SLOT(ivrs_mapping->dte_requestor_id),
> > + PCI_FUNC(ivrs_mapping->dte_requestor_id));
> > +
> > + dump_intremap_table(ivrs_mapping->intremap_table);
> > + }
>
> dump_intremap_table() already skips empty entries, so aiui it
> is just the headline above you omit. How much of a savings is
> this really?
>
> Furthermore, instead of adding a second function with a second
> loop, did you consider moving the logging of the headline into
> dump_intremap_table(), issuing the line the first time you hit a
> non-empty entry?
>
> Jan
>
I did think about doing that also, but ended up going with this route.
What I'll do is move printing the headline intp dump_intremap_table and
see what you guys think (since it's such a small patch, it'll be easier
to do that than talk about it).
--
Brian Woods
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
prev parent reply other threads:[~2018-12-05 19:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 21:47 [PATCH] AMD IOMMU: fix debug console IOMMU intremap output Woods, Brian
2018-12-05 8:50 ` Paul Durrant
2018-12-05 9:00 ` Jan Beulich
2018-12-05 19:56 ` Woods, Brian [this message]
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=20181205195622.GA20119@amd.com \
--to=brian.woods@amd.com \
--cc=JBeulich@suse.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=paul.durrant@citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xen.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.