From patchwork Wed Mar 25 14:29:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1261415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=s4t0qHPE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48nVsJ1PC2z9sRR for ; Thu, 26 Mar 2020 01:30:44 +1100 (AEDT) Received: from localhost ([::1]:37168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jH73K-0002XY-47 for incoming@patchwork.ozlabs.org; Wed, 25 Mar 2020 10:30:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35078) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jH72w-0002US-EZ for qemu-devel@nongnu.org; Wed, 25 Mar 2020 10:30:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jH72v-0002yZ-Be for qemu-devel@nongnu.org; Wed, 25 Mar 2020 10:30:18 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40469) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jH72s-0002vK-Vz; Wed, 25 Mar 2020 10:30:15 -0400 Received: by mail-pf1-x443.google.com with SMTP id l184so1114076pfl.7; Wed, 25 Mar 2020 07:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4d62g15iywxB4Q10tLYc59koLC5xXVOvRd2UYcqqCI0=; b=s4t0qHPEhvjG76DaMtNZYU/TaznAP16MtG5IvwKbDVkmljUTc0zAhZ+PfP5nNBziet OuM1O5n5RDBpJQbQimrDmSLuaL1njYiF2QzCzD5PcOgMBV3uvqS6xPYH0N9MoDQj8AzG gpHKoSpRFC1G6vTJfJgms5LQkSYOYtjTqtKF7goWb6JgowywEERw8tDrIOVfz3dqKfzQ OImGjSRz/oEBGyTZ+lcC1Krma7psYoc23btFer+Xu0WTkaO8hDvjHG8rLoTbm+cz4N/S lv+ddJzLTi//RLtA9pJDAyUbULgtCl6P1LN+0pgEqrbjjcq4ywVdFvtrB0oI6Q5AjxoP lrqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4d62g15iywxB4Q10tLYc59koLC5xXVOvRd2UYcqqCI0=; b=ZzacVFKvJAS56FgeUM2t+5mlwuYRg079EqKkq4nEvaS7785gxfqHJlZcprDNJ3srCz IuOVU0VduzFbMKXUABgJ+EcEBOaJWI2V4zDbwVZ2qmXnm+P1cW6aT9BjKH4PZ/RCHq5N NzLnGVYwSCdx+fUV9MqTudRo8gFpM21Uv5DqE2r3NMo4+lTkwgKXHC46915Cvwqr5lk3 e808fy5dcHaqTM3ijKdltSel28gDCxoM9ws5cGnqO82tCVXEw13sXV8G0imQ+oUpHZpx syyAnLViVc7jjooaOVRhojyVYZOSrdJITQ+5J+ergqGKcD0vp0j1DG52gQ28FAwcoW9n rp/Q== X-Gm-Message-State: ANhLgQ1eD32jc7NHPgCJQaPQCNB5ml1OQCKG8lBJIU7XtZGC8MWW6b7F +SnuThloXtP6LFxcdMU2NqT0Zvrb X-Google-Smtp-Source: ADFU+vvIMh2NXitzpMM2PNqBukzI7e/A9Nb+uF60hlRa7RF4IENEV11GSxdtCLO5CHO4k02C91JG/Q== X-Received: by 2002:a62:6503:: with SMTP id z3mr3810532pfb.232.1585146613812; Wed, 25 Mar 2020 07:30:13 -0700 (PDT) Received: from bobo.ibm.com (14-202-190-183.tpgi.com.au. [14.202.190.183]) by smtp.gmail.com with ESMTPSA id i20sm10609622pfd.89.2020.03.25.07.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 07:30:13 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Subject: [PATCH v2 4/4] ppc/spapr: Don't kill the guest if a recovered FWNMI machine check delivery fails Date: Thu, 26 Mar 2020 00:29:06 +1000 Message-Id: <20200325142906.221248-5-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200325142906.221248-1-npiggin@gmail.com> References: <20200325142906.221248-1-npiggin@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aravinda Prasad , Alexey Kardashevskiy , Mahesh Salgaonkar , qemu-devel@nongnu.org, Nicholas Piggin , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Ganesh Goudar , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Try to be tolerant of FWNMI delivery errors if the machine check had been recovered by the host. Signed-off-by: Nicholas Piggin Reviewed-by: Greg Kurz --- hw/ppc/spapr_events.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index c8964eb25d..b90ecb8afe 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -833,13 +833,25 @@ static void spapr_mce_dispatch_elog(PowerPCCPU *cpu, bool recovered) /* get rtas addr from fdt */ rtas_addr = spapr_get_rtas_addr(); if (!rtas_addr) { - error_report( + if (!recovered) { + error_report( "FWNMI: Unable to deliver machine check to guest: rtas_addr not found."); - qemu_system_guest_panicked(NULL); + qemu_system_guest_panicked(NULL); + } else { + warn_report( +"FWNMI: Unable to deliver machine check to guest: rtas_addr not found. " +"Machine check recovered."); + } g_free(ext_elog); return; } + /* + * Must not set interlock if the MCE does not get delivered to the guest + * in the error case above. + */ + spapr->fwnmi_machine_check_interlock = cpu->vcpu_id; + stq_be_phys(&address_space_memory, rtas_addr + RTAS_ERROR_LOG_OFFSET, env->gpr[3]); cpu_physical_memory_write(rtas_addr + RTAS_ERROR_LOG_OFFSET + @@ -876,9 +888,15 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered) * that CPU called "ibm,nmi-interlock") */ if (spapr->fwnmi_machine_check_interlock == cpu->vcpu_id) { - error_report( + if (!recovered) { + error_report( "FWNMI: Unable to deliver machine check to guest: nested machine check."); - qemu_system_guest_panicked(NULL); + qemu_system_guest_panicked(NULL); + } else { + warn_report( +"FWNMI: Unable to deliver machine check to guest: nested machine check. " +"Machine check recovered."); + } return; } qemu_cond_wait_iothread(&spapr->fwnmi_machine_check_interlock_cond); @@ -906,7 +924,6 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered) warn_report("Received a fwnmi while migration was in progress"); } - spapr->fwnmi_machine_check_interlock = cpu->vcpu_id; spapr_mce_dispatch_elog(cpu, recovered); }