From nobody Sun Feb 8 12:37:53 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=1585146845; cv=none; d=zohomail.com; s=zohoarc; b=oDh/0tZVIbhLSKacR+X9fUx8FKlEbp4i/xAL/Jzojs4V8xnm1W0jU2hpxMGPkwBLTNFbk8WZBYOJxBEcm3rN8yuR6h26rIupP6jJMFM9VYGgQaVe0ZJhYV35VlbSrBFhiq9iyS5Lu9zrgpTgkRWTArX/964OqDigb8A2X9DqH5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585146845; 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=ENlqhDXY1VN8Te0oscoNTqgy8InnCmLXyV4U286tXj4=; b=n2tv1lVgH/KO3ZV5LIaWVXMM1M8fuyIhJVF1ANNYG0iQuEdSHtGGi7h0rlTs4N8+vZQFEWPduV/U+nICO0hQIk36nnq0ZJZNtoLmEW4G7ba3HzpmuGbql2iBfETbhc6wJYDAStXRPyBBmC8HUv1zNeA1iyIGZg6JXxsd8gbbngM= 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 158514684501371.40287901460749; Wed, 25 Mar 2020 07:34:05 -0700 (PDT) Received: from localhost ([::1]:37222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jH76Z-0006MK-PF for importer@patchew.org; Wed, 25 Mar 2020 10:34:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35020) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jH72m-0002Fg-Gp for qemu-devel@nongnu.org; Wed, 25 Mar 2020 10:30:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jH72l-0002kS-DF for qemu-devel@nongnu.org; Wed, 25 Mar 2020 10:30:08 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:44867) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jH72i-0002fo-Nb; Wed, 25 Mar 2020 10:30:04 -0400 Received: by mail-pf1-x433.google.com with SMTP id b72so1104122pfb.11; Wed, 25 Mar 2020 07:30:04 -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.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 07:30:03 -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=ENlqhDXY1VN8Te0oscoNTqgy8InnCmLXyV4U286tXj4=; b=V1pARf1AEwFaJ+wb0CsNADmTdrrFnQzC5apmBKxsoz+JG6WQbMSTKZVy6dC5aoEdUY SX2fLSDWfAbKO65M/sRIkpvGeMQmm9t3aFOi6o+LTPn/cdFCBfAt93ev2pqMDaMFDj7j f0GTMRwtBbOS2T6fEWxnM1rbnJICfAj50lCz06EzDxHS0FEcva1cvoS+hOyhSebZ6fzg U5hRVa2G2Kyastk6MITgmtItcsqAmKNmMgwqM9qoo/DXOEw7RXls9HXzwieUcotBWSNd HB0XB0y1fk+C6mKC+TAKahK1sXh1nsQSsFrPzRiVFeQSmuXZX3bSOW0YYts3lJpKCTkd Q9HQ== 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=ENlqhDXY1VN8Te0oscoNTqgy8InnCmLXyV4U286tXj4=; b=sv+ShakEPE2zINP/uof8TAckxoBS5/0Qru/a1HzjQARyrQrjt9HL97gmsjwDZUrhg0 gjyVeZJT422AEQ6j+RtHVlDePgSZjVOL58FBXUwnNyBlFNzN/HYuajJzgcAo6xrGdM4U jEjq4y/hxAhp+Q0P6FGuZocBuLyWr0pYZNoDNAFbPSBZEskb0NPetVu1EiPlCqUEpcwr Fvg7YZzZENxzOQB41YjTKVSbWX+iLZvwdHu/m0MNGAyS4ox3e3MsiEdK/kWsGW7lIS9b i9oadzFNI2UE5tP6iHzTZbPiHwWORvAuCQqhbY78XXl3IhBwb0LOTWi9+xLa6m6+TP3V u3xw== X-Gm-Message-State: ANhLgQ38TpcTPpBOl8elPZr7RokHuO3E1GksPP3tYdh9L8aTC8EZtf7+ idUWc00rnnCIeutUMOfENeHBk64N X-Google-Smtp-Source: ADFU+vtWidIfdZFf3u0PUfXnNZKSaA+ych7BJZ8LeO5wSEHsdhiSTJU2UDDpH/mRjeU0m/wbx9RSxQ== X-Received: by 2002:a63:d7:: with SMTP id 206mr3323040pga.366.1585146603562; Wed, 25 Mar 2020 07:30:03 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Subject: [PATCH v2 2/4] ppc/spapr: Improve FWNMI machine check delivery corner case comments Date: Thu, 26 Mar 2020 00:29:04 +1000 Message-Id: <20200325142906.221248-3-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 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::433 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=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. Reviewed-by: Greg Kurz Signed-off-by: Nicholas Piggin --- 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 a4a540f43d..a908c5d0e9 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -860,17 +860,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 @@ -882,8 +878,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; } } @@ -894,7 +895,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