All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Tiejun Chen <tiejun.chen@intel.com>, jbeulich@suse.com, keir@xen.org
Cc: xen-devel@lists.xen.org
Subject: Re: [v2][PATCH] xen/apic: refactor error_interrupt
Date: Wed, 06 May 2015 08:06:20 +0100	[thread overview]
Message-ID: <5549BD6C.2060309@citrix.com> (raw)
In-Reply-To: <1430893651-9002-1-git-send-email-tiejun.chen@intel.com>

On 06/05/2015 07:27, Tiejun Chen wrote:
> Just make this readable while debugging.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>

Almost, but there is one issue.

> ---
> v2:
>
> * Tried to refine code according to comments.
>
>  xen/arch/x86/apic.c | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
> index 3217bdf..b9f53df 100644
> --- a/xen/arch/x86/apic.c
> +++ b/xen/arch/x86/apic.c
> @@ -1319,9 +1319,21 @@ out: ;
>   * This interrupt should never happen with our APIC/SMP architecture
>   */
>  
> +static const char * const esr_fields[] =
> +{
> +    "Send CS error",
> +    "Receive CS error",
> +    "Send accept error",
> +    "Receive accept error",
> +    "Redirectable IPI",
> +    "Send illegal vector",
> +    "Received illegal vector",
> +    "Illegal register address",
> +};
> +
>  void error_interrupt(struct cpu_user_regs *regs)
>  {
> -    unsigned long v, v1;
> +    unsigned int v, v1, i;
>  
>      /* First tickle the hardware, only then report what went on. -- REW */
>      v = apic_read(APIC_ESR);
> @@ -1329,18 +1341,12 @@ void error_interrupt(struct cpu_user_regs *regs)
>      v1 = apic_read(APIC_ESR);
>      ack_APIC_irq();
>  
> -    /* Here is what the APIC error bits mean:
> -       0: Send CS error
> -       1: Receive CS error
> -       2: Send accept error
> -       3: Receive accept error
> -       4: Reserved
> -       5: Send illegal vector
> -       6: Received illegal vector
> -       7: Illegal register address
> -    */
> -    printk (KERN_DEBUG "APIC error on CPU%d: %02lx(%02lx)\n",
> +    printk(XENLOG_DEBUG "APIC error on CPU%u: %02x(%02x)",
>              smp_processor_id(), v , v1);
> +    for ( i = 7; i >= 0; --i )

As the patch currently goes, i is unsigned making this an infinite loop.

Swap i to be a regular int, and Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>

> +        if ( v1 & (1 << i) )
> +            printk(", %s", esr_fields[i]);
> +    printk("\n");
>  }
>  
>  /*

      reply	other threads:[~2015-05-06  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06  6:27 [v2][PATCH] xen/apic: refactor error_interrupt Tiejun Chen
2015-05-06  7:06 ` Andrew Cooper [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=5549BD6C.2060309@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tiejun.chen@intel.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.