From patchwork Mon Jul 8 06:55:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=WhDZgAtL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZg10w83z1xpd for ; Mon, 8 Jul 2024 16:57:01 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiI9-00086F-7I; Mon, 08 Jul 2024 02:56:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiI7-00083V-CN for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:03 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiI4-0001nY-Eo for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:02 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2bfdae7997aso1927319a91.2 for ; Sun, 07 Jul 2024 23:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421757; x=1721026557; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UaPFfT+leH++H8fthM/ZJoF5CcBN0CIUxVYvtNppWVI=; b=WhDZgAtLwWpxEHvOGGTGFrjYr+Bgfpn//cXtdQ4SA9e96qoFSUs02GvvRJtW75p1LV 0SwDbPGDrbhyXCGBApQVF1yLpOUaJeU035K7H1HJBT3Dv+2/Wt4LmRDE+JGXL5KJJt1B 5fMd9dMXJ0ToEMAVHYLbPEHnUSkgsUj4IyAi3MDOylTlIKM+66+2+Lcrc4yPLVZQayDF 3A+r2ghJOjwLKdLIXlgfcd2Qdkwb8ZIHdahYpnSI/AAscWSnx+OHKPmt5LLgD++E5uDs eALMxs2nhCURTMvSHfwqRlnD6qPyD0cPJTRqWGhdvW0iEAIUNZoaVTfPh0GUkj/06zZ9 BArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421757; x=1721026557; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UaPFfT+leH++H8fthM/ZJoF5CcBN0CIUxVYvtNppWVI=; b=YIcGj3ZKGDTYOl5CT3T+Y+8V8tJW/LlessvBgFiTjbRuZs4qLIVHeTs/fcqpcbv3he 0vmhFUy6UcpYDG+AA/Y+WIaENU7aKGqaeivDxiCy4YBtEnrSHD3lTLavY8bHNRC4Vj02 sSKufYN9Hr4UD+sWLYaARWvEuSjWTm46UDSPtfLrifANkc+fuUAWvzHVdXUDQyOhxkka 3tYZYBABEnvFluKKkSy4tDwiyufPs/ra26o3rl7flptdOqo5p5CSkKeYVOl53ULOqiQl Gv27OK6LWYQtyTJtODVCRZa2H5a+6BFyNQvMzxpr0RxaKb2/28xxbwYNqn5hdQSgTN6V 27VQ== X-Gm-Message-State: AOJu0YyKaJrGxa6ykS8gvonwwRncTMDhySHM6xWezEFkAoQ0AqUbK0Dz 4bsVHiTGzlKRKarD0FXs5ZMPZEJwUyPWgEH1QYtc1q6Rupq0D0LZf7/pRSoqFok= X-Google-Smtp-Source: AGHT+IFYGr3yln/+vkC8c4wuU02zkUuJv0AQykl/zlen2nQtgSYYTijPjewoiwEJtSC9clBwrdPHDA== X-Received: by 2002:a17:90a:c582:b0:2c8:452d:e634 with SMTP id 98e67ed59e1d1-2c99c890807mr5397148a91.45.1720421757292; Sun, 07 Jul 2024 23:55:57 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2c99a95b572sm7393441a91.18.2024.07.07.23.55.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:55:57 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:12 +0900 Subject: [PATCH v3 1/9] spapr: Free stdout path MIME-Version: 1.0 Message-Id: <20240708-san-v3-1-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::1035; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin --- hw/ppc/spapr_vof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_vof.c b/hw/ppc/spapr_vof.c index 09f29be0b9de..c02eaacfed0b 100644 --- a/hw/ppc/spapr_vof.c +++ b/hw/ppc/spapr_vof.c @@ -28,7 +28,7 @@ target_ulong spapr_h_vof_client(PowerPCCPU *cpu, SpaprMachineState *spapr, void spapr_vof_client_dt_finalize(SpaprMachineState *spapr, void *fdt) { - char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); + g_autofree char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); vof_build_dt(fdt, spapr->vof); From patchwork Mon Jul 8 06:55:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=LmjHWBlO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZg156MPz1xrP for ; Mon, 8 Jul 2024 16:57:01 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIG-0008RH-1M; Mon, 08 Jul 2024 02:56:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiID-0008MT-16 for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:09 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiI8-0001ol-Ve for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:07 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1fa9ecfb321so19386895ad.0 for ; Sun, 07 Jul 2024 23:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421763; x=1721026563; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vIEfURKz+p1ePfxL4ZyEDkPLusmBWgHYvO+HKUIo2A4=; b=LmjHWBlO0E68jEEnjnYdjJw9uvaMgZFhlu7gNIeq5sw54fwmP8EsPWe0gT9I6dxSzX Uf3NX9t7DJMRxfYQRF1zPvx5klkbH1kVo+YuJYcQYpbUOeFE4m7uDAv7opwK0Rx8/wY0 SqWSJCA/2YwhdHFuk+KyAmInJBhBOyks/7n9JXhqE72nUEPpwsAt/Z5MWqyP/lxiGj5a XuXuLSn/qBievx9QPUP72JBlMwfZQGCmRZB2/buGGvM6Wrv53LqbMqDcvDw4k9tNHBOQ nL8Z23ylDe/bRELvMRI5WyN/ySP5rjLbZS2N/H2NlNlbgbLNh+KK4Bx0Cnt9EdDrZ6gL B+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421763; x=1721026563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vIEfURKz+p1ePfxL4ZyEDkPLusmBWgHYvO+HKUIo2A4=; b=lZZvj1Kctcm2RBtINKmlYDWpJ5tlYIGzR1ZGfsOlgIr5ED6EwpjXiiTYb9aYwAGtxt NyGGr5Qj49yMRGqkOoSP5iiWKbA4YMdOkYQsBQPZnx4gdgQzt4w6OxPOSwT/7e3HW5/2 IPVWd3a1N/XobIXxOYumESqYi6dTKRM7UagMCmn5MG0//zlc7/cjH7J4H0tsS5sLygHy vI2C9zl5vf7eo/RYAKEBiMsRnpmM2uze2bbFcHY+IzAfJQ4WMSK5cMm4duYisK/N7SEg zk+Q8D/+GGJ0OonigVQ5w+/2j6u5z9yK4FtkabKF6j5TQ9UogEe3ppSSoMvpx2kbshI9 pFTQ== X-Gm-Message-State: AOJu0YxfuME89uiXRbOoU8RxQkgajgvgIMquVLMrXOx/ZB8sus7MnmNh Qg+riGO5GfHfyDxQpoNU6vRB7BiWVrF556T441gqu1nYZuGlZ3W56ARS3rW486M= X-Google-Smtp-Source: AGHT+IHaHLFdVS3j6x0yV/mu2NdS069vJVNaVFKSSEeJYUo+CXcbTb/uvUGc5zl46xXmYEn41lnNAQ== X-Received: by 2002:a17:902:cec4:b0:1fb:72b4:8766 with SMTP id d9443c01a7336-1fb72b4898emr28292685ad.49.1720421763375; Sun, 07 Jul 2024 23:56:03 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb438a7890sm57605205ad.185.2024.07.07.23.55.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:03 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:13 +0900 Subject: [PATCH v3 2/9] ppc/vof: Fix unaligned FDT property access MIME-Version: 1.0 Message-Id: <20240708-san-v3-2-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki , Peter Maydell X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::632; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org FDT properties are aligned by 4 bytes, not 8 bytes. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Reviewed-by: Michael S. Tsirkin --- hw/ppc/vof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index e3b430a81f4f..b5b6514d79fc 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -646,7 +646,7 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base) mem0_reg = fdt_getprop(fdt, offset, "reg", &proplen); g_assert(mem0_reg && proplen == sizeof(uint32_t) * (ac + sc)); if (sc == 2) { - mem0_end = be64_to_cpu(*(uint64_t *)(mem0_reg + sizeof(uint32_t) * ac)); + mem0_end = ldq_be_p(mem0_reg + sizeof(uint32_t) * ac); } else { mem0_end = be32_to_cpu(*(uint32_t *)(mem0_reg + sizeof(uint32_t) * ac)); } From patchwork Mon Jul 8 06:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=oyMsnlPm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZg94dK9z1xrP for ; Mon, 8 Jul 2024 16:57:09 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIP-0000c3-NZ; Mon, 08 Jul 2024 02:56:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIN-0000RK-H9 for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:19 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIJ-0001q5-JI for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:17 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70b0013cf33so2235463b3a.2 for ; Sun, 07 Jul 2024 23:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421770; x=1721026570; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dYsCw1FmqSn/YuppQ6AhBdpL7b5hTddKWxjDOuy7dBs=; b=oyMsnlPmLQtNJLkmP55dvZl1kcbPpJMT5UANwbJO7TdlwwE+ma1zHDhTBM7o2lJVWG /Xd1WpMAO5LQ5plbqETRc8/9wN427dFQrsOxqRhAglRku4eqbmhpsyK2iwRQUoLEdCVo STytmkgkcG7aYf+JVHuk5NJCUSmdSBc2ywuknuLujksdkfFZWAHUr25I1Bo89aMzZiMe 8ScHw6aaO8OgysgxK1OlGNSILxnzeUh+pQjmOIRZgms4SYNV5HWy/bSKByfYXJmp6To5 oYD7uPZpqFWZ7+6RfEOv/T1M01GNJYKQVdVZGBvRyasdVxIEMX5LxFkg4nhosGsOYs2+ enSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421770; x=1721026570; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dYsCw1FmqSn/YuppQ6AhBdpL7b5hTddKWxjDOuy7dBs=; b=ei8Z9hJcfxRcBBs/I5ixXbmV9LUSO9/D7p+StvPEVDiO7PCxQc/0zxZd8Ly61N968q yi2QEq6R2lpxR1na8/PB/kWPyIJxBoIfJ0OsBXJljqG1tQoc8KnZyWmwfcfS3GQBSXMi 7GjACwdbQ6gnQSkkqoS51R1nTIKoqGjgTmqg5X/UsG1uTaSwhdmSa8datA3I/lVtWJrb Q44EzQiIWd/arLJNnDjqBPPyPi+/MWZRDNV8hpoFy4lth/SbDsHU06Qc0d1TltYm7qiH YfM10n9Dpiv/QvF0AcAaozSZeOunUzXstTm3jOLU7j3dq2fPC9LWIXZ5fLbDfX5luGSv Fyew== X-Gm-Message-State: AOJu0Yxe1ezNc0ZHoXEbFxwVKNFZyTTM7MZoxbMeDLeopB76aDdiusHB 43GAwRGZU/2rYD7pk/WW19Yq33dY3jhaRNfV/9unIiDyJOGDokfNQmmMj68Swv8= X-Google-Smtp-Source: AGHT+IHfgbo/reFIOcNODiDMFxa4Po7UHW8YYN/I4KGCJzL8ZmEaHuGkly4b2a/dS/pDNoFvPtU0xg== X-Received: by 2002:a05:6a20:244c:b0:1c0:eb46:96f7 with SMTP id adf61e73a8af0-1c0eb46973emr2272534637.61.1720421769497; Sun, 07 Jul 2024 23:56:09 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb111382f5sm95501885ad.175.2024.07.07.23.56.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:09 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:14 +0900 Subject: [PATCH v3 3/9] migration: Free removed SaveStateEntry MIME-Version: 1.0 Message-Id: <20240708-san-v3-3-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::431; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- migration/savevm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index deb57833f8a8..85958d7b09cd 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -874,6 +874,8 @@ int vmstate_replace_hack_for_ppc(VMStateIf *obj, int instance_id, if (se) { savevm_state_handler_remove(se); + g_free(se->compat); + g_free(se); } return vmstate_register(obj, instance_id, vmsd, opaque); } From patchwork Mon Jul 8 06:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=WbcPQOoi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZg94YxFz1xpd for ; Mon, 8 Jul 2024 16:57:09 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIR-0000i0-60; Mon, 08 Jul 2024 02:56:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIN-0000RJ-Gy for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:19 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIK-0001qt-Q3 for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:18 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fb72eb3143so7930115ad.1 for ; Sun, 07 Jul 2024 23:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421775; x=1721026575; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ChRWheJjblqVP5q7+vXrOZ0CV+wipm1YZa2EmXXOkpw=; b=WbcPQOoiOMsaor48S+cvkvH82+Z8fYBS0IxHLoz9wn8U3rLu1bkDrniGb8N6yW7vRg Cg0l/XAwoFGsCeanGGonUV6erfY3kqcP4Iq9b+Iqp4vKk7lVh9bD3f7dapWvIbCTbPJt ECK2Zzqaci5jJAw6A6d0xWnQifp1TmnUt+CIJ0Fg3KXXY32VVvC8SUQEVDt2+kqFks+7 IEaTDY1CGpwRXtzAf7lj42i9b3bzEn5TllfG3/Obdsw12BL0UYKrX2zaU5VHJIv4iBRw QW+/UFatQCxPDrl95OQ9S1VjZnQlqMfKVGd2mawKvnFeNA/5FrX98omnx9U/BA3RZ4a0 7l3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421775; x=1721026575; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ChRWheJjblqVP5q7+vXrOZ0CV+wipm1YZa2EmXXOkpw=; b=A/CPoqBxoJVuJ42sVgTFT/QRdMr76UYAgku9uom7njQO+/yH9Wnz15gklDOBitzj26 hQcb3ISL/1LEj/CBACbZ3Uu6sTRHCKaIsBJ9DSDQBuwaf2ByQCP1ZAaUDy7mGIqHhZTF QdsTUqwBCaKVjCghve+WrA9hh7SnNiE6yY19YCg7ah6Crjg8xiaIHNod0/kZvitoCOSc QnmbccKlEVQdRGpSbIwPCvv8TJdid65xNXxzHUx+w3wcRQqKiTNRenBkyQ10f27Gblmj K7FH6EHRNnGv4S7sPtnrS/62PFFSGtL+sV7ED+rLu4Q3clPMtfU27d/XS7TNjwNA3jCz YcHw== X-Gm-Message-State: AOJu0YyLSWzahdar6Xq4pBmSrJ9zEQaVm7IhdG8bhxD7FJRN6YxP8+1E VDdJTn7ZHhzqsbIk41dWTGEtEtu4+WXrXr8gyz/kyNF745pJECgpOm+JiLSXBp8= X-Google-Smtp-Source: AGHT+IEVqu/8DsEhzBCxZKr1jWnPsEYZhX59/+YkowLt6y09KqyZz3Mfs436iKNSVuV3e2T20/W0hA== X-Received: by 2002:a17:902:dacd:b0:1fa:ce44:1cb3 with SMTP id d9443c01a7336-1fb36c3a357mr192999235ad.0.1720421775458; Sun, 07 Jul 2024 23:56:15 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb5962888csm43274235ad.61.2024.07.07.23.56.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:15 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:15 +0900 Subject: [PATCH v3 4/9] memory: Do not refer to "memory region's reference count" MIME-Version: 1.0 Message-Id: <20240708-san-v3-4-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now MemoryRegions do have their own reference counts, but they will not be used when their owners are not themselves. However, the documentation of memory_region_ref() says it adds "1 to a memory region's reference count", which is confusing. Avoid referring to "memory region's reference count" and just say: "Add a reference to a memory region". Make a similar change to memory_region_unref() too. Signed-off-by: Akihiko Odaki --- include/exec/memory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index c26ede33d21e..a5af05864274 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1243,7 +1243,7 @@ void memory_region_init(MemoryRegion *mr, uint64_t size); /** - * memory_region_ref: Add 1 to a memory region's reference count + * memory_region_ref: Add a reference to a memory region * * Whenever memory regions are accessed outside the BQL, they need to be * preserved against hot-unplug. MemoryRegions actually do not have their @@ -1260,7 +1260,7 @@ void memory_region_init(MemoryRegion *mr, void memory_region_ref(MemoryRegion *mr); /** - * memory_region_unref: Remove 1 to a memory region's reference count + * memory_region_unref: Remove a reference to a memory region * * Whenever memory regions are accessed outside the BQL, they need to be * preserved against hot-unplug. MemoryRegions actually do not have their From patchwork Mon Jul 8 06:55:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=j2HT0RAU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZhs5TFTz1xpd for ; Mon, 8 Jul 2024 16:58:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiId-0001I9-54; Mon, 08 Jul 2024 02:56:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIS-0000pW-UH for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:26 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIR-0001tZ-8H for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:24 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fb19ca5273so13823375ad.3 for ; Sun, 07 Jul 2024 23:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421782; x=1721026582; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/jMKYGPTJJ9yGUeaxRp22EHnHqtIFtM17jmMaxbQ8UI=; b=j2HT0RAUbZZxKB10/HMcBMSXEQj+NeEX6239LW8mgwDmiN7hZoBMAaZvflHpD7tDcX PsyB1miAT6eGi7+Ph6IclKthRarD6fK64kWVgxUJZeS8FxaMb4J4E08TxliKSqTE+6mF pFy259RJTz9ieNe7HWJtQj2r6eGMI13pSw7i7oxrpE3iTNzUXpBogEALEgsalCMMv1SA IBEgmFFX4mEVIhjBMBAEHpHqd223dHU+a0CSXEH6/4yjZfOPG7pDYueq4iq1Hb6aMpex OX4xm2+KOwic4yn+WpuW6F8zP7zOQEYMWSvcXMhgg/I4MD0O7x+pAziY07NMsd1SkPt7 gN3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421782; x=1721026582; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/jMKYGPTJJ9yGUeaxRp22EHnHqtIFtM17jmMaxbQ8UI=; b=CNnwL0DcbGCdZwYb2cJem9Hcg52v7SRShhIFKQL8dVifxlHFLGYIvI4V36nCJGUNG0 0sbzmF3qoAcB2g+lNuHqg5FNjr2zKJ++yPE8NEr1juYXYYNLepK79YW0o3elXSBNkF+h Nf2i1FUOiJrGCh9fjK4bEvL40ulrDeVvnutLRPVEK4TXbzxhl5jRns1nXoGe6BxrPclF /JRpOiNn5hXE53p9JGeIyDEBAH4d/wrzY7J4YOl+FnlYmgAVzlVyLdeE4vpHtqua0eW6 xJH5hTQrS/QohCrEoFbmQIT04hy4E0aQNKHNFK4WV8cLeO+4AH+m2phastHDm0BorBtI gelg== X-Gm-Message-State: AOJu0YyFIq5dv143OoeFF9bpHRNWu0rcsXt/TL6KztX8xfY71eJ67AnX KqepkmwqPgT0g6jcKfcpVegxeuVXnkioDZjU9T5aT1VtR9YIfWnlGjmJIkq7jc8= X-Google-Smtp-Source: AGHT+IHM55HaZNNo61Hs7ynNHCbQVGIhDn1FJn7IXBZtorbAel5T9LcyEgQlWQGY2x96E9xCEU8/mA== X-Received: by 2002:a17:902:f64f:b0:1fb:6260:8eab with SMTP id d9443c01a7336-1fb62609109mr30287365ad.64.1720421781978; Sun, 07 Jul 2024 23:56:21 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb1fb30ba3sm85254985ad.89.2024.07.07.23.56.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:21 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:16 +0900 Subject: [PATCH v3 5/9] memory: Refer to docs/devel/memory.rst for "owner" MIME-Version: 1.0 Message-Id: <20240708-san-v3-5-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::631; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org memory_region_ref() and memory_region_unref() used to have their own descriptions of "owner", but they are somewhat out-of-date and misleading. In particular, they say "whenever memory regions are accessed outside the BQL, they need to be preserved against hot-unplug", but protecting against hot-unplug is not mandatory if it is known that they will never be hot-unplugged. They also say "MemoryRegions actually do not have their own reference count", but they actually do. They just will not be used unless their owners are not themselves. Refer to docs/devel/memory.rst as the single source of truth instead of maintaining duplicate descriptions of "owner". Signed-off-by: Akihiko Odaki --- include/exec/memory.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index a5af05864274..e1bd29550c15 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1245,15 +1245,8 @@ void memory_region_init(MemoryRegion *mr, /** * memory_region_ref: Add a reference to a memory region * - * Whenever memory regions are accessed outside the BQL, they need to be - * preserved against hot-unplug. MemoryRegions actually do not have their - * own reference count; they piggyback on a QOM object, their "owner". * This function adds a reference to the owner. - * - * All MemoryRegions must have an owner if they can disappear, even if the - * device they belong to operates exclusively under the BQL. This is because - * the region could be returned at any time by memory_region_find, and this - * is usually under guest control. + * See docs/devel/memory.rst to know about owner. * * @mr: the #MemoryRegion */ @@ -1262,10 +1255,8 @@ void memory_region_ref(MemoryRegion *mr); /** * memory_region_unref: Remove a reference to a memory region * - * Whenever memory regions are accessed outside the BQL, they need to be - * preserved against hot-unplug. MemoryRegions actually do not have their - * own reference count; they piggyback on a QOM object, their "owner". * This function removes a reference to the owner and possibly destroys it. + * See docs/devel/memory.rst to know about owner. * * @mr: the #MemoryRegion */ From patchwork Mon Jul 8 06:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=TSL/ASzM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZhg02QQz1xpd for ; Mon, 8 Jul 2024 16:58:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIo-000257-OY; Mon, 08 Jul 2024 02:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIg-0001Ut-FN for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:39 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIW-0001us-Vl for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:36 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fb4a807708so26388085ad.2 for ; Sun, 07 Jul 2024 23:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421788; x=1721026588; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RbcvfQTicnHYs0Rl8hdXG4yng/OPRtHTnYekAJzWw5c=; b=TSL/ASzMfySzCdwkGj+k0PF/nYjATDQ7OrzcqaH4avIcejerekELQ/8B+A39YkvZei xuSKgJXfZ7iWRb9sF4YPQpCa9pjCthOVegb98HNIOrznew/UhJnh4OUNslXx++ou6kuR tVhEElipNaoQY/5kDVQ0EevmqUTTOAxzhwW+p9gg+Uu4izJJrJ5gX2pdjU3yKXvB11vW Scv7zLLi/TqpkE9mlYm2ScpY3RrSq7NO7ozpi+Snsdq+jp+3m45iQJv2XallwicjM2MB 5yTVlQVUg/EQ+GuR6kAS+v5HpsGEQd+UFXvpgD3PGVlR6hpzfgM/Wozw6FKoWKCqJ1Pp wtSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421788; x=1721026588; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RbcvfQTicnHYs0Rl8hdXG4yng/OPRtHTnYekAJzWw5c=; b=lsMPh8A1YhredYf2VdxC7jzOqEYzck7CiOWal7P4FhUffLHGTGKTXVtMIaJ/7xo1tJ YM6FrXaJugzknczVs+SLGj6qtx/Ui2tisPi6Qp30X+FNFfU9DthdHfc7EAEVJUF3bfPx btCVjhLf7gXVuLm7DKIoSJUZl4xkI6eIiQ+7EqWWHQotA1nblkhftdhuEyG0JTeCfS1i ZjmyqzqqdCIPYiBahK7UZ1AAvfIUnsXy54nWlAOylgaaLpAuL8H0GJoZd5h0rs0Y04Zy FHV4eY4LpCElAsXuN4y/vU1FWWYXCy1ujufCykD4YBk1mBM7PNOlOf5m8ZclgvXb+4Ei 1MwQ== X-Gm-Message-State: AOJu0YzZ+9G5DW5bXBrCMtH/w0oo6QH2WS16YDgYR6eSYz8hKWgpmitH iMyYq38qcTcC5a4eH7dCR4NWW04cYZfv21CqS9v11DIfKp6jSVXT5utaU9hr4cs= X-Google-Smtp-Source: AGHT+IF224MSkQyCWG97UaqlAKurNwMnUliBvemXdWNeaeRytihyIwE176LqgTxQEVJaVP5Ugh784g== X-Received: by 2002:a17:902:e743:b0:1fb:7978:6b3 with SMTP id d9443c01a7336-1fb79780b8amr47259865ad.25.1720421787844; Sun, 07 Jul 2024 23:56:27 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb48c6a5c3sm53740695ad.13.2024.07.07.23.56.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:27 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:17 +0900 Subject: [PATCH v3 6/9] memory: Clarify that owner may be missing MIME-Version: 1.0 Message-Id: <20240708-san-v3-6-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::631; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org A memory region may not have an owner, and memory_region_ref() and memory_region_unref() do nothing for such. Signed-off-by: Akihiko Odaki --- include/exec/memory.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index e1bd29550c15..847c84c86db0 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1245,7 +1245,7 @@ void memory_region_init(MemoryRegion *mr, /** * memory_region_ref: Add a reference to a memory region * - * This function adds a reference to the owner. + * This function adds a reference to the owner if present. * See docs/devel/memory.rst to know about owner. * * @mr: the #MemoryRegion @@ -1255,8 +1255,8 @@ void memory_region_ref(MemoryRegion *mr); /** * memory_region_unref: Remove a reference to a memory region * - * This function removes a reference to the owner and possibly destroys it. - * See docs/devel/memory.rst to know about owner. + * This function removes a reference to the owner and possibly destroys it if + * present. See docs/devel/memory.rst to know about owner. * * @mr: the #MemoryRegion */ From patchwork Mon Jul 8 06:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=O4pOfXWL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZg40mgvz1xpd for ; Mon, 8 Jul 2024 16:57:04 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIq-0002IU-II; Mon, 08 Jul 2024 02:56:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIk-0001hn-0v for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:45 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIg-0001vR-8F for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:41 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fb0d88fd25so22347455ad.0 for ; Sun, 07 Jul 2024 23:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421794; x=1721026594; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qHDn+thxMw3Ig31uqjhcKUOYvBIP2g0Rv0XxZxkAcRk=; b=O4pOfXWL8hN7msyyNnqEvOs1mQuA/Z+LKsIIRCbTXFrhbFHXDRbaTQ+jKmu0oTv9Zh yQ1emaP7n20aSphm5LfTHfbLOPveEClm9u4w9ZhGvGqZ/HGpFwCGPoDB7SXc2KDZY3N3 GqOdnkv39J+eaAY9hieX5kj/ODJX+VzSVjhF0X23QTGW7ga9Mf2VA8gdTZZO8NpZGa/R hl4TskKTWXcHqA8GErcRnjFgdNZOiTu2U7lxl6I9Nzi38t3YK1Mw7WFH2Ag9L+gyDA03 kGcWeN328wvefQSuyVoVy7RO2t4ZIrQzT2PHwClqyKThs3+Viglb9brmdA4WRoXHYUx1 N+dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421794; x=1721026594; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qHDn+thxMw3Ig31uqjhcKUOYvBIP2g0Rv0XxZxkAcRk=; b=hPPJAUi41WRvCQkP/6JCV8IUs+XVHK2CW4rxDhuTXaHP5KPwNG4eu5yXeVQZaYT5Pj rBVcBX3MXplP0EH8uS1gRiz0si2bKOBbPLbQTbuhH5QbSsxlHUpKxrY+PTWdZliKBEK7 fXAOMxKHl6apThSJ/WfR30m9lBsHBdb5oUfwF1XPTwxUAgjXzkfpLwMHwX3PNTWQ7uxA UlpbCfaZjhLDhJhuHYnHaL0pf9x/4A7xmwClyM7gKS+cAt+Ws6N/XO03rFpUF9hy5SrO 88oWq4KwSnuw8LX+OV55NnUdiqVO5ZM6J6ohkBIgtIX5NFAgiiQqKhs1Yj7A5Knn1lQo cKzg== X-Gm-Message-State: AOJu0Yy5kvEFGGoOiAW9llBiwFsKwYlL+Yj2gEEDDv2GoUngF9rLQnP7 g1+4IoC/1zloTCVlwUjlT4AZqr+AelvmIoK93BolE2JX2yYK1lA5PKZQtcdBods= X-Google-Smtp-Source: AGHT+IFFXUzW/PXAi/sF+7aaq6lUaFYcUV7YW/MQrCOgfEn9qAauNV8DpVYWlT7DWjVM1fpKaopkMA== X-Received: by 2002:a17:902:ecc8:b0:1fb:6ea1:6e with SMTP id d9443c01a7336-1fb6ea1039dmr85708215ad.9.1720421793886; Sun, 07 Jul 2024 23:56:33 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fb67ee6f31sm34281675ad.292.2024.07.07.23.56.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:33 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:18 +0900 Subject: [PATCH v3 7/9] memory: Clarify owner must not call memory_region_ref() MIME-Version: 1.0 Message-Id: <20240708-san-v3-7-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- include/exec/memory.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 847c84c86db0..32bb430acdc4 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1246,6 +1246,7 @@ void memory_region_init(MemoryRegion *mr, * memory_region_ref: Add a reference to a memory region * * This function adds a reference to the owner if present. + * The owner must not call this function as it results in a circular reference. * See docs/devel/memory.rst to know about owner. * * @mr: the #MemoryRegion From patchwork Mon Jul 8 06:55:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=DVN8qqyo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZjJ1dLPz1xpd for ; Mon, 8 Jul 2024 16:59:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIo-00023j-En; Mon, 08 Jul 2024 02:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIn-0001uA-7r for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:45 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIj-0001wP-Qh for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:43 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7276c331f78so2971611a12.0 for ; Sun, 07 Jul 2024 23:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421800; x=1721026600; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tLjKua6/1Hq2H1WMYp9C0UeVmJOmPJCabCtwzxYyu/w=; b=DVN8qqyoedF0LwyM5e6XliCbYOd7wEqHOrZuUXy2nsJGEkFSn/7Rx7uB0It69yFUKF ZT1+saYscXc/yduH+61iKXb1AW+fEgSz7JXNL+2CvIam5smUjxLjxihHf2OjyERf7SRk dyrevOjqoTJXEiyO+9QEGIOOI+EdURNBKn0cZLAZVFirA/WE2w7I3TVTvHsZtzrqyTqL wk1KUkJzQ++lxmCnv6uuIUwaozD9uml+w0LJwrMkvp/aVBNstvOya15I+s+UHNKLqu/z ppTX5i7KeyCaMPjAvMfo/jioC/f0w5QrKK5pv543px/dR9t81FOSfl5IjwwjjZMGoyze 7BDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421800; x=1721026600; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tLjKua6/1Hq2H1WMYp9C0UeVmJOmPJCabCtwzxYyu/w=; b=RxFL3LblFj9uUuFtO/VlBFPALgt10ze5wM7US2cxGDXw/72/sFxiqubyJsiKWnbODr DXklxN0H126SJppx7Yy7P+4ZdkMUKYF9Z3RPEhimfuCZ2CINKFyjtfLb9k+BOoxQa5vK d7cdgZpw3WC9TXyi7yudgkRUJISFrN8KOhAzxixthrZTwRxZXiDGrTBil1M2YsQAfK8A ZfbXO3oR3QpYETMVs4DPH1oob6au4leFaKgp5sK6ROk3jN4fL75PsJEioEmcFunGb7RE wHqRgcw3WULXOAc5H5T7HIF7Y/WaV3QiTbky7vTs2JmOkTSlNUg4L8+7KEiJwFv9SOiT 67GA== X-Gm-Message-State: AOJu0YzJbTXHnX8NbEh7kjph32KM2rsW6KuHcN4H+Wgs+vLclqUL4Ixm Bqh1YuWEXp4EQ+5EjNXUcR5TQp4glTalnScJPqWwbKioJAa7I2NA066cYJNQv4g= X-Google-Smtp-Source: AGHT+IGimfWqqHnSqOntC/f3ozquovyx9nC2f2NQCfqeGesCHlONjh70lg+bYJV2RrwbgWKdHUVV5g== X-Received: by 2002:a05:6a20:a123:b0:1c0:eba5:e19d with SMTP id adf61e73a8af0-1c0eba5e35bmr7575031637.18.1720421800288; Sun, 07 Jul 2024 23:56:40 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-72c6d1f77bcsm14717594a12.79.2024.07.07.23.56.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:40 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:19 +0900 Subject: [PATCH v3 8/9] memory: Do not create circular reference with subregion MIME-Version: 1.0 Message-Id: <20240708-san-v3-8-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::52d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org memory_region_update_container_subregions() calls memory_region_ref() on behalf of the owner of the container. memory_region_ref() must not be called if the owner of the container also owns the subregion. Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin --- system/memory.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/system/memory.c b/system/memory.c index 2d6952136066..09c98042e443 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2625,7 +2625,10 @@ static void memory_region_update_container_subregions(MemoryRegion *subregion) memory_region_transaction_begin(); - memory_region_ref(subregion); + if (mr->owner != subregion->owner) { + memory_region_ref(subregion); + } + QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->priority >= other->priority) { QTAILQ_INSERT_BEFORE(other, subregion, subregions_link); @@ -2683,7 +2686,11 @@ void memory_region_del_subregion(MemoryRegion *mr, assert(alias->mapped_via_alias >= 0); } QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link); - memory_region_unref(subregion); + + if (mr->owner != subregion->owner) { + memory_region_unref(subregion); + } + memory_region_update_pending |= mr->enabled && subregion->enabled; memory_region_transaction_commit(); } From patchwork Mon Jul 8 06:55:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1957832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=CVHIBlG6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHZj96F6Xz1xrP for ; Mon, 8 Jul 2024 16:58:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQiIu-0002cR-2e; Mon, 08 Jul 2024 02:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQiIr-0002Oi-Ce for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:50 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQiIp-0001xd-QV for qemu-devel@nongnu.org; Mon, 08 Jul 2024 02:56:49 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-73aba5230b6so2253738a12.1 for ; Sun, 07 Jul 2024 23:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720421806; x=1721026606; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MN/3EfVBXv6jlnRXRpQP7cJiMDwiSYrMczZXVrsioJo=; b=CVHIBlG6ZYWbm6eW/FFo4zw6tgCIxUd4I8YE1vobOK1hismy1p1kXvIXr7+y804g+Y T2vGjxo9c0D14yqxSYy7X/N/h8uh5gZfmxPI2+YUMkA9TTGoXzGFzuc6sTcXIuN5atRj 5a59DXKScNUlUk1VYgMi/zM+c1Yn7ab8XT5OnaZDcpsEvTJ7RAaMSgssCNVV9nDAXZG4 pt1wEW80x4oMjAsgfnIhHjubT9YGgtHPr9llmoeHAnf9QKopChZmBiuqwHJrnAuUyRar XzjBXFgCJapN7GzFfREuHC0X9BpfKqI3Q77MVec0FMrqxnqlQR5m6n+3nXI0pqYjjpcE Q80g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720421806; x=1721026606; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MN/3EfVBXv6jlnRXRpQP7cJiMDwiSYrMczZXVrsioJo=; b=OiWYn4L0jnu9JQamA06weQ1HLmFWMxAjQN6KqaQg5CBwWUKJbA6iS8n2EchYLrQkAz nvwdCFvLeK7Hdv8WDAc9S48FfAtDwvqoHJZEaw70R096jQJCpzi8qJ0zYoeUuEjfUKdY NesMObdvN1J5osYF3mKSJ4hzawwTFeYoqO8G/vF2g+QYTSLaM5OG7r0sVk7NBphZaUky pn9gGlI3GNU0nLcb6LxLm63IgIlBPo0wLOWBHdC3Wq/ZpLJkxxCFO24EQ8jKAAq/NbEa FvrotpmeFy5FkqJansnsuc8F0NfENni1YvEgoCt6uWxVcO1IDsCym6J0NBxihF8/ILUk gO3w== X-Gm-Message-State: AOJu0YzUCYeDsz5r+zMVuYubAzT7oc97UD8qtoqni/683QSzb6lPKesA It0sGOxjFzVgQ0aRWJER5uEXUSF8P5SRzAH3ZJYeiyVHzFKcloTbz6hxscfFjQw= X-Google-Smtp-Source: AGHT+IHP6b2+9XmIFVTQc3FtbQmi+g9ayoGwvJXvh/X9w5iLuVeTzCzpwSPN6ELi+UNELouIc67xUg== X-Received: by 2002:a05:6a20:cfa3:b0:1bd:2c3d:ccae with SMTP id adf61e73a8af0-1c0cd203e34mr14896527637.29.1720421806264; Sun, 07 Jul 2024 23:56:46 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-70b27349696sm2284625b3a.75.2024.07.07.23.56.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jul 2024 23:56:46 -0700 (PDT) From: Akihiko Odaki Date: Mon, 08 Jul 2024 15:55:20 +0900 Subject: [PATCH v3 9/9] tests/qtest: Delete previous boot file MIME-Version: 1.0 Message-Id: <20240708-san-v3-9-b03f671c40c6@daynix.com> References: <20240708-san-v3-0-b03f671c40c6@daynix.com> In-Reply-To: <20240708-san-v3-0-b03f671c40c6@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::52a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org A test run may create boot files several times. Delete the previous boot file before creating a new one. Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin Acked-by: Thomas Huth --- tests/qtest/migration-test.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 70b606b88864..6c06100d91e2 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -144,12 +144,23 @@ static char *bootpath; #include "tests/migration/ppc64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" +static void bootfile_delete(void) +{ + unlink(bootpath); + g_free(bootpath); + bootpath = NULL; +} + static void bootfile_create(char *dir, bool suspend_me) { const char *arch = qtest_get_arch(); unsigned char *content; size_t len; + if (bootpath) { + bootfile_delete(); + } + bootpath = g_strdup_printf("%s/bootsect", dir); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { /* the assembled x86 boot sector should be exactly one sector large */ @@ -177,13 +188,6 @@ static void bootfile_create(char *dir, bool suspend_me) fclose(bootfile); } -static void bootfile_delete(void) -{ - unlink(bootpath); - g_free(bootpath); - bootpath = NULL; -} - /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's