From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V2] iommu/amd: Add logic to decode AMD IOMMU event flag
Date: Wed, 3 Apr 2013 00:09:32 +0200 [thread overview]
Message-ID: <20130402220931.GV30540@8bytes.org> (raw)
In-Reply-To: <1364929514-3129-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
On Tue, Apr 02, 2013 at 02:05:14PM -0500, Suthikulpanit, Suravee wrote:
> From: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
> +static const char * const _type_field_encodings[] = {
> + /* 00 */"Reserved",
> + /* 01 */"Master Abort",
> + /* 10 */"Target Abort",
> + /* 11 */"Data Error",
In these arrays, please put the comments at the end of the line and
align them nicely like this:
static const char * const _type_field_encodings[] = {
"Reserved", /* 00 */
"Master Abort", /* 01 */
"Target Abort", /* 10 */
"Data Error", /* 11 */
};
This improves readability a lot.
> +static void dump_flags(int flags, int ev_type)
> +{
> + struct _event_log_flags *p = (struct _event_log_flags *) &flags;
> + u32 err_type = p->type;
> +
> + pr_err("AMD-Vi: Flags details: %s, NX:%u, %s, %s, %s, %s, %s, %s, %s\n",
> + (p->gn ? "Use guest address" : "Use nested address"),
> + (p->nx),
> + (p->us ? "User privileges" : "Supervisor privileges"),
> + (p->i ? "Interrupt request" : "memory request"),
> + (p->pr ? "Page present or Interrupt remapped" :
> + "Page not present or Interrupt blocked"),
> + (p->rw ? "Write transaction" : "Read transaction"),
> + (p->pe ? "Does not have permission" : "Has permission"),
> + (p->rz ? "Reserv bit not zero" : "Illegal level encoding"),
> + (p->tr ? "Translation request" : "Transaction request"));
These strings are too long, please just print useful shortcuts for them,
like
"US" : "SV" instead of
"User privileges" : "Supervisor privileges"
Also the commas between the strings are not needed then.
As a general rule, in the default configuration an event-log entry
should not take more than a single line in dmesg (which is also not too
long). If you want to print more information in some cases you can
enable that by a command line parameter like 'amd_iommu=verbose' or
something like that.
Joerg
prev parent reply other threads:[~2013-04-02 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 19:05 [PATCH V2] iommu/amd: Add logic to decode AMD IOMMU event flag suravee.suthikulpanit-5C7GfCeVMHo
[not found] ` <1364929514-3129-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
2013-04-02 22:09 ` Joerg Roedel [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=20130402220931.GV30540@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.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 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).