From nobody Sun Apr 28 23:29:49 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 1629852641672970.0979173291119; Tue, 24 Aug 2021 17:50:41 -0700 (PDT) Received: from localhost ([::1]:34948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIh7o-0004ID-Az for importer@patchew.org; Tue, 24 Aug 2021 20:50:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6C-0001ZK-Jb; Tue, 24 Aug 2021 20:49:00 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:42829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6B-0006vu-50; Tue, 24 Aug 2021 20:49:00 -0400 Received: by mail-qk1-x72a.google.com with SMTP id t4so10959853qkb.9; Tue, 24 Aug 2021 17:48:58 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:48:57 -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=OYzSxiPLqYYDJju9oYHrYm0nV1on+EwDLiSYp/IyZ5w=; b=roJd5tanoKsi+eP6/Und0kjWtPA/7jeaVnBxZGh+m+r98MXucKHpXewdJbYBNbdhuj NtdsyU9qzNVpSO+TW7dAJPHiOpqhv711BSdXqUNDLEtO4jNBloeaSlmxjeWioAfRHXRb 4B+pBmpwSk/vXwYXApVgamsQQNVhkoz0zkiazI4Xx9PjBsGN7L6yvsUh3V/OyENl2+Lv qSXPtjJI2q60/8epoYNKIcRGSOCSz1lpEk9IkS+MIJnNiReg7Fby48zaUPhdx18H1w0X 6JdKzjAopDKjUie7/2HCSSFEyqMna2RN0qy5FsZqKvMV8PeUeIyPnjTI+keeabfIjAQ1 wOCw== 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=OYzSxiPLqYYDJju9oYHrYm0nV1on+EwDLiSYp/IyZ5w=; b=d6Ukb/6F0ANUho8ihBvQxY9Z7jzL+U0A93bbzCzpGU1xvQd2CJd/6oWkNL+2Kma2aj F/pi44QOEwAuR2bAjeYEADIazIoojdDDPWUb9l1o6lGE2ATQC7nA4uosEaOZ37LHvnWi RFzhahv1mVg0sT+Rg9x1DWUft3ltyVKACR9wfpKZNK2H3j/6hgn7lRZnszbxThXFuTnQ EahGZC6Ziezf351gVXut/KZdRz7/m8XXPFgHqhnV5BB7SJ80ERyyjkj1J5AQ+trtCh6Y Hrl0GXGEXKQOZ8R/W5d0+3hiO5GFzNrGTCWk73i5qBk8OLd0f2rJnn/NC0XvkqqsPxM5 NuMw== X-Gm-Message-State: AOAM533oJTsvq+Ro1wGOW6DudDJvDjeh+BWrLmca45+oY1eH5Hg6TNt2 kIjd608CsyAze7YacoRApBfFGLQuT1Q= X-Google-Smtp-Source: ABdhPJxP6S8tgzt5ATUDexob3lCtmYDCYQoEWiyTV5fpCO9yG6dIk7iWK1d86JLxQS+e6DZ7RwLDWA== X-Received: by 2002:ae9:ed53:: with SMTP id c80mr29978480qkg.402.1629852537859; Tue, 24 Aug 2021 17:48:57 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 1/7] memory_hotplug.c: handle dev->id = NULL in acpi_memory_hotplug_write() Date: Tue, 24 Aug 2021 21:48:29 -0300 Message-Id: <20210825004835.472919-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::72a; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x72a.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: 1629852642858100001 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 behavior (qapi visitor mapping NULL pointer to "") can be patched/changed someday, there's also the lack of utility that the event brings to listeners, e.g. "a memory unplug error happened somewhere". In theory we should just avoit emitting this event at all if dev->id is NULL, but this would be an incompatible change to existing guests. Instead, let's make the forementioned behavior explicit: if dev->id is NULL, pass an empty string to qapi_event_send_mem_unplug_error(). Suggested-by: Markus Armbruster Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Igor Mammedov Reviewed-by: Markus Armbruster --- hw/acpi/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index af37889423..6a71de408b 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -178,7 +178,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwa= ddr addr, uint64_t data, hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); if (local_err) { trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); - qapi_event_send_mem_unplug_error(dev->id, + qapi_event_send_mem_unplug_error(dev->id ? : "", error_get_pretty(local_er= r)); error_free(local_err); break; --=20 2.31.1 From nobody Sun Apr 28 23:29:49 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 1629852776729878.2105190339663; Tue, 24 Aug 2021 17:52:56 -0700 (PDT) Received: from localhost ([::1]:41890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIh9z-0000X6-PC for importer@patchew.org; Tue, 24 Aug 2021 20:52:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6G-0001cV-2Z; Tue, 24 Aug 2021 20:49:05 -0400 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]:33675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6E-0006xi-1P; Tue, 24 Aug 2021 20:49:03 -0400 Received: by mail-qv1-xf2b.google.com with SMTP id a5so4710809qvq.0; Tue, 24 Aug 2021 17:49:01 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:00 -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=T5goQIXIwtMNfeSBsrGH+6jpx4dotCpOid1Vqn34LKQ=; b=VwEmMuiFb1OkzCaVA/XUPkwP+hoCyTkDcgYR9CoMsJmW/SKIpuykowCy5csG5Wmgxp m7I9942rbkT2S2ctxClqkBQaaiKvh4eP3NP0n8l8KYbiPHT7ZJNkEl6mDvImFvs7p0DB oKtSpgqGLFQqQgGgW8yApqggFu5rhtBbM3A7vNiJDm7Jr/UEtosxtBg6qjwDZRQh+npN yIuuaUCZT72CoKRscD0BLS5CUiBIQIdHiS/zvYUDOmsnV19Pccf61K3cEUreLE5QseY9 /EHXn5UVBjVlQhbdiLAYw33qZLOQr3sS9Mbmx0VFzYie1wHue9f3ol/aG2/OlGQJrq9M qgoQ== 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=T5goQIXIwtMNfeSBsrGH+6jpx4dotCpOid1Vqn34LKQ=; b=lEcfT0OyzhFSVYSDiUWx8eAx+QYut+xFF/JoHBvvUY9wHo9DgdLIp0cjjyRgDviwne MjILUSgSk6Tbau8o3d5szLFbhMNfqrDmUE107epqG3KXG17NP9cb95u0XzTC0/rSiNuR Sk3ZdN+U11ewpVEuvRVky919ehkxaWuG+95PPZJPoMqueobKsM4NRScvRoAn7TbbAPTf aVVgU0EZqecrJBapgTe4UWunRxbw+GzDPjWYwIjkuaLQDggGnC7B9cq8GasF3yiCicLd FfGHnRAyXi8yC1bM4WcKXcdznnDsjZhSQLifZQ8OQ0BSZaSPt5Wvn28Ggkd6vdLS5/VW iHNA== X-Gm-Message-State: AOAM531KKxF0H8jQEvTiKIQhMHOkdZNwQ/U8Q/dW4X0XsogH4tDvvz07 Ln2KZWMkG8UWkCb4HijlD0Owj7AZx0M= X-Google-Smtp-Source: ABdhPJxgsdt9tFc7VwON4QYimYAOqG3u9NYsn54BLIGmXHDiBY8e4njL4YTj/jXXYFDwiei6E5w9nA== X-Received: by 2002:a0c:e5ce:: with SMTP id u14mr17902818qvm.15.1629852540579; Tue, 24 Aug 2021 17:49:00 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 2/7] spapr.c: handle dev->id in spapr_memory_unplug_rollback() Date: Tue, 24 Aug 2021 21:48:30 -0300 Message-Id: <20210825004835.472919-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::f2b; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2b.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: 1629852777626100001 Content-Type: text/plain; charset="utf-8" As done in hw/acpi/memory_hotplug.c, pass an empty string if dev->id is NULL to qapi_event_send_mem_unplug_error() to avoid relying on a behavior that can be changed in the future. Suggested-by: Markus Armbruster Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Markus Armbruster --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 81699d4f8b..4f1ee90e9e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3690,7 +3690,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_mem_unplug_error(dev->id ? : "", qapi_error); } =20 /* Callback to be called during DRC release. */ --=20 2.31.1 From nobody Sun Apr 28 23:29:49 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 1629852657356873.0497412865234; Tue, 24 Aug 2021 17:50:57 -0700 (PDT) Received: from localhost ([::1]:36404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIh84-0005G7-AF for importer@patchew.org; Tue, 24 Aug 2021 20:50:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6H-0001cZ-KN; Tue, 24 Aug 2021 20:49:05 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:36785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6G-0006zG-8W; Tue, 24 Aug 2021 20:49:05 -0400 Received: by mail-qt1-x82d.google.com with SMTP id t32so3195989qtc.3; Tue, 24 Aug 2021 17:49:03 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:02 -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=jCpu7i6IKjzlWeVa/RvnCa9y/V1BQb3hcKrGSlD9n/E=; b=Gy6DaMAm5R0626UJwOKkoAZyvskYS+5ibh9LzjJPpmVCMFRASZRHQWvgp0bxyEaZVN 6aFHBJ/CzETKAEjW2V9SsMzhE458qvAwS/kb5jqmMuQU1otNHDWXhE8BgKn43EhEi9DO fc3obw1UJPUEeXPMMgM5jpIC7aa/mkH9NoLaFkF2SYWG1eTsvFbpgKvMKFw0BfEehrb+ unCBY+TS7CBXY9SHTX5/56cyfIibr6modQiiUujM0qmC9Xnqpy34OhYSFrxD8laRDE1B YAvy/J/vWJO1rAkkt/y1K0oQZSYcfMKw00dxwwemjUbyTixSoSIY/Xw7umWn1ic4S05v gkeA== 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=jCpu7i6IKjzlWeVa/RvnCa9y/V1BQb3hcKrGSlD9n/E=; b=Opgf/2sZRTceWAjJWPdJ9pgstkLNMzDinoNqK5OkE7Xy9i5D489+fjWhcGZOsAP2qZ kxf+urkjwNRsTXCA0PxruR0QiUhRUydt0dAGZoC8v3uG3VQJ7Vj79F6aqY4ziPLU+CIe p9qdEu5RyGk1sD3oWsQabqf14yFMG0tuVRxMUlAUKvewM5LIS2Nka5aJCZ+mP+HLjdKb b5Rqhei65q529GaEIov7LhzdSsxNYPRGwR8YWiEr7V/6oVyGYFkt5Obwd5O62rUbkryx SuZagCDSQ3ng5IFQ8Xc7LvZZ+ICf7l5IVXhEgX65RrnQxY7IDFJvTBS6/xpAESm4ON5R dMYw== X-Gm-Message-State: AOAM530ASy6baeWOMW/g3F85iK/nUyYb03OMAdwhVbgcXaxfyhMug9MQ XqWs3X4bVz/1JNdRgBEMjGNa8OFRXFc= X-Google-Smtp-Source: ABdhPJzyEL5B12BUSZCAceMBksmfO30ap9o5AclKfyx4jqqIUF2jpHtaQUISRzhQ7j7I10megKloQg== X-Received: by 2002:a05:622a:1486:: with SMTP id t6mr36579032qtx.47.1629852542875; Tue, 24 Aug 2021 17:49:02 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 3/7] spapr_drc.c: do not error_report() when drc->dev->id == NULL Date: Tue, 24 Aug 2021 21:48:31 -0300 Message-Id: <20210825004835.472919-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::82d; envelope-from=danielhb413@gmail.com; helo=mail-qt1-x82d.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: 1629852659489100001 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 Reviewed-by: Markus Armbruster Signed-off-by: Daniel Henrique Barboza --- 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 Sun Apr 28 23:29:49 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 1629852653975181.56750329454587; Tue, 24 Aug 2021 17:50:53 -0700 (PDT) Received: from localhost ([::1]:36212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIh81-00058T-09 for importer@patchew.org; Tue, 24 Aug 2021 20:50:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6J-0001ib-UB; Tue, 24 Aug 2021 20:49:08 -0400 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:41631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6I-00070u-ED; Tue, 24 Aug 2021 20:49:07 -0400 Received: by mail-qv1-xf2e.google.com with SMTP id f7so12795074qvt.8; Tue, 24 Aug 2021 17:49:05 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:04 -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=qeMLTSi39amyjZHiwN3uxS/ebc+t/GAWOPBEMdDY/r0=; b=darMlOGLg0r+UATfy7wIYY5vRxKkqOGpGPNUcV0EuKfCOMzQzxlwZ3Hhthyk7hXdj3 SJqkYtOGLZ7a0+t8QmBeD6SfQk5dU2YFGRzTWjm7DhBX8/tTFfnJVZpqsHIGM+qjsKN9 NfHz7/ACB62hccK+yYckf8Fp6Z+Z13LX6ExtkVfN2nQgs0qeWD4Zp+H5E3lhgeoVQvgM TfS3faUa8s0ePO27XSROvvti0+Q9FWuVtNRQ4Wmcg6YPSL3JryDZjFH0fVc5SmdBtqzE kUMgZTMiSUShKbI+x4WxNLeGGTsH2DNtoAbogNQny5NJsygDuADtb7p+DiMNV9Cz5UB2 Q/Qg== 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=qeMLTSi39amyjZHiwN3uxS/ebc+t/GAWOPBEMdDY/r0=; b=CHuGMCHJRe9lc1a3mmRFBpQLG90PPZaIexeTMpY20sku6wykDwKjhgtC5BIJDatCd3 meYz760UpOsqum1ByfS+VHqi72dkm019LNWw8Fftke+NzHl1GGIYtIEWfcleC4MqgBAm 15Ye7Izha5cPbvu/zSCEZRmLpShGj1wDWoNLARHqHmXO34+U1dbhHJNcnIPhXR1p+bWM 5b81VVhlcoQf8QE8gG6BpaUKrcJLhHrRU7psT+Jj39V0fvwwnKz76PxNVPvHCcjG+IVL jmC4+LlRuMAK+Zl0bQXW6MQK8dlNq09WxhqtGOc3Ion7F1aJ2PaMcw/wbeLWV5HpE7Du OzFQ== X-Gm-Message-State: AOAM533dTd/8BPoUFykOMi0Mpa5/vYMzFBRosWWMe1zPBWr4npv77c1F K1hsSYSneSc36XrpPYcFQk1bVBgffXA= X-Google-Smtp-Source: ABdhPJyZX7FUEkijx3Gztwpv4y6FTPhHul4TyJhYoAg6ypZ6TfwOgTRfUzVmXcqveRukLvC6ivHOSg== X-Received: by 2002:a05:6214:892:: with SMTP id cz18mr41737933qvb.60.1629852545126; Tue, 24 Aug 2021 17:49:05 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 4/7] qapi/qdev.json: fix DEVICE_DELETED parameters doc Date: Tue, 24 Aug 2021 21:48:32 -0300 Message-Id: <20210825004835.472919-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::f2e; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2e.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: 1629852655528100001 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 Reviewed-by: Markus Armbruster Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- qapi/qdev.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qapi/qdev.json b/qapi/qdev.json index b83178220b..0e9cb2ae88 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 QOM path # # Since: 1.5 # --=20 2.31.1 From nobody Sun Apr 28 23:29:49 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 1629852954627602.3767831561264; Tue, 24 Aug 2021 17:55:54 -0700 (PDT) Received: from localhost ([::1]:48284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIhCr-0004n7-9Y for importer@patchew.org; Tue, 24 Aug 2021 20:55:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6Q-0001s6-7M; Tue, 24 Aug 2021 20:49:15 -0400 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:44024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6K-00072I-MJ; Tue, 24 Aug 2021 20:49:13 -0400 Received: by mail-qv1-xf2e.google.com with SMTP id z2so8241973qvl.10; Tue, 24 Aug 2021 17:49:08 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:07 -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=YeLh4JoP3qFvWikRn+t/HSY17cM7BWFnCcXRhKf9+eE=; b=fwi9ZuVAbPpCH3JIkka8DfiSLKIWpUy2iLwokjdA/KUteAOjKQqge6u1wYVY6nBruy x7g34E4bHPUfqUgN1r8BHdCwqNtGoayuKOF2ZYggZaL350J5wPKrCAQHBTwWHcMzBjQn fkkx5sHryWdjmolgsN3VeTBdQkkMIvg2Tz7R4OjbmrR+VvdA1XQ2qptJyB07+Mv/D376 jBO2ScltOURg3F4xviK5wW87rdR5bxnHhxmCh1kWuAMVjDDkq0C9Iu9IA2nQ3+4+k4uM qrUVugpi0v6ZDdVOdrUL+VD8PVazF1h3Ye4Zu0KS/N5y5JWxoex8lBr8Hfjsa0qiOHcK Z87Q== 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=YeLh4JoP3qFvWikRn+t/HSY17cM7BWFnCcXRhKf9+eE=; b=swUtmHf0BAMDPhjsiwhZkBGWllsbV7qifweWpLo95ZNSeJEM3rW+/F2eP2eD1itA7F QSiBnUMfX4VDzDR8ErsZJ/81XkByvWzCH+ugwKO228PLn+BjwONAaiwjVN/5JYzgnDMU 1qGg5kmb4BA01ZFPyo6WrGA9Kf5z6eDOOqrBp4c/wIAAc/hDSxVcp5K0fdoO3lyb2FRT rNfPosvaRQXW3VG1HxLbGrLcST5f0vXrmjImUb2FkXbpQE36MeZDTmTHIl83HIP0xv// xiflRToEcmTa7Dri6DBy7krfFcBLkRf/xvTPnfJ5BWhezMLInjhuZqtvPdXNLQp8xhlo ttJw== X-Gm-Message-State: AOAM532IcVz0Gu7tyKLFRZtvpiJxv76pnNPMC+bIKANFTO+PpRoNExFb Xx+1GtQvxp/hZtbTnQ9ZNpSOjZHS3qM= X-Google-Smtp-Source: ABdhPJwjr2IiFEV8h60r82KDrjNlTN7CSQM1I3oYgzyBDg9WIh5EvMz+sEchAOSfe6UDq4DZXPT2AQ== X-Received: by 2002:a0c:aa55:: with SMTP id e21mr810278qvb.41.1629852547454; Tue, 24 Aug 2021 17:49:07 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 5/7] qapi/qdev.json: add DEVICE_UNPLUG_GUEST_ERROR QAPI event Date: Tue, 24 Aug 2021 21:48:33 -0300 Message-Id: <20210825004835.472919-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::f2e; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2e.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: 1629852956335100001 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_GUEST_ERROR event that can be used by all guest side unplug errors in the future. This event has a similar API as the existing DEVICE_DELETED event, always providing the QOM path of the device and dev->id if there's any. With this new generic event, MEM_UNPLUG_ERROR is now marked as deprecated. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Markus Armbruster --- docs/about/deprecated.rst | 10 ++++++++++ qapi/machine.json | 7 ++++++- qapi/qdev.json | 28 +++++++++++++++++++++++++++- stubs/qdev.c | 7 +++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 6d438f1c8d..1a8ffc9381 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_GUEST_ERROR`` instead. + + System emulator machines ------------------------ =20 diff --git a/qapi/machine.json b/qapi/machine.json index 157712f006..cd397f1ee4 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1271,6 +1271,10 @@ # # @msg: Informative message # +# Features: +# @deprecated: This event is deprecated. Use @DEVICE_UNPLUG_GUEST_ERROR +# instead. +# # Since: 2.4 # # Example: @@ -1283,7 +1287,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 0e9cb2ae88..8b1a1dd43b 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 a guest-side error in the hot removal proces= s is +# detected, the device will not be removed and a DEVICE_UNPLUG_GUES= T_ERROR +# event is sent. Some errors cannot be detected. # # Since: 0.14 # @@ -124,3 +126,27 @@ ## { 'event': 'DEVICE_DELETED', 'data': { '*device': 'str', 'path': 'str' } } + +## +# @DEVICE_UNPLUG_GUEST_ERROR: +# +# Emitted when a device hot unplug fails due to an internal guest +# error. +# +# @device: the device's ID if it has one +# +# @path: the device's QOM path +# +# Since: 6.2 +# +# Example: +# +# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR" +# "data": { "device": "core1", +# "path": "/machine/peripheral/core1" }, +# }, +# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } } +# +## +{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR', + 'data': { '*device': 'str', 'path': 'str' } } diff --git a/stubs/qdev.c b/stubs/qdev.c index 92e6143134..28d6d531e6 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_guest_error(bool has_device, + const char *device, + const char *path +{ + /* Nothing to do. */ +} --=20 2.31.1 From nobody Sun Apr 28 23:29:49 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 162985285416529.275026166174257; Tue, 24 Aug 2021 17:54:14 -0700 (PDT) Received: from localhost ([::1]:46096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIhBE-0003Jr-Uo for importer@patchew.org; Tue, 24 Aug 2021 20:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6P-0001rL-F7; Tue, 24 Aug 2021 20:49:13 -0400 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:46672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6N-00075B-VG; Tue, 24 Aug 2021 20:49:13 -0400 Received: by mail-qv1-xf2e.google.com with SMTP id jz1so12801190qvb.13; Tue, 24 Aug 2021 17:49:11 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:09 -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=NUd0WG/GCp1kSbL7cPzt8Yt6x1mX9aZlZRA2ocQvjMI=; b=sQchCc3nQNmp1ZgLtYudTf6zdqxOd60Kh3WXa+k0yo/lUgrYFg0SGOEksjaAihWbg8 Gh7mMPqZJ8fFJRnuKDJ6VRljtSMRqC4JAezQ8D2hoCT0G+4akgTxcnCokNRNRu0myqso z7UG0+EYC8Yl5lF4yZ9PmnIvQzsOtuSgn63/0sSeccBMsikKy2nmmMLbz9b7jPMKUEp+ rHQB/GQ1gSTqYA/kJCRSWb0FCs+V90vALCRPviGfCX2bD5SeMy8bqeNpehgOXS/E86pL 470/YAIGTpt19o8aVV1vVRoCRGUvim/iPmC748hdXmWlpKo4VvyZq1hhEirbX1dNJ3Aa 5EtA== 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=NUd0WG/GCp1kSbL7cPzt8Yt6x1mX9aZlZRA2ocQvjMI=; b=lQ0pyrFIqn/GXJ16sDTuzvHiwMhfqda3bWt8x1nj2zyR58MGXIM449wiPBvgKZ5ahe uXuHFU+1kIiT8mtOUWBudQ2hwS1h8CF8rZ7BxCOjbKGWDw3MxEOnKb2B2uDqfuW0knJh uYJXRYoVCTfjw9cxxpO6gpG/u0Ow2L6n1sbQkgB5cnar78IrA0zGWOYD3s1rX4/iyLHO 62BsIg1tysVSihONY8DpUlv09imSfQGlnaFZu0x0MB8Vu9EDBFBzdgHo+x0kctmPLedT QjHivRSzUS3TqLz1gfUEsStfLLhGHNL+DfRJGHfWOoJ6tQ/q9hQrZBt1nECG8NJkj66P M15Q== X-Gm-Message-State: AOAM530IFQBFRqvxppwvTIjZwARu6+AP1X8np5g2FyKYhr7duzDCdBWs X4/H8blgnd40GM5vXJ12Dfhx32FUpAU= X-Google-Smtp-Source: ABdhPJxgfMWdLDgX7yOCE5AFp1yhXb7vQ21l+4DV+8pcg006xkqR/etrjh68K9GTreS9QE9XRWbpBA== X-Received: by 2002:ad4:5247:: with SMTP id s7mr10092312qvq.58.1629852549617; Tue, 24 Aug 2021 17:49:09 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 6/7] spapr: use DEVICE_UNPLUG_GUEST_ERROR to report unplug errors Date: Tue, 24 Aug 2021 21:48:34 -0300 Message-Id: <20210825004835.472919-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::f2e; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2e.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: 1629852855716100001 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_GUEST_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_GUEST_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 Reviewed-by: Markus Armbruster --- hw/ppc/spapr.c | 10 +++++++++- hw/ppc/spapr_drc.c | 9 +++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4f1ee90e9e..206c536d3a 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,11 +3687,18 @@ 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_GUEST_ERROR until the deprecation of + * MEM_UNPLUG_ERROR is due. */ 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_guest_error(!!dev->id, dev->id, + dev->canonical_path); } =20 /* Callback to be called during DRC release. */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index a4d9496f76..f8ac0a10df 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 */ @@ -173,10 +175,9 @@ static uint32_t drc_unisolate_logical(SpaprDrc *drc) "for device %s", drc->dev->id); } =20 - /* - * TODO: send a QAPI DEVICE_UNPLUG_ERROR event when - * it is implemented. - */ + qapi_event_send_device_unplug_guest_error(!!drc->dev->id, + drc->dev->id, + drc->dev->canonical_= path); } =20 return RTAS_OUT_SUCCESS; /* Nothing to do */ --=20 2.31.1 From nobody Sun Apr 28 23:29:49 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 1629852796810162.96430378550326; Tue, 24 Aug 2021 17:53:16 -0700 (PDT) Received: from localhost ([::1]:43260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIhAJ-0001Qs-RT for importer@patchew.org; Tue, 24 Aug 2021 20:53:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIh6T-0001tm-Gw; Tue, 24 Aug 2021 20:49:18 -0400 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]:33686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIh6S-00078H-4I; Tue, 24 Aug 2021 20:49:17 -0400 Received: by mail-qv1-xf36.google.com with SMTP id a5so4711094qvq.0; Tue, 24 Aug 2021 17:49:15 -0700 (PDT) Received: from rekt.ihost.com ([179.247.162.205]) by smtp.gmail.com with ESMTPSA id x10sm1515266qto.41.2021.08.24.17.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 17:49:11 -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=g1UotLzQ0L5Awu7slK0NhDO1uCxic9JxflV/2rPVbk4=; b=bpkqJXAqKzO+WkF9dKxVUfAPF0Uprf54enT3zb1Re4BQTZZU3UEeYPWplMqZyb0T9D JI6C6tJd3AJeI/CV8gf5P+pL9ibbzxKAdQWDAW3Ao81GOi971+lfO0uavvnQPzkGn5CH MwzOwfLrkQErZAMmMZ2FT7tIFrm+ZSkhhC1JghVENeD5wcqZKQFJeG2h5047i3vS/Xmq oqo18YldFOAT7/4Im7hCKl4Lq7AORk5SkHPCaw4qqKvCGmH0wxqQVVkoWLd4KaULPeyR EzcHzDSaE9pNV2yKq3C3lQVMry/WRyAJYUpZo870LDnV6CW1nLqu0b6ACBdx2LwXN6Qy 03jw== 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=g1UotLzQ0L5Awu7slK0NhDO1uCxic9JxflV/2rPVbk4=; b=LHnMB507VrDZqGJJs22JdmfPIwnJ5Yg7TesmFmTcoWpcH3FoI/hH/tCTzEcDhFEpVr hX6u5WvZ/bhy2VsDvblbJw7zrq6NaPbxGc2KST1/xQlcM+teriLIEzfQPQe4ZVlI0GwA mjiGWjEmxE9Dg3V9YKXZBDguX46FY2SgZlTMrj+dzVFc58teW970c5JXVTHIAQCAFx8u h9Zqv6FbLqT6uFbWVF4UTMQDpSZlaDvB8sqCEWdz46Zq80fKj0IY/qlIrP05AKWTrAu8 T/1rTCQQbi1KqD9nkyLg+x+krlPc2rYRCZt5USZuGmpa4iv5zpVY7vqRiCKn/VmnkTzO i6MQ== X-Gm-Message-State: AOAM53249AXjPVp4IvLNfDcdh1SK1q5ePv1i+N/3uVj+McupY+beOgyH NrHrDPNFXeAUt0ySi43Bw+Z6HuwBD/4= X-Google-Smtp-Source: ABdhPJwdSwCHRikbPaz8VmxxXShRf+erUozmz84G0OyvzOR6tzW9GY3GZ+OYi2qqb8S5gNez24Gcow== X-Received: by 2002:ad4:4ab2:: with SMTP id i18mr946176qvx.44.1629852554671; Tue, 24 Aug 2021 17:49:14 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v7 7/7] memory_hotplug.c: send DEVICE_UNPLUG_GUEST_ERROR in acpi_memory_hotplug_write() Date: Tue, 24 Aug 2021 21:48:35 -0300 Message-Id: <20210825004835.472919-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210825004835.472919-1-danielhb413@gmail.com> References: <20210825004835.472919-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::f36; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf36.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: 1629852798933100001 Content-Type: text/plain; charset="utf-8" MEM_UNPLUG_ERROR is deprecated since the introduction of DEVICE_UNPLUG_GUEST_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: Igor Mammedov Reviewed-by: Markus Armbruster --- hw/acpi/memory_hotplug.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index 6a71de408b..d0fffcf787 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" @@ -178,8 +179,16 @@ static void acpi_memory_hotplug_write(void *opaque, hw= addr addr, uint64_t data, hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); if (local_err) { trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); + + /* + * Send both MEM_UNPLUG_ERROR and DEVICE_UNPLUG_GUEST_ERROR + * while the deprecation of MEM_UNPLUG_ERROR is + * pending. + */ qapi_event_send_mem_unplug_error(dev->id ? : "", error_get_pretty(local_er= r)); + qapi_event_send_device_unplug_guest_error(!!dev->id, dev->= id, + dev->canonical_p= ath); error_free(local_err); break; } --=20 2.31.1