Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3233569imu; Sat, 24 Nov 2018 00:42:31 -0800 (PST) X-Google-Smtp-Source: AJdET5clXuXhde7D4OGS6dbCRt95B4bziMUYqjJz4C6/3p8gpDlWyc5SxaMlRnvrLTQNd1rfeB4F X-Received: by 2002:a62:113:: with SMTP id 19mr19015938pfb.176.1543048951385; Sat, 24 Nov 2018 00:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048951; cv=none; d=google.com; s=arc-20160816; b=XGVKruHOyXadzEcim7iMb1gjVF+IVKseXORdqsYlQbQu63RnAw+SzXzxah+9LLQW+9 BdcSTJpMknLK3x4PJMEpEZVN01DnesT6NmbQAoGVeuKGxd5GQFh5/xe9uFOjqHRidSLR ZfpN1Hard43lfVHN2uDQj8+Qma8EVa+XcyHPTyTvcFpn3c3SMSVuSDAfw2EQJqzk3Gwo oYdNvGiuA4D3KyF+daGFBXxTNySkpcSDe18ilPowTsl1AlA9Mxjst4GQAfdrY9YMSqGa Hw078w494MD+DemSDyF+bZTQ3pZQQGGINXwpMsHfTMl7orXuTothidztmQp+bzB3IZAs sPIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=X2CIDMVNgsEmBO9I1Mj3dIzJX5pOxo4Nt8bWztMEjnM=; b=GcmTWs9onbyGuPn05tJwbex6gj8wEe+fTgmsWyd4kHIcf+92HLqkG0nTLdY8WGUB/U Iinztd3w/gi3NQJ+mhKz+41vDeAT3BRNrR4jUfeMCOX81qDtWcaiQ6dMsAy8MyTM/OkU wdy1MG/a1L5woyG8znvxDmaOzO8imHa2EW/QRRIaL0/6LvjI24M7FUoJuaImj3tfesFr W2xMfmQOJ+iOYkRq57kxgqE3GAqAlMj1GFgh1zsD+mpqvHE3ZbSU9g5/52PLH3mLc/dd ZFGKrjpAENHKnkozrxiU5p4ce6l/6W0oGr3Hyp0crnBlbo/eTMIl2PdPp9ev5zvXrx7g kroA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 205si46042911pfa.199.2018.11.24.00.42.17; Sat, 24 Nov 2018 00:42:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2632973AbeKXDJt (ORCPT + 99 others); Fri, 23 Nov 2018 22:09:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:37684 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387726AbeKXDJt (ORCPT ); Fri, 23 Nov 2018 22:09:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 559CDAE06; Fri, 23 Nov 2018 16:24:55 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: boris.ostrovsky@oracle.com, sstabellini@kernel.org, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, Juergen Gross Subject: [PATCH] xen/x86: add diagnostic printout to xen_mc_flush() in case of error Date: Fri, 23 Nov 2018 17:24:51 +0100 Message-Id: <20181123162451.3351-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 --- 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 } } -#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) -- 2.16.4