From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626726339090997.3495694631845; Mon, 19 Jul 2021 13:25:39 -0700 (PDT) Received: from localhost ([::1]:57758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Zpa-0003Lc-5B for importer@patchew.org; Mon, 19 Jul 2021 16:25:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZB-0002zn-Ui; Mon, 19 Jul 2021 16:08:41 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:35822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZA-00024e-Cw; Mon, 19 Jul 2021 16:08:41 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d12so17578476pfj.2; Mon, 19 Jul 2021 13:08:39 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:38 -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=82WS94ROvYpuXPkwrfOvl7UdrcY3ebhz/ICLfEsbpsM=; b=sMhZKr0Xq4xaBbIvpePbe48/46eczovUIg18jL8ks1ft/opAdVO0i8j7Oxi8hlom4V uKN3OFmyyvVENXVF9F4HrxhFfPENrwRpYyyp1QyVyA35vWksI0rEwjVNNhhVg0WU/6Yf fgCA12B6/dCehmoIFnXeSKCMj7TzEuAPBJFvJYaKcR0/R0FUjCR689T3BPoiQpy5zpJ5 0wIGtp8KDz5bkPIHNFs2ivtPCRkwOFGDHtzSyAmrJrlFVqxbx3vtrippvmh3Rd+VVGje AnxeRBLEcsjkkc2DMnLgRWYEwCNV4NoZw9nEE11C1HgKcs0zR9Mw26Un1GCNp1e2KqHm hg0A== 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=82WS94ROvYpuXPkwrfOvl7UdrcY3ebhz/ICLfEsbpsM=; b=QfO0euOdQikkT2tj0PDZfcfDJnqIEHPWM7HNg5T4IpBDKmtw9ohlyQq8NHlYpabQ4E 8QrKj5vBrbVne+R3sm6qjWqbNs4XJDT0bNK7Is53/rMNf1XE5QDI50IxHw1dYz7gR/fZ zmkyBAIyDdGE1R63rQcjuJ8e/OVEfTsZMP/QK9hwfR+DQVzURnzFQVHAst3Lvlr+Nsyd HqHhoUESpyf9JMWuL/SSIask7whhV2Q5u48qBSCdkWYARurhp91n8VzcPKv/5aYXWyXV KkkslZCoZipxqyWdYptRhRTZDiPACAn7runGubqzmF5VJEJ5WzZt68RsB0r5aL/tEfxX 5oFA== X-Gm-Message-State: AOAM530af3Muylt+hu04ZwDcajTwF2PJV3GDnOS4sfvxwcQGNfQvkYMr nQGsHI6OEwRuzDzVaRq5XcfjCtmrth8j5A== X-Google-Smtp-Source: ABdhPJyMcv/a5hQLTcirftNNrNcK4Oy7Z5iukNZ+Rbsy6sZadmW4iHGbdyD2bTs7mhaE2cHc76Y+yw== X-Received: by 2002:a63:c147:: with SMTP id p7mr27260280pgi.415.1626725318777; Mon, 19 Jul 2021 13:08:38 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 1/7] hw/acpi/memory_hotplug.c: avoid sending MEM_UNPLUG_ERROR if dev->id is NULL Date: Mon, 19 Jul 2021 17:08:21 -0300 Message-Id: <20210719200827.1507276-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::42f; envelope-from=danielhb413@gmail.com; helo=mail-pf1-x42f.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) X-ZM-MESSAGEID: 1626726340186100001 Content-Type: text/plain; charset="utf-8" qapi_event_send_mem_unplug_error() deals with @device being NULL by replacing it with an empty string ("") when emitting the event. Aside from the fact that this is a side effect that can be patched someday, there's also the lack of utility that the event brings to listeners, e.g. "a memory unplug error happened somewhere". We're better of not emitting the event if dev->id is NULL. Next patches will introduce a new device unplug error event that is better suited to deal with dev->id NULL scenarios. MEM_UNPLUG_ERROR will continue to be emitted to avoid breaking existing APIs, but it'll be deprecated and removed in the future. Suggested-by: Markus Armbruster Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza --- hw/acpi/memory_hotplug.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index af37889423..e37acb0367 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -177,9 +177,14 @@ static void acpi_memory_hotplug_write(void *opaque, hw= addr addr, uint64_t data, /* call pc-dimm unplug cb */ hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); if (local_err) { + const char *error_pretty =3D error_get_pretty(local_err); + trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); - qapi_event_send_mem_unplug_error(dev->id, - error_get_pretty(local_er= r)); + + if (dev->id) { + qapi_event_send_mem_unplug_error(dev->id, error_pretty= ); + } + error_free(local_err); break; } --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626725481622367.8924925374904; Mon, 19 Jul 2021 13:11:21 -0700 (PDT) Received: from localhost ([::1]:55106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Zbk-0007DY-CO for importer@patchew.org; Mon, 19 Jul 2021 16:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZE-00036i-1R; Mon, 19 Jul 2021 16:08:44 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:34622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZC-00026V-G0; Mon, 19 Jul 2021 16:08:43 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 62so20328592pgf.1; Mon, 19 Jul 2021 13:08:41 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:40 -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=H1Fo0Bc8ezELCqzkwb6OHOVSX3f5A3Fw+Iay/0zsNqg=; b=dVsuMRAD7uf382vjVeUIPCCzecO8E3FezXxzvEdo76qO8ZOGebz0BrENvuwIQfH2x3 w5p6kkKJXTisksLALEg1JMVRTZncYBNiFbY5Loa1V26uoO6NfShew6Ay/U8BwA7YHzBL 9EN/u+rsjGJgh4kVpJNtdeYTPQ3Kgzma/WthBLws8hf/ZAhVxtizxgg9Z1I9BOTKe9AY iAne8ivK3iUQN6e1aXGJqI4wxK83/CCL0xZh4gDHzcQXc9O9MJ+0o8COJYtQJaRwg82f neZqx6fJ3bVLP616YB1oyRBArgnLDGi+0At0/XcS6CjmF5cy7Xq2yxBrnmNgay+B1p9s JThA== 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=H1Fo0Bc8ezELCqzkwb6OHOVSX3f5A3Fw+Iay/0zsNqg=; b=ubrF+BoDfjJCa6OuUaaIRFPppSXhNC3uKUkOhDJNkAzy0fmw2KdeJ0jDEojfuNO0m4 kn4plhwGg4XxFRaBBTTB2573nIEeGQiEQTGJkvsiYpOuUpFcnMYD9YmzRpIumOUedaDm tEAke9YJAugsioOqrgMpLjRSB2lku1M9zL6yLeACqYgj2kFH75as4Wyh43boWr0yXJVS oMvvjiwqbfbkhZCLApGm7u0IGWXviDtAE13dhS3vbIb8U2mAWQOPsnshPeSBJ7pM6iAH O/xkktQH+iJOAAbEp4bFuSyu+/FV8jYInZ40wsnjZKC8nOsxJQ5xiU7/e4SZDQhxbUkm 5UrA== X-Gm-Message-State: AOAM531Y748Vq8jw/Eoc13gBW1UPutdvrDGG6qGwXWccwWblLP+fdyfU zZtM3S7iH2zL+oPRKX6ZXbMXya0keMGxIA== X-Google-Smtp-Source: ABdhPJy4646AzDM8/kHO6djEVAPUOZZ/KDKeth+Ve9Iy4C2Up9EYjIZgYMO/Qh6pb9T7iahjiVxOfw== X-Received: by 2002:a65:6442:: with SMTP id s2mr27033631pgv.420.1626725320784; Mon, 19 Jul 2021 13:08:40 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 2/7] spapr.c: avoid sending MEM_UNPLUG_ERROR if dev->id is NULL Date: Mon, 19 Jul 2021 17:08:22 -0300 Message-Id: <20210719200827.1507276-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::52c; envelope-from=danielhb413@gmail.com; helo=mail-pg1-x52c.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) X-ZM-MESSAGEID: 1626725483374100001 Content-Type: text/plain; charset="utf-8" As done in hw/acpi/memory_hotplug.c, avoid sending qapi_event_send_mem_unplug_error() if dev->id is NULL. Suggested-by: Markus Armbruster Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 81699d4f8b..1611d7ab05 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3688,9 +3688,11 @@ void spapr_memory_unplug_rollback(SpaprMachineState = *spapr, DeviceState *dev) * Tell QAPI that something happened and the memory * hotunplug wasn't successful. */ - 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); + if (dev->id) { + qapi_error =3D g_strdup_printf("Memory hotunplug rejected by the g= uest " + "for device %s", dev->id); + qapi_event_send_mem_unplug_error(dev->id, qapi_error); + } } =20 /* Callback to be called during DRC release. */ --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626726438155183.88243136819813; Mon, 19 Jul 2021 13:27:18 -0700 (PDT) Received: from localhost ([::1]:60628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5ZrB-0005Nw-6n for importer@patchew.org; Mon, 19 Jul 2021 16:27:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZG-0003Ca-Bk; Mon, 19 Jul 2021 16:08:46 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:33326) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZE-00027R-ER; Mon, 19 Jul 2021 16:08:45 -0400 Received: by mail-pj1-x1034.google.com with SMTP id v18-20020a17090ac912b0290173b9578f1cso611153pjt.0; Mon, 19 Jul 2021 13:08:43 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:42 -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=xIbuoN2FUepjNiV0NL9ah+PlC1aFG0Xp8XKvNzH+Amg=; b=Lg+SiETK3mdfjIeQRqcDftSpcyQtH3VB56bmQe71NFkmeoAEYE9+NCuAxNtEASE8cZ GqGcci3IAVG4NvnblGuFY9ukYVRlj81C6VObOaSmDX5QN7b+wel0kw6++MaxhYSm4eE0 yPDIS6CaUURwA8oMkexQmK7XjF87acLqSsKIyvT6ZJJY8WBiNUL+Bad1h18V3S2e261+ MXxwh6W34DsomEVjXzHeX8W//kMod8U83W0IlqVhwfTv+sqCE0An8//OWukyB25SSE24 WamgXDXhy3X8AD/dzZx+Jx7WWL65KduzFoluLK9aTPn6ZxughPPwD94D/dUtQT/mEFYW rs6A== 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=xIbuoN2FUepjNiV0NL9ah+PlC1aFG0Xp8XKvNzH+Amg=; b=WfdHD2zLL5WEOBkOCUiI2F+pB8stROuOq0NhT1jveSqtjDETcTo73zfPirRDAjjqmq Y4mYWjEA5vcgG0L/gNOVVRzkNYoaD+/g7l+tz3rxMdj8zvuW/hGkKiV41LyuJtp4VF8f OV7BksRSeV9cmX8dDAnuZRdWGo5x3+kpfMkQViOVI7jlWGcIeJYtGsndHQShrAI11QpP XJgdABo+ptakm2zm5pXE2bRE9qLs5nV8TiGG5hMeMKvNpDYdWEt4lKY3S6bRMHfkgiTS 57Qs1zj2y9bGIyvURCOXOxk6Bf/NPz/m1U7ZnKulhwQBBNIFekfHrtYEeU4HafNqN6ON 2g3Q== X-Gm-Message-State: AOAM531G1C8DAhPHBvsw05QejqEoHasUBDVG/Y54kJq4CUBaIYfqFt68 fGevTTNHMg4GAMkYBmTls82NAlnfGxMw5g== X-Google-Smtp-Source: ABdhPJxCvknxaSXGwrzmXYAeDSO3ocmiDKjeHI0PhU6+MTy4twK29bVlcpTrDFSvgUJHorkhSW5jvw== X-Received: by 2002:a17:90a:3d0d:: with SMTP id h13mr26776073pjc.20.1626725322796; Mon, 19 Jul 2021 13:08:42 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 3/7] spapr_drc.c: do not error_report() when drc->dev->id == NULL Date: Mon, 19 Jul 2021 17:08:23 -0300 Message-Id: <20210719200827.1507276-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::1034; envelope-from=danielhb413@gmail.com; helo=mail-pj1-x1034.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) X-ZM-MESSAGEID: 1626726440155100021 Content-Type: text/plain; charset="utf-8" The error_report() call in drc_unisolate_logical() is not considering that drc->dev->id can be NULL, and the underlying functions error_report() calls to do its job (vprintf(), g_strdup_printf() ...) has undefined behavior when trying to handle "%s" with NULL arguments. Besides, there is no utility into reporting that an unknown device was rejected by the guest. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Reviewed-by: Markus Armbruster --- hw/ppc/spapr_drc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index a2f2634601..a4d9496f76 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -167,8 +167,11 @@ 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); + + if (drc->dev->id) { + error_report("Device hotunplug rejected by the guest " + "for device %s", drc->dev->id); + } =20 /* * TODO: send a QAPI DEVICE_UNPLUG_ERROR event when --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626726504840152.66616548144236; Mon, 19 Jul 2021 13:28:24 -0700 (PDT) Received: from localhost ([::1]:35104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5ZsF-0007BB-K1 for importer@patchew.org; Mon, 19 Jul 2021 16:28:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZI-0003I5-5m; Mon, 19 Jul 2021 16:08:49 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:33328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZG-00028n-Kb; Mon, 19 Jul 2021 16:08:47 -0400 Received: by mail-pj1-x1036.google.com with SMTP id v18-20020a17090ac912b0290173b9578f1cso611210pjt.0; Mon, 19 Jul 2021 13:08:45 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:44 -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=XM8C4CfVhCFjkQvZK0knProzft3GXcv1cOpNW2wiPCg=; b=s9AwxB/Qc1B8brtNYobkly1nXRMeghC9SQV5ouSr8csBdYQy/zh002CJosPfSlv3RV DKtP7iWquc1dWuzOwGvaPKHYX9EdYICN4qfHMyFs11jL/OIQwehz34cHFHmai5CXjzel b/kbNR20eFODWyGW7cqMQD9jYQIqLiyCgeO588vFwV1y9uITFEVE4Li8Q1yN08t1cnha SGWR3C/thqpTT1B7w0IHiqqCP+Ni1VBgDkPZpCLfnscjSrrZbgldJ/74vG8xOoC7MTZn lvhjH1a+L1yZ/80cJ9GfwYeTXSG03tWlkxvB/konstAlfCT86/O2o2hKem86YaR8YBRZ VrBA== 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=XM8C4CfVhCFjkQvZK0knProzft3GXcv1cOpNW2wiPCg=; b=hlPaPeBvewTUy943ufk8+y53LkgP6OSYYDtzItfN8Ff7HbJX1Z3JzPtvpQKqdZfd1U gWrkF6Oqw/P5JkT+sJkc6bCefGzuzln7idwuRPd/vzPP4bHzqYsIGJYSUQlx3pnVZdWu E1UtlPaaZIaojcugouGgvKHN9DBw9AHrxI9Rp9UVFfnGyqH48IGm3Z3FGG9qZw4bBypi nc/ujpl5MmdESrrrwoaWT0ZRdQoP8Fd3CqHwBc1ahbz0tF0rERHWFrDhfPfEOguqUiRv wuw35JRAeGkZLQaWZPJRBRNRmRO/WDrwcvU1CkE4uNu16pKNIe4jCY+bzBL25YNoOy1K Besw== X-Gm-Message-State: AOAM530Dfg0zBGiDVHcKUH7UZt/vmy2S9lTY2WnlOlG9HHtRFGTjUZXn z63Uk4pkw2pSUdqkcQDziS+lTrREhXNeYw== X-Google-Smtp-Source: ABdhPJzpn8QW+GZcrtdvlhkfdReBJvEds2HVzp3rVUoD7kXXfsfoabGdS9R8bKnBfBWnO0kSxd7VjQ== X-Received: by 2002:a17:90a:f0cf:: with SMTP id fa15mr26258246pjb.83.1626725324837; Mon, 19 Jul 2021 13:08:44 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 4/7] qapi/qdev.json: fix DEVICE_DELETED parameters doc Date: Mon, 19 Jul 2021 17:08:24 -0300 Message-Id: <20210719200827.1507276-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::1036; envelope-from=danielhb413@gmail.com; helo=mail-pj1-x1036.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) X-ZM-MESSAGEID: 1626726505458100001 Content-Type: text/plain; charset="utf-8" Clarify that @device is optional and that 'path' is the device path from QOM. This change follows Markus' suggestion verbatim, provided in full context here: https://lists.gnu.org/archive/html/qemu-devel/2021-07/msg01891.html Suggested-by: Markus Armbruster Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Reviewed-by: Markus Armbruster --- qapi/qdev.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qapi/qdev.json b/qapi/qdev.json index b83178220b..d1d3681a50 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -108,9 +108,9 @@ # At this point, it's safe to reuse the specified device ID. Device remova= l can # be initiated by the guest or by HMP/QMP commands. # -# @device: device name +# @device: the device's ID if it has one # -# @path: device path +# @path: the device's path within the object model # # Since: 1.5 # --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626725603609775.5511277598046; Mon, 19 Jul 2021 13:13:23 -0700 (PDT) Received: from localhost ([::1]:60900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Zdi-0002qV-K6 for importer@patchew.org; Mon, 19 Jul 2021 16:13:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZL-0003Kp-PF; Mon, 19 Jul 2021 16:08:51 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:41674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZK-0002Af-38; Mon, 19 Jul 2021 16:08:51 -0400 Received: by mail-pj1-x102f.google.com with SMTP id jx7-20020a17090b46c7b02901757deaf2c8so948719pjb.0; Mon, 19 Jul 2021 13:08:48 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:46 -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=LRTyJX79s/HDaNt8NBw5GvLa+nVW9LgMXvditrXvD6U=; b=k354Lz7qQoZpKdp37z8n6d2nXjsHnCwW0ZZh0xmapslvTNY1SpD+FViVUhlIYydSFm VaHZoboK4bSCeDb6s5iSB/A1pp5Lmigo3hRRQvr3ACjH3qVJysFc0XKZqABlxh9O69Cf sgdKUG7SpUxKap7SImf9It06BfuKg5pxkIe/kDWgZe4Vxu7ARMhxj93xQv1q2lZcIiMP JoNe3ZlRuJl7CQNsNHeJUUbGmrH1VrVQHQJ+s/PcpYXKPetSukN9BxhTOi/ok4XvR8Jm aEdPq5bp/b/Slm61RVqmNW0i17IBkY4FctMPJ7b/XyU5NETCJ55e8fBUsztJAhcrT/Bk Ufvw== 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=LRTyJX79s/HDaNt8NBw5GvLa+nVW9LgMXvditrXvD6U=; b=HV+93Lm8HpCxRVV8FlWD0iUNmqjThLGhEAYHYAh0wmHkOwOlIMCLzCCNvT20SLcmom e7vt4Y/MbEhYmedcIYmfKZaAdmE/I7b+PjFdPw6xJzRqhx4Fvd+3iTrghEdLAMmQTqJp YqR32qLlUqeBCpejBR1QShzB0o+70LdNbMgwApr1pm/b9LCfInQLwJzgUAPxUmM8+mQb UT1sl5StuiZKNpkR0VFoZOoTAPOKCwUEQHM28pxUK3Yhy6NN2Oi44MYZVvj5ZzhIY1ZI iGJalu6DFB7O8KVrQ1UVx+k3a51CpL2OGJKdbq6sGe2BbiIbyOS4BctS4yLx3EDH3VFW WlPg== X-Gm-Message-State: AOAM531aJu7cKlRcLRAb6Ywz9QNRPGXhJc6Rj8iI0AW91eM/oF9n3Ypq hjiJJpCZVJLf/BGdDi5zVP6VC/eMv41TNw== X-Google-Smtp-Source: ABdhPJw5AHVCRSq/uWyv5knnUv7znE/DIZekp5mQbqfyKZVirSkyENLFmbsgQ5FEWWM3Vs4PkzWMtQ== X-Received: by 2002:a17:90a:6c03:: with SMTP id x3mr12382661pjj.195.1626725326959; Mon, 19 Jul 2021 13:08:46 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 5/7] qapi/qdev.json: add DEVICE_UNPLUG_ERROR QAPI event Date: Mon, 19 Jul 2021 17:08:25 -0300 Message-Id: <20210719200827.1507276-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::102f; envelope-from=danielhb413@gmail.com; helo=mail-pj1-x102f.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) X-ZM-MESSAGEID: 1626725604619100001 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. This event has a similar API as the existing DEVICE_DELETED event, with an extra optional 'msg' parameter that can be used to explain the reason for the error. With this new generic event, MEM_UNPLUG_ERROR is now marked as deprecated. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Reviewed-by: Markus Armbruster --- docs/about/deprecated.rst | 10 ++++++++++ qapi/machine.json | 6 +++++- qapi/qdev.json | 30 +++++++++++++++++++++++++++++- stubs/qdev.c | 7 +++++++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 6d438f1c8d..c0c3431ada 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -204,6 +204,16 @@ The ``I7200`` guest CPU relies on the nanoMIPS ISA, wh= ich is deprecated (the ISA has never been upstreamed to a compiler toolchain). Therefore this CPU is also deprecated. =20 + +QEMU API (QAPI) events +---------------------- + +``MEM_UNPLUG_ERROR`` (since 6.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use the more generic event ``DEVICE_UNPLUG_ERROR`` instead. + + System emulator machines ------------------------ =20 diff --git a/qapi/machine.json b/qapi/machine.json index c3210ee1fb..a595c753d2 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1271,6 +1271,9 @@ # # @msg: Informative message # +# Features: +# @deprecated: This event is deprecated. Use @DEVICE_UNPLUG_ERROR instead. +# # Since: 2.4 # # Example: @@ -1283,7 +1286,8 @@ # ## { 'event': 'MEM_UNPLUG_ERROR', - 'data': { 'device': 'str', 'msg': 'str' } } + 'data': { 'device': 'str', 'msg': 'str' }, + 'features': ['deprecated'] } =20 ## # @SMPConfiguration: diff --git a/qapi/qdev.json b/qapi/qdev.json index d1d3681a50..52c36c7b9c 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -84,7 +84,9 @@ # This command merely requests that the guest begin the hot removal # process. Completion of the device removal process is signaled wi= th a # DEVICE_DELETED event. Guest reset will automatically complete rem= oval -# for all devices. +# for all devices. If an error in the hot removal process is detec= ted, +# the device will not be removed and a DEVICE_UNPLUG_ERROR event is +# sent. Some errors cannot be detected. # # Since: 0.14 # @@ -124,3 +126,29 @@ ## { 'event': 'DEVICE_DELETED', 'data': { '*device': 'str', 'path': 'str' } } + +## +# @DEVICE_UNPLUG_ERROR: +# +# Emitted when a device hot unplug error occurs. +# +# @device: the device's ID if it has one +# +# @path: the device's path within the object model +# +# @msg: optional informative message +# +# Since: 6.2 +# +# Example: +# +# <- { "event": "DEVICE_UNPLUG_ERROR" +# "data": { "device": "core1", +# "msg": "Device hotunplug rejected by the guest for device= core1", +# "path": "/machine/peripheral/core1" }, +# }, +# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } } +# +## +{ 'event': 'DEVICE_UNPLUG_ERROR', + 'data': { '*device': 'str', 'path': 'str' , '*msg': 'str' } } diff --git a/stubs/qdev.c b/stubs/qdev.c index 92e6143134..ffa8f7b59e 100644 --- a/stubs/qdev.c +++ b/stubs/qdev.c @@ -21,3 +21,10 @@ void qapi_event_send_device_deleted(bool has_device, { /* Nothing to do. */ } + +void qapi_event_send_device_unplug_error(bool has_device, const char *devi= ce, + const char *path, + bool has_msg, const char *msg) +{ + /* Nothing to do. */ +} --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162672569230032.410305288883364; Mon, 19 Jul 2021 13:14:52 -0700 (PDT) Received: from localhost ([::1]:37040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Zf8-0005ot-UD for importer@patchew.org; Mon, 19 Jul 2021 16:14:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZM-0003LP-A1; Mon, 19 Jul 2021 16:08:53 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:39533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZK-0002BX-NG; Mon, 19 Jul 2021 16:08:52 -0400 Received: by mail-pl1-x634.google.com with SMTP id h1so10229843plf.6; Mon, 19 Jul 2021 13:08:50 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:48 -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=62SxB/Y5GLnooLju9cY8JXwkylFdSgOJQm9ZtyOv8tQ=; b=iPs3zZWVraaii0VADc6OJeCu6j/saDOC7UT+D7saMvK1+Y8VIOTlgQ1hNk4AWHa6iR jtHg+Zi+2+C3OS/N0CRvKm0KdJiTjQPOsYdXxDErAiiqv2ozxpMalbYJRuLKt1ZTZ7S0 p4m9RiqrmvtxjrQE2uRnJKwbyY4rqgsKgVaTWcrKuw47REylqlaZVN3nZe4XE9DtJwY2 h4D67ju32K4+NpuFvxsDZOy25LgemLGKRA8LcEDqNSPPmLVJA+fdQd14noJtY1oedqQN UnW4c8875eSQ+3zmcmBIbsDtiNivCnbMzi2y9855pBTmQOjTBc2VNGSpSq8aNSJYZzAC pLuQ== 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=62SxB/Y5GLnooLju9cY8JXwkylFdSgOJQm9ZtyOv8tQ=; b=HNMl7m4Z5DyGfRlO2eKigNopT6HQIrSQ/KHFU07gj860YfljozQ/X2/QHOKFBXq09d 0/aoNVRVGI0BL56taAkHwDMYJcsXqjVbyzv/wznwAlRujFByBIgJ0nMvhJeLjOutX5lJ gE2I09NVKV35c00EtfpAkkk1nhdt7rTPLAy63VtS9xr3vioiUiZ3+IuhFeig4UpRUiIx Ntzbu2NSA4iHNv2LYUkkTs2YdBy9vWFA4hVxnvi2Kh4wOjXhB6qSMo3zlgnqWWP1j4bM jJjkg0vW8zSNjE7doJdoflg3eflUIPVKeHsJ8jaY+N7WvdfmAtekd3AnjUQQNF/mkj6r nHLA== X-Gm-Message-State: AOAM5304i4Z0/pW6E+sFsRWC8pCnsDNXktBJoqDcPkFpG4cnIHHSXmij iT5xjwADMPHT4jqVn9WKvV/1Uo4yIr5/Bw== X-Google-Smtp-Source: ABdhPJze1BYQMeQiZ/HdQI+l4RFP2KnfBvRnN2H0zrBPhg5nq7LXuj/DrI3DPmEufiOddK6gM/C+RQ== X-Received: by 2002:a17:90b:1215:: with SMTP id gl21mr23730295pjb.73.1626725329039; Mon, 19 Jul 2021 13:08:49 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 6/7] spapr: use DEVICE_UNPLUG_ERROR to report unplug errors Date: Mon, 19 Jul 2021 17:08:26 -0300 Message-Id: <20210719200827.1507276-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::634; envelope-from=danielhb413@gmail.com; helo=mail-pl1-x634.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) X-ZM-MESSAGEID: 1626725693880100001 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. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 9 ++++++++- hw/ppc/spapr_drc.c | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 1611d7ab05..5459f9a7e9 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -29,6 +29,7 @@ #include "qemu/datadir.h" #include "qapi/error.h" #include "qapi/qapi-events-machine.h" +#include "qapi/qapi-events-qdev.h" #include "qapi/visitor.h" #include "sysemu/sysemu.h" #include "sysemu/hostmem.h" @@ -3686,13 +3687,19 @@ void spapr_memory_unplug_rollback(SpaprMachineState= *spapr, DeviceState *dev) =20 /* * Tell QAPI that something happened and the memory - * hotunplug wasn't successful. + * hotunplug wasn't successful. Keep sending + * MEM_UNPLUG_ERROR even while sending DEVICE_UNPLUG_ERROR + * until the deprecation MEM_UNPLUG_ERROR is due. */ if (dev->id) { qapi_error =3D g_strdup_printf("Memory hotunplug rejected by the g= uest " "for device %s", dev->id); qapi_event_send_mem_unplug_error(dev->id, qapi_error); } + + qapi_event_send_device_unplug_error(!!dev->id, dev->id, + dev->canonical_path, + qapi_error !=3D NULL, 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 a4d9496f76..8f0479631f 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-qdev.h" #include "qapi/visitor.h" #include "qemu/error-report.h" #include "hw/ppc/spapr.h" /* for RTAS return codes */ @@ -160,6 +162,11 @@ 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 @@ -169,14 +176,13 @@ static uint32_t drc_unisolate_logical(SpaprDrc *drc) drc->unplug_requested =3D false; =20 if (drc->dev->id) { - error_report("Device hotunplug rejected by the guest " - "for device %s", drc->dev->id); + qapi_error =3D g_strdup_printf(qapi_error_fmt, drc->dev->i= d); + error_report(qapi_error_fmt, drc->dev->id); } =20 - /* - * TODO: send a QAPI DEVICE_UNPLUG_ERROR event when - * it is implemented. - */ + qapi_event_send_device_unplug_error(!!drc->dev->id, drc->dev->= id, + drc->dev->canonical_path, + qapi_error !=3D NULL, qapi= _error); } =20 return RTAS_OUT_SUCCESS; /* Nothing to do */ --=20 2.31.1 From nobody Fri May 17 03:12: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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626726584787591.6907696206066; Mon, 19 Jul 2021 13:29:44 -0700 (PDT) Received: from localhost ([::1]:38216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5ZtX-0000pY-QO for importer@patchew.org; Mon, 19 Jul 2021 16:29:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZZP-0003NM-40; Mon, 19 Jul 2021 16:08:57 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:45045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ZZN-0002DY-4y; Mon, 19 Jul 2021 16:08:54 -0400 Received: by mail-pg1-x52f.google.com with SMTP id u14so20275819pga.11; Mon, 19 Jul 2021 13:08:52 -0700 (PDT) Received: from rekt.ihost.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id e18sm21048805pfc.85.2021.07.19.13.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:08:51 -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=TrRUTkNlv6TQBWvTHUOv1v5ykVtwiJjVIPGxE+TtQHI=; b=K80iC/0zIH3BD0XggBwtD0AyHOLcmLIjBW2jo2QryvNQYLG/Saf7DT7VRdZXhJuqIM BK471I+sxvTsQQcX9Qe8VfT9pPscvST3QW84N5xWWxolXw1tbTsMAdjD0sAHnS7Q24P6 y9fl/c/pXzZmjIFs8BKHuIl7eoPgy1SWs8zo0N3hsf99GTcNdryJ6jTHDX5ELA7Z2IyE DrXM9aF1fQTGhmofrHyjJQ6kSQOBaBV1GYg7NNts1xMPA9TRuVcbRpRUOVTHpmVzjdK/ 3i3vRJuZ5d7dDtIwUCCL8IMJzCYnoZGquS20XYQNG6+WxWlhoF23sCdlBQF/0AGFBlrO fjag== 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=TrRUTkNlv6TQBWvTHUOv1v5ykVtwiJjVIPGxE+TtQHI=; b=BQBjGlS9hg71A9I8KNB3rlmVea9Vp2gIP705WMLmO4f+JOEz9SLGJXhGUHRAIHKzqs 00Igjlqo2sKCsuwXh5Z2HAZhS7EnM8mc0DXizSZB5IQNquYCdVI4+TBzmOBYGN8gbJBh ZqpJazw6mS0os7keh8UE87j1G0232jrbKs2G5h0/IunX54SCQivpVdtn4vYUrJhB8VGn reo12NUkUGdOHezP1Ec86/VvfmI0tgCWzET7hFx+325iZ4Q8/rCwHThotfl0SHGZ3s6A xD2ssGMcmw+GLSMfjisOdSX8m0w1wF6cxQjNxhIDqAG6cUsUKwcAFox9dZZ5qH1ChDhf 1fsg== X-Gm-Message-State: AOAM530LadXzlQVl2QV64rUaHYzX/49aJ2ZzvbRUUC2rGMLBGBqNSAi4 U1G3l+RCGx7W3Wk/g0uub+h6IaWagUhNqA== X-Google-Smtp-Source: ABdhPJwa7b2oULhcnVzLApaxV3ZG564yoedRSrgKH6+upJzZ4WFprqkTmwQxl90+ZVXsErnrpcaT1A== X-Received: by 2002:a62:ee0f:0:b029:335:a681:34f6 with SMTP id e15-20020a62ee0f0000b0290335a68134f6mr20108471pfi.55.1626725331512; Mon, 19 Jul 2021 13:08:51 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 v6 7/7] memory_hotplug.c: send DEVICE_UNPLUG_ERROR in acpi_memory_hotplug_write() Date: Mon, 19 Jul 2021 17:08:27 -0300 Message-Id: <20210719200827.1507276-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719200827.1507276-1-danielhb413@gmail.com> References: <20210719200827.1507276-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::52f; envelope-from=danielhb413@gmail.com; helo=mail-pg1-x52f.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: "Michael S . Tsirkin" , Daniel Henrique Barboza , armbru@redhat.com, groug@kaod.org, qemu-ppc@nongnu.org, Igor Mammedov , 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) X-ZM-MESSAGEID: 1626726585857100001 Content-Type: text/plain; charset="utf-8" MEM_UNPLUG_ERROR is deprecated since the introduction of DEVICE_UNPLUG_ERROR. Keep emitting both while the deprecation of MEM_UNPLUG_ERROR is pending. CC: Michael S. Tsirkin CC: Igor Mammedov Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Acked-by: Michael S. Tsirkin Reviewed-by: Markus Armbruster --- hw/acpi/memory_hotplug.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index e37acb0367..a0772fe083 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -8,6 +8,7 @@ #include "qapi/error.h" #include "qapi/qapi-events-acpi.h" #include "qapi/qapi-events-machine.h" +#include "qapi/qapi-events-qdev.h" =20 #define MEMORY_SLOTS_NUMBER "MDNR" #define MEMORY_HOTPLUG_IO_REGION "HPMR" @@ -181,10 +182,19 @@ static void acpi_memory_hotplug_write(void *opaque, h= waddr addr, uint64_t data, =20 trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); =20 + /* + * Send both MEM_UNPLUG_ERROR and DEVICE_UNPLUG_ERROR + * while the deprecation of MEM_UNPLUG_ERROR is + * pending. + */ if (dev->id) { qapi_event_send_mem_unplug_error(dev->id, error_pretty= ); } =20 + qapi_event_send_device_unplug_error(!!dev->id, dev->id, + dev->canonical_path, + true, error_pretty); + error_free(local_err); break; } --=20 2.31.1