From mboxrd@z Thu Jan 1 00:00:00 1970 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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B1AD3C4338F for ; Wed, 25 Aug 2021 04:27:12 +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 39FE561183 for ; Wed, 25 Aug 2021 04:27:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 39FE561183 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIkVL-0004rP-80 for qemu-devel@archiver.kernel.org; Wed, 25 Aug 2021 00:27:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIkGg-0000kA-7H; Wed, 25 Aug 2021 00:12:02 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:42427 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIkGd-0007UD-5O; Wed, 25 Aug 2021 00:12:01 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4GvXbt6c4Jz9t1Q; Wed, 25 Aug 2021 14:11:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1629864698; bh=QmGwFV5rej1IiZxSUPVz6SNQooghggvMESEq/3ogAlc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o5bGwnzSeEEhwdm23KuSiImGdUfNglrIK5LwIxzJxi8akoKmgftyTR52BdcpFsJb6 MFuY7Wh+tDA8TzxmY9UdgDB9nyYYUsstfUTk07JHxuIyv5/qe5PTc/P5cEGpk9W0fy vJvM6DnkG0+tQGjZ7O7trm9ouqeDinzUxbDI/nm8= Date: Wed, 25 Aug 2021 13:49:20 +1000 From: David Gibson To: Daniel Henrique Barboza Subject: Re: [PATCH v7 1/7] memory_hotplug.c: handle dev->id = NULL in acpi_memory_hotplug_write() Message-ID: References: <20210825004835.472919-1-danielhb413@gmail.com> <20210825004835.472919-2-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5jJlbhheu9z7fQwy" Content-Disposition: inline In-Reply-To: <20210825004835.472919-2-danielhb413@gmail.com> Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org 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, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --5jJlbhheu9z7fQwy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 24, 2021 at 09:48:29PM -0300, Daniel Henrique Barboza wrote: > 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". >=20 > 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(). >=20 > Suggested-by: Markus Armbruster > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/acpi/memory_hotplug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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, h= waddr 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; --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --5jJlbhheu9z7fQwy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmElvcAACgkQbDjKyiDZ s5I11BAAsZ8ri8nY3GI3zVRhRIyh9Jb64JSawBjxMbSKze6g2ravAumtzAqYXiBO H0aTaKHVcyAwmQVfV3VyJuiMfVD8E0Tx6OuzIZKmjr9CwnUXrasLKw/IAKTmex5M pq1ZC0iWDGJ/DoyBUtSYKdXjCGp7XZQcvc9nQHwRqFNbjeVrnbIxlAu4IB1x6+ie qXNYwPgUtTLGuGs+hXCEstWqyVF23ModCMIN6I4o/n+vUNOgL1z7eW+QvPj+mbuh g59zc6ufTVrNhXcUyLRjlwJO9L7JGxGkRDytrBsQpTlhb9hw3AfHJDSF0VPywKr1 UB7fRKwEVL4mwIEKo5uKikZDVCjHAO3RdVwos+AjLTB0qX5UEYwSq7ub3YM8NbLM Zz8Jrr6z50z5Owo9AhwoEYV9g7vDoaf1F6ff2UvUQ2txRvEpixsNhwvuNFWiA2BJ lOc/ZbiSYZmC5mcxFNYozu/Z2aZe0uR8ziwdkRx/e+ykZNxecinoaEHdyn9u8o1+ kOH2nyLVPTE1tVruznJPra24q7jXpccAglCRpgA7/SE/0vybgRJoTtsCmIhxGsb0 GYhj8GysZxnd0iX1Irw0ZtJ1nFBJLi7t5OnOeGK2ZZX/m95+sXkIyAZH2LoUro3e 3bt+IGt8GQURxEtw5n461BhMwpbFwTuxLQQHidCRzG3v2XW02wU= =/MIr -----END PGP SIGNATURE----- --5jJlbhheu9z7fQwy--