From nobody Sun Feb 8 15:47:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1584421488; cv=none; d=zohomail.com; s=zohoarc; b=Z66DPzuIakZQ5nCfKtfXeSYOmW4i7WcYJzBZPhr4vr4TMFlPHOPp3IUF54uu/oxXjWmaw2mCD+f93mQeGMueDgISiubEFTaxVwIpkjLqQXsjPvPB7eI8/ykQ65rKFSPKIisjwtfFj83hV3m6Dh/FiWb4ACfs11O4wvIqDaz45fU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584421488; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8ZYw6lvEvF1npHa5ZX6HcYXupR8cZnIrf1sZZ0UGhPA=; b=EIrfo7dT3Yt1mdlM33pM7BQkZVjQ81BCxw85kaPklNro4bdMFgMGaO7PbXctQ09h6G6qF/jg1jbNSIJHsZsGwnqSpwXCl2utAYj9/gZdJ2VdK8WlCCyfHC3kAV3RIh+1RAeP9OGSLRqspAIU/qBYBraOtWFD9O7LgfxpUHBF4r4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584421488001849.171801981852; Mon, 16 Mar 2020 22:04:48 -0700 (PDT) Received: from localhost ([::1]:52870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE4PG-0008RY-TG for importer@patchew.org; Tue, 17 Mar 2020 01:04:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49805) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE4Nv-0006qW-DB for qemu-devel@nongnu.org; Tue, 17 Mar 2020 01:03:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE4Nu-0001v8-6Z for qemu-devel@nongnu.org; Tue, 17 Mar 2020 01:03:23 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39958) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jE4Nr-0001Qj-KJ; Tue, 17 Mar 2020 01:03:19 -0400 Received: by mail-pl1-x641.google.com with SMTP id h11so9065376plk.7; Mon, 16 Mar 2020 22:03:19 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (14-202-190-183.tpgi.com.au. [14.202.190.183]) by smtp.gmail.com with ESMTPSA id k67sm994803pga.91.2020.03.16.22.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 22:03:17 -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=8ZYw6lvEvF1npHa5ZX6HcYXupR8cZnIrf1sZZ0UGhPA=; b=VrGYtHhV5M4XrGBGw3HFJwa+d3kZ/cVK988ufqLL8+d/yRL6qGnPkT0j281IngHKqs 6wS5qbtf5zVvpNosPirSpacoU67qwyKTM+TpVR2oK3oDGcoV4D3MHaU3AOPzG4wBb6l6 nh6t/5C/f5SizwEkjA+SyrbcvKgBJ2nbcHqlXwMDwCaCCc4HailoDdKu5OCe6bMMR0+W IW1eLENc6otVxhVvAQsS9aYhChWM/KZ+ZUWzvurDGxnJfE8P+phwNeDq7UZ0Kgw1aDch n0YNTQcTj2P0J1oR2Obr9FRTPljNZdZ3zSQ8p0wqj+xIRjORkS3IUqs6uxUG6XYPxtJj g8Vw== 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=8ZYw6lvEvF1npHa5ZX6HcYXupR8cZnIrf1sZZ0UGhPA=; b=gu9JtD1m4aFedhU+NfH9XHEUCZ3PaIETr9x/8u/hGhtgxD8NGmD4WU8qWcJ7KVhW3Q MNmSAlCvVtOaPFDuaVrefEnPsm/Q60AVfqpRveqsGe9D2Nd7xcYz4OVRWUDOfOqE6mXr DLH9OHUoOHRWVRVLmCPy3eN7seGmrJly87X/D6PGSS9Og9egjLmb9Zf+CO8UyOEca6Yb HD+J2tuVkQfbNUDaT0TnYXQl0DtIM6GGguCKY79TeaXVOySl9T802+tE/FA622/G31G4 RG1IPSi2MlKowCC3r1uJ9kqdlhBRAyLIoRcqjaBkR48CnkZ+T3t/aMzXL5PLYIewqUJl z0rw== X-Gm-Message-State: ANhLgQ2eBi7iR1cqjiw6DCQzZgVo4Ff8FqnKDnoyPeEGFYykvuESWReE Wtu1eHv8YfjbHcq8zbXpftUKpQVQqN8= X-Google-Smtp-Source: ADFU+vvXKd0g1JsmcLYvfK+2EVOTxkWQy8Nqt+mujMDKcN+btEkrxog7FsmGuusb57xGL3m2uWE/qg== X-Received: by 2002:a17:902:6bcb:: with SMTP id m11mr2708697plt.10.1584421398447; Mon, 16 Mar 2020 22:03:18 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Subject: [PATCH 2/5] ppc/spapr: Improve FWNMI machine check delivery corner case comments Date: Tue, 17 Mar 2020 15:02:12 +1000 Message-Id: <20200317050215.159334-3-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200317050215.159334-1-npiggin@gmail.com> References: <20200317050215.159334-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 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 , qemu-devel@nongnu.org, Nicholas Piggin , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Ganesh Goudar , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Some of the conditions are not as clearly documented as they could be. Also the non-FWNMI case does not need a large comment. Signed-off-by: Nicholas Piggin Reviewed-by: Greg Kurz --- hw/ppc/spapr_events.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 323fcef4aa..05337f0671 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -834,17 +834,13 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recove= red) Error *local_err =3D NULL; =20 if (spapr->fwnmi_machine_check_addr =3D=3D -1) { - /* - * This implies that we have hit a machine check either when the - * guest has not registered FWNMI (i.e., "ibm,nmi-register" not - * called) or between system reset and "ibm,nmi-register". - * Fall back to the old machine check behavior in such cases. - */ + /* Non-FWNMI case, deliver it like an architected CPU interrupt. */ cs->exception_index =3D POWERPC_EXCP_MCHECK; ppc_cpu_do_interrupt(cs); return; } =20 + /* Wait for FWNMI interlock. */ while (spapr->fwnmi_machine_check_interlock !=3D -1) { /* * Check whether the same CPU got machine check error @@ -856,8 +852,13 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recover= ed) return; } qemu_cond_wait_iothread(&spapr->fwnmi_machine_check_interlock_cond= ); - /* Meanwhile if the system is reset, then just return */ if (spapr->fwnmi_machine_check_addr =3D=3D -1) { + /* + * If the machine was reset while waiting for the interlock, + * abort the delivery. The machine check applies to a context + * that no longer exists, so it wouldn't make sense to deliver + * it now. + */ return; } } @@ -868,7 +869,9 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovere= d) * We don't want to abort so we let the migration to continue. * In a rare case, the machine check handler will run on the targe= t. * Though this is not preferable, it is better than aborting - * the migration or killing the VM. + * the migration or killing the VM. It is okay to call + * migrate_del_blocker on a blocker that was not added (which the + * nmi-interlock handler would do when it's called after this). */ warn_report("Received a fwnmi while migration was in progress"); } --=20 2.23.0