From nobody Sat May 18 12:29:54 2024 Delivered-To: importer@patchew.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=1622837165; cv=none; d=zohomail.com; s=zohoarc; b=dQT20BHnz9OhZ9BmnNSBbu4p4PqwjKNE5taLsKB5HDBPEoezKvpPl2KWC/dLA1Gg3nkUJwNHM0ZzGbMCcyVO2to09hPtO5fD50vS67ZEGrrl4pbh5uS5c6LURQSdf0DROVkw4K6qfPcVJIw35zCIqg6dYayJk7aqaEkMPURzO2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622837165; 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=A0fEYqYijgmXe2Xcovc9mpgjPFbwuu7scsqLtKvxj5A=; b=ia+JuGMkWtlE875Pum/xNGFQNYa+MRko3KGivWo0D8z8726uVttkvFRttucrdnHvPqSzrh4VEKs2hxOJxHyrA28UYiTKqDUhCDlFQNzFPEM/5SOz3n02D49l+PRdaDCWLy98zSIY55mqQHVnVu3wjbtgZeYzK8sy/qke10m56Us= 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 1622837165174650.2270303740836; Fri, 4 Jun 2021 13:06:05 -0700 (PDT) Received: from localhost ([::1]:36782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpG4x-0007In-UK for importer@patchew.org; Fri, 04 Jun 2021 16:06:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpG3C-0005Bj-2N; Fri, 04 Jun 2021 16:04:14 -0400 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:33769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpG3A-0000Qx-0l; Fri, 04 Jun 2021 16:04:13 -0400 Received: by mail-qv1-xf2f.google.com with SMTP id 5so5613863qvk.0; Fri, 04 Jun 2021 13:04:11 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c6:b390:9cad:b272:426b:6a0]) by smtp.gmail.com with ESMTPSA id f19sm4765011qkg.70.2021.06.04.13.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 13:04:10 -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=A0fEYqYijgmXe2Xcovc9mpgjPFbwuu7scsqLtKvxj5A=; b=brPulBsaSfnPKERT8adhepBjWsHHFK8eGGzko4i71gE1Pu8hg/j2R/PheOqwnYNDva iQbSdEi64D2sLK183QCz1n48DXlvIb0f2qo9cFPv7NiDuAHHWNiWOvghckyYo3RUKiq8 yzQ/q0kZo2V2ko+GUvja1DezlJNjWYmlKBcNTefIjFd6s95bMyTkgThk7ncAXMHSEznL VXX5oCzhOrpQejG7LkZ6ObOuYR+9pGCbglrsmXx63ceERfZEQXZ+wsbYb1qVGWBvygmd fWnUfVz49bE7LTY9Wj8xyAxBQdQUiPKbBLN+4sBwNLNBsDspO7JDIVskJR4O2Om0nzrL ZpAA== 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=A0fEYqYijgmXe2Xcovc9mpgjPFbwuu7scsqLtKvxj5A=; b=pOJXiL6sTXyixQUGMpE61TNOqgYJzfP9h63ztaLbHLL/IO6mvYIN+rXENdCUdt3/LC /oLRoPmg39R15fa/HtKasEXP+MHAqjfHU0L4Ggmj9N1y9N1fbM/lF9lxSUo5zTz8APr0 VwX3v3zEXhRLaiX4YQueDeEJDRA6rccav6fOQicbDXLXRnmodPcCkvCfBAVNXyCUv2HT 19E10EbamCa4vBf0gkF+AVukUL/yh1pFOhT5vKlVyMevyNWer/RB+ZKBkPv5S3vJ1txq AjQv7r/PqRXsX6GVjtOCib5CSYkZ8W3cRENSrH/KdcoxqTTiGrxJ37cHkOapb/oiDWlc 9tUQ== X-Gm-Message-State: AOAM532E+xZgbTou7ukKwPs13qGQXNGjig3xiw4BDnexXpy7k5TfBy9i pfX3ZD0GgkvrgFq1gyFY7IKOzzdFU7V9XQ== X-Google-Smtp-Source: ABdhPJxyArMo6RKkhOmc1lvf0Td6EuJFO1DxEymLRHqsUHpbEAV0G+8Zva+QthaNa2nQgq7aJA8WJA== X-Received: by 2002:a0c:d409:: with SMTP id t9mr6525197qvh.18.1622837050515; Fri, 04 Jun 2021 13:04:10 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v2 1/2] qapi/machine.json: add DEVICE_UNPLUG_ERROR QAPI event Date: Fri, 4 Jun 2021 17:03:52 -0300 Message-Id: <20210604200353.1206897-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604200353.1206897-1-danielhb413@gmail.com> References: <20210604200353.1206897-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::f2f; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: armbru@redhat.com, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au 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" At this moment we only provide one event to report a hotunplug error, MEM_UNPLUG_ERROR. As of Linux kernel 5.12 and QEMU 6.0.0, the pseries machine is now able to report unplug errors for other device types, such as CPUs. Instead of creating a (device_type)_UNPLUG_ERROR for each new device, create a generic DEVICE_UNPLUG_ERROR event that can be used by all unplug errors in the future. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson Reviewed-by: Eric Blake --- qapi/machine.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qapi/machine.json b/qapi/machine.json index 58a9c86b36..f0c7e56be0 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1274,3 +1274,26 @@ ## { 'event': 'MEM_UNPLUG_ERROR', 'data': { 'device': 'str', 'msg': 'str' } } + +## +# @DEVICE_UNPLUG_ERROR: +# +# Emitted when a device hot unplug error occurs. +# +# @device: device name +# +# @msg: Informative message +# +# Since: 6.1 +# +# Example: +# +# <- { "event": "DEVICE_UNPLUG_ERROR" +# "data": { "device": "dimm1", +# "msg": "Memory hotunplug rejected by the guest for device= dimm1" +# }, +# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } } +# +## +{ 'event': 'DEVICE_UNPLUG_ERROR', + 'data': { 'device': 'str', 'msg': 'str' } } --=20 2.31.1 From nobody Sat May 18 12:29:54 2024 Delivered-To: importer@patchew.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=1622837189; cv=none; d=zohomail.com; s=zohoarc; b=BXVfyOi2CypMOcu+UnCQBllX5vgR82ieDCWK4FMPw2VjiZU5kk0Bxg9JGxTCmkFcjDM3IXCH8YQ7AgU+BQnhrs899ncboWQ3XVzkouSSCzFQVs6e+e9qbR4g+q3ODp3351GoBfTpu21NgthKiQG+KsHCZ3oGz4woYyAWWsnMt8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622837189; 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=fubNt4vIGj8rn9Wilds9sxVsuW1S33RuN/p7GDbl1JU=; b=SLc4pyhc6BUeHVSwSEmBBLDc/ChkBVp/du7uW5svRPl6dnfmmdPwOzU/uqctUp/rqduDfPribs7BYsn6ubmFltpccuhv0rcdmCaBwVGL3Xhp5ygUc6us5Xorg31mJyCjBl/DwgjmzEI0pbKG5IWsBMTfecplfYxuY25i0NvPAoI= 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 1622837189113401.6570041784287; Fri, 4 Jun 2021 13:06:29 -0700 (PDT) Received: from localhost ([::1]:38018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpG5K-0008Fd-5P for importer@patchew.org; Fri, 04 Jun 2021 16:06:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpG3D-0005EE-Tf; Fri, 04 Jun 2021 16:04:15 -0400 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]:38555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpG3C-0000Sq-6w; Fri, 04 Jun 2021 16:04:15 -0400 Received: by mail-qv1-xf32.google.com with SMTP id d7so3311418qvo.5; Fri, 04 Jun 2021 13:04:13 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c6:b390:9cad:b272:426b:6a0]) by smtp.gmail.com with ESMTPSA id f19sm4765011qkg.70.2021.06.04.13.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 13:04:12 -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=fubNt4vIGj8rn9Wilds9sxVsuW1S33RuN/p7GDbl1JU=; b=poDRT9ewH457boxorUmkxofj50gLl6Z4YaSJi3zQjmQPA3AWyvaa90W8UFDOVt07Dv YcvAPPa3tFyKac/NYkE3BKKKm0gyavccooCekaLLn6egfGFFt2I3Tupp/f+siO8LnGjs PTBth3Rhk9YVOyIAqeqnQ31bj/riQbSfuZlMb3j+06BlCa3P4eCpk3x/tW2jLrkMI5MN Hl95hWV+KZD+GMWrbtu0Tjeb2gkzAeaYfUhATElAHnK0h9tDlNZk0cyNDkK61sg+IVxB u7yZ+VpiWGwTJkk0tH1IroBUVp6HperUbwXPU/bg/ViLwdcjJVjJlccwp+Kj4Ub7Q1rA HvDw== 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=fubNt4vIGj8rn9Wilds9sxVsuW1S33RuN/p7GDbl1JU=; b=XmOt01WWoXzCCjOgmLSqSm0BfRjBLC53QGrrlihXF4hQKll92+LT54OZHcg6+LAV6W SeZfCwKDJZnXNO5VNH/5Uq4C1nlo4QFckpGE+77qsHA1eiz8x+Hn5lR0KRRzkx5TnNyk YWp5hGlq9DCWaEXstAZVTDQTtgdCNkrp/46F3fEl4roKbLao6pao+xekN/wHEHKZEAZW ocUu4IHJqET6FOxBelmHRE394Dfqz02Fcabkr1/9YYM6uNmqKTJBbWPRT8ueUgaPh83f HanZ0Vms2J//E/3sPIbW22bFSTGA/WQoVcl3YS0NXpQEt+JNocCbR3k+iLORu+25/AsS x4sA== X-Gm-Message-State: AOAM530cVdPnvgk+lbIv9yL3BbXOOMB/isbuTiTJ+8SsSt2kEC7i2CPZ TUKY8BqOFMIgQrRmi1ITnA9YyEMO9CnFJg== X-Google-Smtp-Source: ABdhPJwyALJknxoFYdccWORcbCoftQoC/55/IYi7BlSGvCVQt/wbksmy6BJTF5cog/rmGA2Xw/6/0A== X-Received: by 2002:a05:6214:18d0:: with SMTP id cy16mr6507376qvb.29.1622837052852; Fri, 04 Jun 2021 13:04:12 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v2 2/2] spapr: use DEVICE_UNPLUG_ERROR to report unplug errors Date: Fri, 4 Jun 2021 17:03:53 -0300 Message-Id: <20210604200353.1206897-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604200353.1206897-1-danielhb413@gmail.com> References: <20210604200353.1206897-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::f32; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf32.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: armbru@redhat.com, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au 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" Linux Kernel 5.12 is now unisolating CPU DRCs in the device_removal error path, signalling that the hotunplug process wasn't successful. This allow us to send a DEVICE_UNPLUG_ERROR in drc_unisolate_logical() to signal this error to the management layer. We also have another error path in spapr_memory_unplug_rollback() for configured LMB DRCs. Kernels older than 5.13 will not unisolate the LMBs in the hotunplug error path, but it will reconfigure them. Let's send the DEVICE_UNPLUG_ERROR event in that code path as well to cover the case of older kernels. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_drc.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c23bcc4490..29aa2f467d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3639,7 +3639,7 @@ void spapr_memory_unplug_rollback(SpaprMachineState *= spapr, DeviceState *dev) */ qapi_error =3D g_strdup_printf("Memory hotunplug rejected by the guest= " "for device %s", dev->id); - qapi_event_send_mem_unplug_error(dev->id, qapi_error); + qapi_event_send_device_unplug_error(dev->id, qapi_error); } =20 /* Callback to be called during DRC release. */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index a2f2634601..0e1a8733bc 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -17,6 +17,8 @@ #include "hw/ppc/spapr_drc.h" #include "qom/object.h" #include "migration/vmstate.h" +#include "qapi/error.h" +#include "qapi/qapi-events-machine.h" #include "qapi/visitor.h" #include "qemu/error-report.h" #include "hw/ppc/spapr.h" /* for RTAS return codes */ @@ -160,6 +162,10 @@ static uint32_t drc_unisolate_logical(SpaprDrc *drc) * means that the kernel is refusing the removal. */ if (drc->unplug_requested && drc->dev) { + const char qapi_error_fmt[] =3D "Device hotunplug rejected by = the " + "guest for device %s"; + g_autofree char *qapi_error =3D NULL; + if (spapr_drc_type(drc) =3D=3D SPAPR_DR_CONNECTOR_TYPE_LMB) { spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 @@ -167,13 +173,10 @@ static uint32_t drc_unisolate_logical(SpaprDrc *drc) } =20 drc->unplug_requested =3D false; - error_report("Device hotunplug rejected by the guest " - "for device %s", drc->dev->id); + error_report(qapi_error_fmt, drc->dev->id); =20 - /* - * TODO: send a QAPI DEVICE_UNPLUG_ERROR event when - * it is implemented. - */ + qapi_error =3D g_strdup_printf(qapi_error_fmt, drc->dev->id); + qapi_event_send_device_unplug_error(drc->dev->id, qapi_error); } =20 return RTAS_OUT_SUCCESS; /* Nothing to do */ --=20 2.31.1