From patchwork Tue Sep 7 00:47:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12477467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C39ACC433F5 for ; Tue, 7 Sep 2021 00:54:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 810696069E for ; Tue, 7 Sep 2021 00:54:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 810696069E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNPO1-0002Jh-HK for qemu-devel@archiver.kernel.org; Mon, 06 Sep 2021 20:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNPHb-0002Z1-DL; Mon, 06 Sep 2021 20:48:16 -0400 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:40568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNPHY-0003nF-SD; Mon, 06 Sep 2021 20:48:15 -0400 Received: by mail-qv1-xf2f.google.com with SMTP id 93so4846032qva.7; Mon, 06 Sep 2021 17:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TT0UFxZrmRZc15RE6QSPgF8yShX5v3WEiTd1Mg5K8Pg=; b=p8hrcPOukIVyBbKvt/QbmdCHCchK8lh3Cre87u6DGpMu08yVNGxt/Q27G3GPdD5yzI pubAb4gGT8h1jxJ36ag5pNMzwNwVCnFs5lCCmnfD6V7Xwkf6/5+EfZ7r8FHyvxYmRHtW HHDnRI0Odo/Xf8QrILosAE4dsYEUwAngOYfOAEFEpqxfe6fj+3LFN7vDOvPjhqhSdmdx hKTh4VwzL0YYer+SzdTutdo1ZMjeuWP/4gLZfMXBDr8uTtAq6fSMq5fvZGDTCWmMNOZi +fiu875Alc1fIrTpHz9rynVPbIv1iwPlJ/DHI/rlP+psXUOGqdlM6pvATYMwbJtxiXpQ FWdQ== 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=TT0UFxZrmRZc15RE6QSPgF8yShX5v3WEiTd1Mg5K8Pg=; b=OWDUXAUCd1m6vEX629PgaRQ4OKCSw3Z0ocr5F3agiOQwdAWSxR/73amYCfXOgr3LDM EiW+dbrbE2Mu7rE9ac4Qc0lNjwysdPFuTrxVBLlatEG/PdbnLhrCV5uwXm/J3+HEu/uX apwywCaKMlemzvRzs5b6WMw/zEmo1aKVy+M0UrtspxvNuSfBQlwbcumW8ZZfXS00m0gM 8vAJVVkdFzTrZmbgnPJZedfIJzVa9NAdAH7sjhsrFnDkqliIloe3rAgRVAJysPg7x6+p pbnebpX63Ply+ypOnR12GLwV1rIyuuCpbF7pGx43ucWpcK2/zHL4GfRN20a6OjI2nmSy ZqlQ== X-Gm-Message-State: AOAM530mVMi0UGBQGCOEJ3BknEoGj7DvWLqn8lrEaH/gdL1cFSu5rlBP ja8m07YQUUf1AqMK8f1ALeookjac+AA= X-Google-Smtp-Source: ABdhPJx92LEut4hKfSprMPF2qBel1XmAN3/5f9e7Xdr6QnoskVLx+GJUTxNW2jE8UCxYN9bxR+hOhw== X-Received: by 2002:a05:6214:762:: with SMTP id f2mr14522747qvz.48.1630975691508; Mon, 06 Sep 2021 17:48:11 -0700 (PDT) Received: from rekt.COMFAST ([179.247.136.122]) by smtp.gmail.com with ESMTPSA id x83sm7799538qkb.118.2021.09.06.17.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 17:48:11 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v8 1/7] memory_hotplug.c: handle dev->id = NULL in acpi_memory_hotplug_write() Date: Mon, 6 Sep 2021 21:47:49 -0300 Message-Id: <20210907004755.424931-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907004755.424931-1-danielhb413@gmail.com> References: <20210907004755.424931-1-danielhb413@gmail.com> MIME-Version: 1.0 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: Daniel Henrique Barboza , Markus Armbruster , groug@kaod.org, qemu-ppc@nongnu.org, Igor Mammedov , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Igor Mammedov Reviewed-by: Greg Kurz Reviewed-by: David Gibson Reviewed-by: Markus Armbruster Signed-off-by: Daniel Henrique Barboza --- 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, hwaddr 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_err)); error_free(local_err); break;