mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	x86@kernel.org
Cc: sstabellini@kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de
Subject: Re: [PATCH] xen/x86: add diagnostic printout to xen_mc_flush() in case of error
Date: Mon, 26 Nov 2018 15:11:05 -0500	[thread overview]
Message-ID: <0727da38-bfe8-f484-6b06-7205c1d953c1@oracle.com> (raw)
In-Reply-To: <20181123162451.3351-1-jgross@suse.com>

On 11/23/18 11:24 AM, Juergen Gross wrote:
> Failure of an element of a Xen multicall is signalled via a WARN()
> only unless the kernel is compiled with MC_DEBUG. It is impossible to

s/unless/if


> know which element failed and why it did so.
>
> Change that by printing the related information even without MC_DEBUG,
> even if maybe in some limited form (e.g. without information which
> caller produced the failing element).
>
> Move the printing out of the switch statement in order to have the
> same information for a single call.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/xen/multicalls.c | 35 ++++++++++++++++++++---------------
>  1 file changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
> index 2bce7958ce8b..0766a08bdf45 100644
> --- a/arch/x86/xen/multicalls.c
> +++ b/arch/x86/xen/multicalls.c
> @@ -69,6 +69,11 @@ void xen_mc_flush(void)
>  
>  	trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx);
>  
> +#if MC_DEBUG
> +	memcpy(b->debug, b->entries,
> +	       b->mcidx * sizeof(struct multicall_entry));
> +#endif
> +
>  	switch (b->mcidx) {
>  	case 0:
>  		/* no-op */
> @@ -87,32 +92,34 @@ void xen_mc_flush(void)
>  		break;
>  
>  	default:
> -#if MC_DEBUG
> -		memcpy(b->debug, b->entries,
> -		       b->mcidx * sizeof(struct multicall_entry));
> -#endif
> -
>  		if (HYPERVISOR_multicall(b->entries, b->mcidx) != 0)
>  			BUG();
>  		for (i = 0; i < b->mcidx; i++)
>  			if (b->entries[i].result < 0)
>  				ret++;
> +	}
>  
> +	if (WARN_ON(ret)) {
> +		pr_err("%d of %d multicall(s) failed: cpu %d\n",
> +		       ret, b->mcidx, smp_processor_id());
> +		for (i = 0; i < b->mcidx; i++) {
> +			if (b->entries[i].result < 0) {
>  #if MC_DEBUG
> -		if (ret) {
> -			printk(KERN_ERR "%d multicall(s) failed: cpu %d\n",
> -			       ret, smp_processor_id());
> -			dump_stack();
> -			for (i = 0; i < b->mcidx; i++) {
> -				printk(KERN_DEBUG "  call %2d/%d: op=%lu arg=[%lx] result=%ld\t%pF\n",
> -				       i+1, b->mcidx,
> +				pr_err("  call %2d: op=%lu arg=[%lx] result=%ld\t%pF\n",
> +				       i + 1,
>  				       b->debug[i].op,
>  				       b->debug[i].args[0],
>  				       b->entries[i].result,
>  				       b->caller[i]);
> +#else
> +				pr_err("  call %2d: op=%lu arg=[%lx] result=%ld\n",
> +				       i + 1,
> +				       b->entries[i].op,
> +				       b->entries[i].args[0],
> +				       b->entries[i].result);
> +#endif

Doesn't (non-debug) hypervisor corrupt op and args?

(Also, we don't really need to print anything when b->entries[i].result
== 0)


-boris


>  			}
>  		}
> -#endif
>  	}
>  
>  	b->mcidx = 0;
> @@ -126,8 +133,6 @@ void xen_mc_flush(void)
>  	b->cbidx = 0;
>  
>  	local_irq_restore(flags);
> -
> -	WARN_ON(ret);
>  }
>  
>  struct multicall_space __xen_mc_entry(size_t args)


  reply	other threads:[~2018-11-26 20:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 16:24 Juergen Gross
2018-11-26 20:11 ` Boris Ostrovsky [this message]
2018-11-27  7:46   ` Juergen Gross
2018-11-27 13:57     ` Boris Ostrovsky

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=0727da38-bfe8-f484-6b06-7205c1d953c1@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sstabellini@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®