From patchwork Thu Jun 27 13:37:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C8209C2BD09 for ; Thu, 27 Jun 2024 13:39:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKS-00010a-3R; Thu, 27 Jun 2024 09:38:24 -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 1sMpKO-0000x4-6U for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:20 -0400 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKI-0006Ko-Uo for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:16 -0400 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-37613975e20so32090265ab.2 for ; Thu, 27 Jun 2024 06:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495494; x=1720100294; 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=iP3blhpOG/UV/59pEfGGJ3KAPs2EsafUmQmrZ34OeNU=; b=ya1gGsoQ2CQVRQo+m5Qrb8oPuIrJ1iX5+rMCOhMPN02gxzF2MHP8z+5gnXjor9N3Gi kZRBcRkLN2HMZGkhfMJ4e5qY0cDZTOAjDKT5oECmIud2ZHjO6jIgZzhNaEK3Ju2+fKPI ZLZKZbo69iebt6pl6sa7KwMYS0UWJe22ZJ292mqkr2Z9uRrHrdUkPqnEJ1BON+Gz7rRl SVkT+odnLf1zk0EZD0MZEw8hWM9f57TVLj0mLSrPORxFmNCpxzRXpF0KTlOtxj1HrlzM TR544uyY7WXfbnocgO/Li7qe9s36C4AAkRk0BGHs8tiwQ3L8h4u+vxeAPnGRNK9BDPHl gIFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495494; x=1720100294; 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=iP3blhpOG/UV/59pEfGGJ3KAPs2EsafUmQmrZ34OeNU=; b=TPC7X6ILcb/HoAU9ts6W5Y5tepZjMutaMistAD6SAd19toUFkSvGCBbeMl3XJeJw9M Z8G9Vv2SEbFVty6utY+s66nYCz9YF8vrScFDcgALxHW5Pap2nFkAeR+b5CU6eNJalDKm PPhE6hY+jI2xWqjG8O/WQjzuiKSqYOE9xjhlhYe2hGtrfN7q5EeqrG0fGQiCEjdNV0yf IB6v/ceW9lRW+DWY7u08cMOfsOLhuJrXX0OIzHEKLL3Wx+n8BqXcZTBjXZo3wYhHOF2m vHRoBpfIsbZx0fj3Yb6RR9J9HNAAotTvtIK/V3OvAltklBs892rvBNSIScICcaWaFByu 1moQ== X-Gm-Message-State: AOJu0YwMmblqV3BZvmbMV7B2gw36H+/2nqQVCCG5f9aSSOySAuFwZc/0 Svj7CEd7tuRKXYCCB2BlKCr/gbO4K+hy+qwMQdEiukD9kUF5KBfImgrQmkfliwk= X-Google-Smtp-Source: AGHT+IHf3jIhWTbSTXHSifyb26fGEQBo1unk8u+4a2sfQG0Lwv5b0drDi6cRG7DTmmvL6lxvgvJh9g== X-Received: by 2002:a05:6e02:1a44:b0:375:b381:9ad1 with SMTP id e9e14a558f8ab-3763f5aa404mr177979675ab.6.1719495493754; Thu, 27 Jun 2024 06:38:13 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-72746793be8sm1089226a12.48.2024.06.27.06.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:13 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:44 +0900 Subject: [PATCH v2 01/15] cpu: Free cpu_ases MIME-Version: 1.0 Message-Id: <20240627-san-v2-1-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::12d; envelope-from=akihiko.odaki@daynix.com; helo=mail-il1-x12d.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki --- hw/core/cpu-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index f131cde2c038..a3073c17d098 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -289,6 +289,7 @@ static void cpu_common_finalize(Object *obj) qemu_cond_destroy(cpu->halt_cond); g_free(cpu->halt_cond); g_free(cpu->thread); + g_free(cpu->cpu_ases); } static int64_t cpu_common_get_arch_id(CPUState *cpu) From patchwork Thu Jun 27 13:37:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 46007C3064D for ; Thu, 27 Jun 2024 13:41:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKU-00011n-0y; Thu, 27 Jun 2024 09:38:26 -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 1sMpKQ-00010G-Uy for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:22 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKP-0006LX-9O for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:22 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-6eab07ae82bso5671334a12.3 for ; Thu, 27 Jun 2024 06:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495500; x=1720100300; 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=GK1NnhFlKONfJOQ1epeja3jVUC6tPChPm6e/EkyYkzg=; b=3dfUEHYUCKzfRk7JTHaTwWcEEyeH9EmUDesSahiUXQXRaAOjwIMN2m2BkjCSkiyV1L h1fkXkEGFmToUnYBsBc39jrsJcx8RZxiALKMndPOGtQKWgToLxj5SL/kWIWU8iT0cOma BhdLbdGqSd+wxfGv0xQ3abc9vGKwllX2JNCtyYSUJD3oi4NpB69Wb0n4qj2jy6RLWW6E Fppt3Hrbk050D8CDfCQogynhKavRTEYuwU8cPHEz4DTEaYKiTw1eq55JsR3l3Ovfyn0F S20DtImPfnrYkXlWh63M/mCo5f4WjuKBukeXFDOQOxcE6d0rOMJvmSdkf/956ShPZ0s0 3hUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495500; x=1720100300; 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=GK1NnhFlKONfJOQ1epeja3jVUC6tPChPm6e/EkyYkzg=; b=eiZMzFws1/8bf3fh8b3Ut5xwlK5ap2efXKeWpXsRpVSzIw99nDdbmRKzjF+G8USlkb 7g84y2M0ptgk/SD4OlSoQTkvlbDbxZ4Q366a3cU1CGrAeQ30nFnBot3Mw1HtopM0lP6f X1LLdSDIPYK//haOEnl3pA47979WA9Igr6B1DvZDPhTxJsx0B/pkv3R0AxEYQ6D/p32X 5fT5Bv8dEKUmcdYMQN4lYIPptw98bszGgh/m51pD1huAE8BITlA38DyVv9MGL6aMdlaC iCiMdAT0v5vioDVY01vWdHYDX+HFycdErOpUjTCvqxK1WCvXv0pJdGiGwITn/dwApXvm 6jOA== X-Gm-Message-State: AOJu0YwjMRXgZs24L5ajSo6lp7TZyX2Wxi+eE5iAI+dz7YSIgRMWBJnU Yv1OCjP3AMCcLP4POtUEzUM7mmqtKC+xPEf/UGudoGSzMNMEB+dHTdX1FrAF3BI= X-Google-Smtp-Source: AGHT+IH3egdUupwHg3/fKTQf59c7eE0cNW7DQzddzdTPcu/CpgemJeZtdnd9ja5WHZ+QSceM/GYFVQ== X-Received: by 2002:a05:6a21:3382:b0:1be:c6e6:a712 with SMTP id adf61e73a8af0-1bec6e6a7edmr4650330637.29.1719495499967; Thu, 27 Jun 2024 06:38:19 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac8fcd7dsm13226835ad.117.2024.06.27.06.38.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:19 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:45 +0900 Subject: [PATCH v2 02/15] hw/ide: Convert macio ide_irq into GPIO line MIME-Version: 1.0 Message-Id: <20240627-san-v2-2-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::536; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x536.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org macio ide_irq is connected to the IDE bus. This fixes the leak of ide_irq. Signed-off-by: Akihiko Odaki --- hw/ide/macio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index aca90d04f0e8..9c96a857a7c1 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -427,7 +427,7 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp) s->bus.dma = &s->dma; } -static void pmac_ide_irq(void *opaque, int n, int level) +static void pmac_irq(void *opaque, int n, int level) { MACIOIDEState *s = opaque; uint32_t mask = 0x80000000u >> n; @@ -446,6 +446,11 @@ static void pmac_ide_irq(void *opaque, int n, int level) } } +static void pmac_ide_irq(void *opaque, int n, int level) +{ + pmac_irq(opaque, 1, level); +} + static void macio_ide_initfn(Object *obj) { SysBusDevice *d = SYS_BUS_DEVICE(obj); @@ -456,8 +461,8 @@ static void macio_ide_initfn(Object *obj) sysbus_init_mmio(d, &s->mem); sysbus_init_irq(d, &s->real_ide_irq); sysbus_init_irq(d, &s->real_dma_irq); - s->dma_irq = qemu_allocate_irq(pmac_ide_irq, s, 0); - s->ide_irq = qemu_allocate_irq(pmac_ide_irq, s, 1); + s->dma_irq = qemu_allocate_irq(pmac_irq, s, 0); + qdev_init_gpio_in_named_with_opaque(DEVICE(obj), pmac_ide_irq, s, NULL, 1); object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA, (Object **) &s->dbdma, From patchwork Thu Jun 27 13:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A82CEC2BD09 for ; Thu, 27 Jun 2024 13:41:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKt-00019R-1D; Thu, 27 Jun 2024 09:38:51 -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 1sMpKe-00015R-0X for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:38 -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 1sMpKW-0006MV-53 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:35 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fa75f53f42so18712395ad.0 for ; Thu, 27 Jun 2024 06:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495507; x=1720100307; 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=H1Ud2sffuzrWRWcIEMkaft+gSFV/vM2qExG+yzsFHsg=; b=tOKzzI5S818bX1RcOKyIwWKZVxz8/r54xTNsQwNydWljGZga1ugk+/vcE+78DbdDKK zSzw2n2nBLUaMVn0QE+P/H0IGdr0xwEBfgF/fehCGtU7u7A3s3WXOSm3rc1TEFSHesDB qs8IA1Ecl8v3KHGWubjuQKgJUhEGOPd5r1/sUfHGmygbfJ0IGebPRLNOTa0qZKkQkNBn FmFN5MR1s0vKWP3YFmnYKSYQ71xMA5kqiBa+Xcz1ejOV24q75wIdm6l/YoJgVMBpWbIw uk0Ykm96GLf762CYZmZkxxTBT6GCa2UludZMzh2i5xkHyOBhWV/IVOD5gLlSvQ2rsxrN cWWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495507; x=1720100307; 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=H1Ud2sffuzrWRWcIEMkaft+gSFV/vM2qExG+yzsFHsg=; b=MiYy2R+bDs9twW36BjacCO/+unOT8Y+mspQse8LK+qB7w7yZ4CYM4Lq4bktsVj7zxL gFqBTYMCQle7rybWhxJ3ods3dQiZZaKSJai1Y34yY3MpnriejpUmXKGUHORhPXy7gbpa Icqy91AD1FjJWMoiBGG52f/wvoO+lcAf52oyxzpv9chcDvCzfBNUG6voMTt96vrOoiiF DYhapWGhioAfSgFztN7hmHWD/T6RYarzMFo95xNtoyCdpRwNJeiEXEn1V/s5iHCc1am4 Atf67GLNN88cwMy9vTqaQBEeo25q+Ew9JgFP7fdm//Can/xYvJu7venNgmpx9vCJanbx wGgg== X-Gm-Message-State: AOJu0YwiMpEkpYBv9ZI2oWati/DPRC59BZ8YYb6CvrFdPD8ed5LmMAYL GiC8Bs6yT12QvxzwbJh+cavB1H1cGv4/wQQTrKEPez0KJFgyOMNdGhPhofuVfHc= X-Google-Smtp-Source: AGHT+IGlthtRlIAOrErKWBa0d4JJXHENu4FzsbU9EBlxzWOmvVmo/stPsHEbzaIw8JmTtJTtru3wgw== X-Received: by 2002:a17:902:ec8e:b0:1f9:f559:d8c7 with SMTP id d9443c01a7336-1fa240c5353mr166234385ad.57.1719495506752; Thu, 27 Jun 2024 06:38:26 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac979f54sm13182435ad.153.2024.06.27.06.38.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:26 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:46 +0900 Subject: [PATCH v2 03/15] hw/ide: Remove internal DMA qemu_irq MIME-Version: 1.0 Message-Id: <20240627-san-v2-3-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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, T_SPF_TEMPERROR=0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A function pointer is sufficient for internal usage. Replacing qemu_irq with one fixes the leak of qemu_irq. Signed-off-by: Akihiko Odaki --- include/hw/ppc/mac_dbdma.h | 5 +++-- hw/ide/macio.c | 11 +++++++---- hw/misc/macio/mac_dbdma.c | 10 +++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 4a3f644516b3..1e1973c39580 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -32,6 +32,7 @@ typedef struct DBDMA_io DBDMA_io; typedef void (*DBDMA_flush)(DBDMA_io *io); +typedef void (*DBDMA_irq)(DBDMA_io *io); typedef void (*DBDMA_rw)(DBDMA_io *io); typedef void (*DBDMA_end)(DBDMA_io *io); struct DBDMA_io { @@ -154,7 +155,7 @@ typedef struct dbdma_cmd { typedef struct DBDMA_channel { int channel; uint32_t regs[DBDMA_REGS]; - qemu_irq irq; + DBDMA_irq irq; DBDMA_io io; DBDMA_rw rw; DBDMA_flush flush; @@ -172,7 +173,7 @@ typedef struct DBDMAState DBDMAState; /* Externally callable functions */ -void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, +void DBDMA_register_channel(void *dbdma, int nchan, DBDMA_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque); void DBDMA_kick(DBDMAState *dbdma); diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 9c96a857a7c1..425b670a52a9 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -427,9 +427,8 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp) s->bus.dma = &s->dma; } -static void pmac_irq(void *opaque, int n, int level) +static void pmac_irq(MACIOIDEState *s, int n, int level) { - MACIOIDEState *s = opaque; uint32_t mask = 0x80000000u >> n; /* We need to reflect the IRQ state in the irq register */ @@ -446,6 +445,11 @@ static void pmac_irq(void *opaque, int n, int level) } } +static void pmac_dma_irq(DBDMA_io *io) +{ + pmac_irq(io->opaque, 0, 1); +} + static void pmac_ide_irq(void *opaque, int n, int level) { pmac_irq(opaque, 1, level); @@ -461,7 +465,6 @@ static void macio_ide_initfn(Object *obj) sysbus_init_mmio(d, &s->mem); sysbus_init_irq(d, &s->real_ide_irq); sysbus_init_irq(d, &s->real_dma_irq); - s->dma_irq = qemu_allocate_irq(pmac_irq, s, 0); qdev_init_gpio_in_named_with_opaque(DEVICE(obj), pmac_ide_irq, s, NULL, 1); object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA, @@ -513,7 +516,7 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table) void macio_ide_register_dma(MACIOIDEState *s) { - DBDMA_register_channel(s->dbdma, s->channel, s->dma_irq, + DBDMA_register_channel(s->dbdma, s->channel, pmac_dma_irq, pmac_ide_transfer, pmac_ide_flush, s); } diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 2a528ea08caf..3450105ad851 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -114,7 +114,7 @@ static void kill_channel(DBDMA_channel *ch) ch->regs[DBDMA_STATUS] |= DEAD; ch->regs[DBDMA_STATUS] &= ~ACTIVE; - qemu_irq_raise(ch->irq); + ch->irq(&ch->io); } static void conditional_interrupt(DBDMA_channel *ch) @@ -133,7 +133,7 @@ static void conditional_interrupt(DBDMA_channel *ch) case INTR_NEVER: /* don't interrupt */ return; case INTR_ALWAYS: /* always interrupt */ - qemu_irq_raise(ch->irq); + ch->irq(&ch->io); DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__); return; } @@ -148,13 +148,13 @@ static void conditional_interrupt(DBDMA_channel *ch) switch(intr) { case INTR_IFSET: /* intr if condition bit is 1 */ if (cond) { - qemu_irq_raise(ch->irq); + ch->irq(&ch->io); DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__); } return; case INTR_IFCLR: /* intr if condition bit is 0 */ if (!cond) { - qemu_irq_raise(ch->irq); + ch->irq(&ch->io); DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__); } return; @@ -562,7 +562,7 @@ void DBDMA_kick(DBDMAState *dbdma) qemu_bh_schedule(dbdma->bh); } -void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, +void DBDMA_register_channel(void *dbdma, int nchan, DBDMA_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque) { From patchwork Thu Jun 27 13:37:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BEB8FC2BD09 for ; Thu, 27 Jun 2024 13:39:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKt-0001Am-OU; Thu, 27 Jun 2024 09:38: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 1sMpKh-00016p-Pc for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:40 -0400 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKd-0006Mw-Ot for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:37 -0400 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3c9d70d93dbso5277945b6e.3 for ; Thu, 27 Jun 2024 06:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495513; x=1720100313; 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=ttjpe0Zy78QRlVICf1w8g9FNolQGU7Fei8nrc5VuhDU=; b=KZ3u8CeLG3wv+E4DOhDghvmofyc5dHvZx+zctdB75dA3iRSS7P9F6EEJl0jF+Sy3Ow su8DGKXcHu7eS7bBb77dScPdNAp+fmOajodGE3VNJfG+q5Wm+q4sOIf+HHEHS7F8sb7V NjU/KsKkR6Ga+VrG+fd0YoKfYzgRB7QitKVlP93pIyQxVag6cwBX8DIgapo/tZypxj3r 83IhFfz95Erxwnvf6wUVhhMyeVGcPr5oMlNtcn89Yw/qihzSy9m81DpwyDTWKaM1Ag6L ouWHKSAsgmGZMjdgMbnwzJJhdhK97RhW8RdiIjQ8NwuhFnmR5OXDgYrWpbp415UIMk2X FlAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495513; x=1720100313; 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=ttjpe0Zy78QRlVICf1w8g9FNolQGU7Fei8nrc5VuhDU=; b=LsbFjIA/CBkH9CHpbLv0a60z67YsNbeNxkOtdvtBPmdCRGCmnPTou2001QUwH2kIAi P0QKzLGnbyGlOQqYYrtxkzfSG+ShiLA3UdN0pTSGDaLxisomIzekiGww/G2WR3gkLklD 8nGH2x6+OhJLuBRtTrSuRYp3ZGygLEssY1ea9msrsnwpxAL/cFCoUAMcmgGXR0i1YX4t VGFuR4yEBuKav5GQd+Efi0H2RH6rYFBvZcYnvXzWPiV846GEjKz+/KUIDwh3Yyp2UJ7/ +57mRLjYdcWwCfc85gCVWXFaj2MXf/P4lhFPCsKwy0+3zWCLkem3tRCHnGmIcDuhye4R wH7w== X-Gm-Message-State: AOJu0YwIvWD9oUlDKIvPuHuIKPa7m8RRbx1RZCzPFeNAm990kW4ettOj r1KNNniGXgGwbQKBLSmRBYyfdmo21gJPhwaVd9BeoDvIIMk1/NmN8sA+c4If8sc= X-Google-Smtp-Source: AGHT+IFN/aBIDxZnjlWX25a4chKiYG8RrkIkEkci/W6w41POb8g9HB7cE1bIk127xZ5DG/n29PtxHA== X-Received: by 2002:a05:6808:1813:b0:3d5:d7f8:a3e0 with SMTP id 5614622812f47-3d5d7f8a7f5mr1927401b6e.32.1719495513016; Thu, 27 Jun 2024 06:38:33 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b48cae37sm1337617b3a.3.2024.06.27.06.38.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:32 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:47 +0900 Subject: [PATCH v2 04/15] hw/isa/vt82c686: Define a GPIO line between vt82c686 and i8259 MIME-Version: 1.0 Message-Id: <20240627-san-v2-4-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::22a; envelope-from=akihiko.odaki@daynix.com; helo=mail-oi1-x22a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes qemu_irq array leak. Signed-off-by: Akihiko Odaki --- hw/isa/vt82c686.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 8582ac0322eb..629d2d568137 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -715,13 +715,14 @@ static void via_isa_realize(PCIDevice *d, Error **errp) ViaISAState *s = VIA_ISA(d); DeviceState *dev = DEVICE(d); PCIBus *pci_bus = pci_get_bus(d); - qemu_irq *isa_irq; + qemu_irq isa_irq; ISABus *isa_bus; int i; qdev_init_gpio_out(dev, &s->cpu_intr, 1); qdev_init_gpio_in_named(dev, via_isa_pirq, "pirq", PCI_NUM_PINS); - isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); + qdev_init_gpio_in_named(dev, via_isa_request_i8259_irq, "i8259", 1); + isa_irq = qdev_get_gpio_in_named(dev, "i8259", 0); isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d), errp); @@ -729,7 +730,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) return; } - s->isa_irqs_in = i8259_init(isa_bus, *isa_irq); + s->isa_irqs_in = i8259_init(isa_bus, isa_irq); isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(OBJECT(d), isa_bus, 0); From patchwork Thu Jun 27 13:37:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4678CC3064D for ; Thu, 27 Jun 2024 13:40:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKt-0001Al-OD; Thu, 27 Jun 2024 09:38: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 1sMpKl-00018F-Tl for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:46 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKk-0006PI-B8 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:43 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-706b14044cbso868103b3a.2 for ; Thu, 27 Jun 2024 06:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495520; x=1720100320; 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=y3Al/DkWdr7oNtWQmlrRFITkQePTtq0AALK4OUYETUY=; b=lPeMh6BUSXMhZknRYOo9Rira3NbdGSHeTgUErQqeDFzcqRXpqnKWb+2P5HblpLvOjj jQkXxbfRLKIiRj6/jM+my5ZA3LZB7TOFK+LQEfliyYJlsl/85JoKcXIleTMi4sopiup0 nOF+zPFRi8bvaH1DGXnde1IlEoC4nbUVOxR2yQEPZXdOQBs8AQEJ8T98MZe3rlYhVhl1 eylp8LDedrw0h6YDsBMphfxWVJUo1jQbm2fHjnIee25A2eLc09eRGmim2OJwZAslyfv2 99zKHsTyOBkDBOBCmBMKqr8U1NZpdhpbSaoSl842X+9mZp/RwvZyZfdWqCGdraRy5LvS oA2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495520; x=1720100320; 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=y3Al/DkWdr7oNtWQmlrRFITkQePTtq0AALK4OUYETUY=; b=u4WbwAIAStdoneyV58CMcwTDXqXo1E3iIGLcsVwaGsR68DyRjVx9bAeUXCjTymEO91 gTfpgSo0PloHA+DFOQCxbZEsEXtZD1BJYRQyGodCuzvt+BpU0/PUnDdFF8qfOcW21sbL Vr+h4EZRbd/xFPQpam3EHJwpRWvZNjrRn09F3c6frfhOxgmQcPBQ7YyiEGdBqRdTtMQF IqlPxBc/PmfRUKTdJmQ6shO1SORp73fflA3Fwij4hrayKHzY7ztjAWWOXaYv377ZPnlS lEdUD4AO5r0uewC7vW+92qIfzGSjRcc7o9AcW1P+xWfedvVgpO/RmBTr12+IyveXp/sa lFKw== X-Gm-Message-State: AOJu0Yw0wBGtGtQy5nq3ifG6K3pwHuhiITLaYmHT+0e04p90CuAuSrp0 R4gYCZw8lZOfSt9sLQRJFP+bP6SMh2jsikMzInVUMWtkprjxAhyPYmGW9nT8+78= X-Google-Smtp-Source: AGHT+IHixATdz48pQww+mu3HBcr4wVkdvUAZf3x1lVxRgTZ61Ksvi18JOkIMtiIBBjcldi4x5EJhUg== X-Received: by 2002:a05:6a20:a8a1:b0:1bd:22cd:a639 with SMTP id adf61e73a8af0-1bd22cda715mr7144503637.8.1719495519790; Thu, 27 Jun 2024 06:38:39 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2c8fe9f1c35sm1441098a91.33.2024.06.27.06.38.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:39 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:48 +0900 Subject: [PATCH v2 05/15] spapr: Free stdout path MIME-Version: 1.0 Message-Id: <20240627-san-v2-5-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- 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 Thu Jun 27 13:37:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DE726C41513 for ; Thu, 27 Jun 2024 13:39:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKx-0001Ek-Kj; Thu, 27 Jun 2024 09:38:55 -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 1sMpKw-0001Cw-8t for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:54 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKr-0006Qe-6T for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:53 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-25d5333989dso1256777fac.1 for ; Thu, 27 Jun 2024 06:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495526; x=1720100326; 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=UtuCMhxUWw1DUkDzmxPc06M4yVAzJqdA967oAcSFqUQ=; b=F1dG3X3TWPB9MXJKsI7+ya5OpeWHWBLL17c5SmjmZ76jc3XRALRPlsyyqqoCV0RM0j FnY2hLEAiMpBP2hfUnEZLtibcTvC/iX8v0wef5P6iDuChmKG5HrlCMjCfQ8b1+nNkK9o CyqPFUIlT3EIwXOEyQOxyloxcLwfvAVVEFWLxZmOrxgFxaKDm/unbVI1MhsO4qBuqE2u aXBOw2M14si5rxZVDKuUsCdhYBqtvTIscjlvAVK9/stpjSxe7upnftCFRSu2KUhsDlrj fLxAvkoFJaZoo2o4XGEw7l/pPObHJ0oRbCoScoi4rAJd2zDpJWb2vg7WhLNpK6P3HfVr QZOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495526; x=1720100326; 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=UtuCMhxUWw1DUkDzmxPc06M4yVAzJqdA967oAcSFqUQ=; b=v9uqnYBMbfpktqK2rT6us8vLRDnQbvps85d2dxzxPyUWSu3NOWJLpvcd7cjifDWTLW wM65DKkdvxOcQI4F3/onsTPGY8xpnZQog87111aLsPPKlMcjT4ja9fje52w/CinLyVMC O/EHkBnzA1R83T8DvW0ANNor0/qgBb9rLD7rREZZJwDR9wH3NLaCg9sNSl7wXQpkXhbM tMUwlmIBznJ/eL/lYekvgfs+KJpuamQbaLGdHukw6v2Z/cRC5s7Xr+YaW+ftntVPJ+XO kVMLKTdOazbYL5Avnl8liIERZMYQcW2ycxlhGfKPenYIiH8DzJ2VcFS3fzdAbCVvvgRm 4klQ== X-Gm-Message-State: AOJu0Yws1b2mcMPzx3I7FhLdmjI4VCs8BjCXhpnFpbKWXdapFpzVwr1S hB1E73gOCCkUF/Qp2LztPSM4uhd9dBuHjfMXgQMj8hjDJSdUSLzMywWuGWqOHLk= X-Google-Smtp-Source: AGHT+IE68QrvJItc29/tXsB2hhrn925IlwaD+nMu6WIGfpGM9AqZp/e9DNODXCKlCLfsXKLgBm7gVg== X-Received: by 2002:a05:6870:9692:b0:254:c27c:1b19 with SMTP id 586e51a60fabf-25d06ec3501mr16894009fac.54.1719495526263; Thu, 27 Jun 2024 06:38:46 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b491c898sm1333327b3a.77.2024.06.27.06.38.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:45 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:49 +0900 Subject: [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access MIME-Version: 1.0 Message-Id: <20240627-san-v2-6-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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=2001:4860:4864:20::35; envelope-from=akihiko.odaki@daynix.com; helo=mail-oa1-x35.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org FDT properties are aligned by 4 bytes, not 8 bytes. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- 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 Thu Jun 27 13:37:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0F429C2BD09 for ; Thu, 27 Jun 2024 13:40:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpL1-0001KA-1Z; Thu, 27 Jun 2024 09:38:59 -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 1sMpKy-0001FF-0Z for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKw-0006Rj-Ci for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:38:55 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1faad2f1967so4741795ad.0 for ; Thu, 27 Jun 2024 06:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495533; x=1720100333; 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=jOjlX532fbSm/MfzxqkUiGMJdKmyu/k4tTVPVBmckwI=; b=p3qr0+SkmQk1jz7lZKJzBUqbMtbpK0mKS84hCbY8OIrNu4ryc/kwJ34HxyUK6UGGos Y0fqPcQBSitSEMI0PvER7pxpHlnqGTR/hH3SOrSBe7RusQ0uWT/Fo6YQAefIGvAg5amz yn/0Au5TJoeWbA1HzWHUbzPc6ygAgCiczONHwqCtycYjRD3g6vfHCXQVIFJFX4mhvELS Zpf2FZDI0L44Tzgq6/AXC3tnf2Y4OMoqPnvI1tk2SggsTxhkWtyr5EpJGwo1duUk43yj mCIBlXF/6uOprrzO7s6VV/pA2YPV01YDOKGjyQlSRfObhgPXrUknnkVa1WDv0lUlyXjz g5TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495533; x=1720100333; 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=jOjlX532fbSm/MfzxqkUiGMJdKmyu/k4tTVPVBmckwI=; b=N0Uu5nmhuc7O+W0rosJOy8VrDZnKoDhvBzRbFk8qM7XcgC8UIkZB3j0+qybIugGr6+ 8NVCNiZXS4gp9UMXaO32O+QwqAh1Nj8395CoId26TMdlq6m4l7Th4961tzXOqjoBcgvl wCy7fZmOVyVoS4EiRpuIeI+DuavQyYNPN1IPS/uZzkPgmmKDitSNogmGlSgCCPaAO/m0 X6V+b9S1KbjZY+kA5TqUugLHMvipZVLFgDF+/pEnpn6TODoG7y6QLPPq2RMtREBzd3wX p1C/CIIZe2FSTQKFkKk0p9fcA6HruGXoy/MrwEslpNBkIGS5ZK6emppiLluN6siswzmt 9yVw== X-Gm-Message-State: AOJu0YxsE/OmyY4hg1M2MzWmfRDjOMAydeHKDoSYygHZP1AiJ5llvYX3 CyyDZyyskx8RD4+rl5VjoQnqMD4j+PCWHIs/NGiWVjz1bvwV+CmDM19elBBfnGM= X-Google-Smtp-Source: AGHT+IEsd/pK7793+mXsdWMSRBASbbLo0NH3GV736hPrqauCSFkiwnjE8CzZdSLfrh8RDV6qe4Qb4Q== X-Received: by 2002:a17:902:ea05:b0:1f8:62a1:b6af with SMTP id d9443c01a7336-1faad4c7cc1mr26078615ad.21.1719495532682; Thu, 27 Jun 2024 06:38:52 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac999bfcsm13185575ad.234.2024.06.27.06.38.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:52 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:50 +0900 Subject: [PATCH v2 07/15] hw/virtio: Free vqs after vhost_dev_cleanup() MIME-Version: 1.0 Message-Id: <20240627-san-v2-7-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::634; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x634.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki --- hw/virtio/vhost-user-base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index a83167191ee6..124ef536206f 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -223,6 +223,7 @@ static void vub_disconnect(DeviceState *dev) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBase *vub = VHOST_USER_BASE(vdev); + struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; if (!vub->connected) { return; @@ -231,6 +232,7 @@ static void vub_disconnect(DeviceState *dev) vub_stop(vdev); vhost_dev_cleanup(&vub->vhost_dev); + g_free(vhost_vqs); /* Re-instate the event handler for new connections */ qemu_chr_fe_set_handlers(&vub->chardev, From patchwork Thu Jun 27 13:37:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5046DC2BD09 for ; Thu, 27 Jun 2024 13:41:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpL5-0001ND-2j; Thu, 27 Jun 2024 09:39:03 -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 1sMpL4-0001Mx-6n for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:02 -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 1sMpL2-0006Tq-Jx for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:01 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2c7bf925764so6363939a91.0 for ; Thu, 27 Jun 2024 06:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495539; x=1720100339; 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=6PV0Jwd3ow6/n1FaesIzFULRk/ni0qv5jyS/+wLDXMU=; b=QcqaHWYjlNZDngp0PqSn+pMq3x0BilHZQthv2tTqvbr9+YCyvO0Truu3HBqc/7fPG5 udps2PfuB9SJ/OrsaYqirQApm79m/dQguD6E8XTKC8aL9IT/lQUJHGzvvaSeRrDiMd4R NektLqDoP/2J8pTbMWtCsfj3q1whoXT1SVNPqfBF/imkpTYr+ZTuz6GHbpkVe3Bkcamo RyE4CPjHFoDI1roXhquShMJrW0hYlpxSPi8+5IFigPDFBxjF/WrsJJZJ32T0y73JU7Qk FVYgvPABJBvZeKf6NClZw+G3pTEqQ3rpZfNme9CvSALwIeSp7mKlNA3FOp8x7E3eoq+3 Xbpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495539; x=1720100339; 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=6PV0Jwd3ow6/n1FaesIzFULRk/ni0qv5jyS/+wLDXMU=; b=SqtWNKWPWfU5wjWnCAbgLZKr0OKa044QR7cKSdnPusb4KvS+RPfGUTOAFu9pJBzhvk oyy05TVVtkiQMKX1hLNd/LOFZzF9xyUleuQN+Sp0W2YQP28oA3k9De6wqCDcAqbjD401 E81NjXNBXX4oYznEz14PLjYiY2YEJkWOWLqyH0n5jGnJPunwl4boyPSsIRj0kcmoSEp9 t1OQK/vyz3nQtAzVJ2VpDKk9XY49j2eh0uhlBFHZjrbrVyCMLr3NspbNHGUjXSLu4+fq kW3OomzclMvw4ukpORmw4LMo5nMEkftFnW/5+5DEW2QWBRy5qqnl1hZWfbeQEMG/Ggma swXQ== X-Gm-Message-State: AOJu0YwMsdrzL5Eb0jbfsQ8YXmKE/6c8GkCf5Cg7gXNmE66XG5jLCB1A 4CBUOsj33BD9c9sIFnUpU11LBK9n9Q1cvxnvTqpJTVbBycRZRl7f6eIzU1jcVT4= X-Google-Smtp-Source: AGHT+IFhbuBpEabR6Yyi6TNRReI6E/qCCZTqe1ej20jTUBAg55/M7mIawYiSZUH0E8xhDFfhuRfkqg== X-Received: by 2002:a17:90a:917:b0:2c7:c914:69 with SMTP id 98e67ed59e1d1-2c86141cc09mr12260587a91.43.1719495539229; Thu, 27 Jun 2024 06:38:59 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2c8d7e63936sm3609235a91.19.2024.06.27.06.38.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:58 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:51 +0900 Subject: [PATCH v2 08/15] migration: Free removed SaveStateEntry MIME-Version: 1.0 Message-Id: <20240627-san-v2-8-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Xu --- migration/savevm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index c621f2359ba3..10b261823b7c 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 Thu Jun 27 13:37:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7129EC30653 for ; Thu, 27 Jun 2024 13:40:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLG-0001Zc-GH; Thu, 27 Jun 2024 09:39:14 -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 1sMpLC-0001VV-7S for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:11 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpL9-0006Uz-H0 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:09 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1faad409ca7so4181175ad.1 for ; Thu, 27 Jun 2024 06:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495545; x=1720100345; 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=6MgmHQG/2ylhpi7rbXo5VyylZZdoY/6uUXCCV6pKunI=; b=3YEktQY4Cf9mZ6ojcJDmxaq+/SRt+RI0N6N1Vsn4KC9bV+AObK7oZWXsZoPohCBynS B474C4l4Gm4uFKO8qjb941adW3fuD4TNFGUq4BKrO3mMwtO8TPIBuQs2k87RpeWes9c/ HNRmpoL3bEec3/Q0D8EkADytvqC646u2UQ9nyzDKqxMlC71sZ9Q9iJyDwAxscxpnjLSA wqh+94UWPrOBNfS+492EmEtqWrgu0QVN2snPVx8dGFC/MwJZdmLZTRStjMnLO+dhTmCB R3+ZAd0s8QuBZbyh9F1b6ykYQ4uxwAi2/SHmKE5IX86qYGm9kGJaHddVeoe8q/c/hl9W YqWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495545; x=1720100345; 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=6MgmHQG/2ylhpi7rbXo5VyylZZdoY/6uUXCCV6pKunI=; b=a7cibJZBiq30t8nrzDYf2jgftOT4amw00UOHNiTKHDOTXMMSNClrIH9QOSq8v59FcP pHX7m/S4NQecHWu+Zu9kDgxL9mQDD7WmPsFSV4q/JkBxVZxZyJdW0HNri7CT+mb+X2qA qIuSCkF1UuHaLOstzh3wnCMq2VYU14SQ8GC/6VfQb+wXqJxWue2a0Wa5vs4k7TRJsEbT 6G4B8VigR5rczWt1Sn+mhrkN1YWQrFqzVNObLQIkZLiEsLZWjNZ4jCmWSgiPmEcIfG39 M39xYNBhBUOmdqy+O3f75Hh0JXOJQ+S82QcSJCR39WjWl2zmhsQomLWcRIcwjIrqVXDx CNzw== X-Gm-Message-State: AOJu0Ywh96dCoBP8gXXM1/nxCP2NrqTW36JCIBIC/vbjE6bH+AakFSz1 Bt5aOPl7pQUAxAByKLNcNdJwkFbNfizJfE2W0g1SXgKGIbmQzmyBDCn+NlYcSr8= X-Google-Smtp-Source: AGHT+IEOQ/m6W0EaVrS87L9pcyV7z7eXSKdvdlz5a1XfK+ZrnOVnl6VAIXcrZ4tj5pOxawKYTrGRaA== X-Received: by 2002:a17:903:228a:b0:1f6:dccd:c6db with SMTP id d9443c01a7336-1faac2df4b0mr24948755ad.30.1719495545496; Thu, 27 Jun 2024 06:39:05 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac9791fdsm13201035ad.127.2024.06.27.06.39.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:05 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:52 +0900 Subject: [PATCH v2 09/15] memory: Do not create circular reference with subregion MIME-Version: 1.0 Message-Id: <20240627-san-v2-9-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::633; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x633.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A memory region does not use their own reference counters, but instead piggybacks on another QOM object, "owner" (unless the owner is not the memory region itself). When creating a subregion, a new reference to the owner of the container must be created. However, if the subregion is owned by the same QOM object, this result in a self-reference, and make the owner immortal. Avoid such a self-reference. Signed-off-by: Akihiko Odaki --- system/memory.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/system/memory.c b/system/memory.c index 74cd73ebc78b..949f5016a68d 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2638,7 +2638,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); @@ -2696,7 +2699,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 Thu Jun 27 13:37:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 87A36C41513 for ; Thu, 27 Jun 2024 13:41:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLN-0001cr-7U; Thu, 27 Jun 2024 09:39:21 -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 1sMpLI-0001af-CE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:16 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLG-0006WH-LX for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:16 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7182a634815so4429106a12.3 for ; Thu, 27 Jun 2024 06:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495551; x=1720100351; 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=Yvl4pAdGzIA/y7zkDQtF9iZK7ptxPpuy1nIWlUirby4=; b=uaF7zszFj+kz80phxfb8lk1Ot7je7a0Yr3pvZry3QyHavtrSngDzdm41+eZIv469fw Ay8TA826kLpRlqmQP5XbY8ZxQSfuFCWcllxD1aFf9CPfwREnX04rt3BcYUekDP03HV4g zV2QzWwxSQRfY2cwGs8E+EvunT4q2BsKRoyHN4+jJ9YTw/N2ahjP4oTZdK+LWs/UFnQu rpeLmkuMFzLErtn3dPJ0qccx/gUeTVI9QLTPzfxUGkB88i82CkXVJxQnNZSlsig7+7QS 0RN4olyKeat03LnZdY7tGSbvqlXWizIZsfq/kVl8q3ia3PBrQq3pAQ8SOvT8EeuNCdtl bRNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495551; x=1720100351; 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=Yvl4pAdGzIA/y7zkDQtF9iZK7ptxPpuy1nIWlUirby4=; b=k+VAIeG7VYnUpJ5JohNmNhYmjC+LPmDLqbXs0dYR5hkWSGMtNV8ZBtHBQheHiT7krF y49bJyQoKraqtlZRSzSJTd8Hb/psqQbY3hq6t02meSmUcb/loFBDVczgPjAjweflzL2H M+YtOi+YEtmqIjAS12yBNMN/zEk3VZHHgrG5tl/zRcBDAofhVCgtQixEYNHNhDjY9137 FNVW/4lWlF2rMRYpK6LgjW+BRKPBFpootLrHWfxH+j1NHBLatPqZPk+rAJvd4e+QSO5O ww+LNVWJD/GFog3bquWfoSP/drF8G+z5rtTTFIJP0b8RdKyn8YzPW1z096qHfMDqeiwP mEPA== X-Gm-Message-State: AOJu0Yy5Cy2rF5WGhSBWB6QdhDnIXzIsYzO3a4rs3IKtNB+Ih+QizhA1 5OOxRJYotnShMPvVfWK2r1S2bOTcyIGBGNYMeTH5peJJb7ev29UIWpQS1PLRAzc= X-Google-Smtp-Source: AGHT+IFlBGhq8j7ZQMV5qMOOdFsofTqP+NF+lT2o/+u4EH2nCOdF15FzOTWiA/9TuXR60cGyfzX9NA== X-Received: by 2002:a05:6a20:12c3:b0:1be:cbe9:f765 with SMTP id adf61e73a8af0-1becbe9f89amr3175993637.18.1719495551639; Thu, 27 Jun 2024 06:39:11 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac9a73fcsm13434485ad.252.2024.06.27.06.39.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:11 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:53 +0900 Subject: [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full() MIME-Version: 1.0 Message-Id: <20240627-san-v2-10-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::530; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x530.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A test function may not be executed depending on the test command line so it is wrong to free data with a test function. Use qtest_add_data_func_full() to register a function to free data. Signed-off-by: Akihiko Odaki --- tests/qtest/device-introspect-test.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-introspect-test.c index 5b0ffe43f5f4..587da59623dc 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -266,7 +266,6 @@ static void test_device_intro_concrete(const void *args) qobject_unref(types); qtest_quit(qts); - g_free((void *)args); } static void test_abstract_interfaces(void) @@ -310,12 +309,12 @@ static void add_machine_test_case(const char *mname) path = g_strdup_printf("device/introspect/concrete/defaults/%s", mname); args = g_strdup_printf("-M %s", mname); - qtest_add_data_func(path, args, test_device_intro_concrete); + qtest_add_data_func_full(path, args, test_device_intro_concrete, g_free); g_free(path); path = g_strdup_printf("device/introspect/concrete/nodefaults/%s", mname); args = g_strdup_printf("-nodefaults -M %s", mname); - qtest_add_data_func(path, args, test_device_intro_concrete); + qtest_add_data_func_full(path, args, test_device_intro_concrete, g_free); g_free(path); } @@ -330,7 +329,7 @@ int main(int argc, char **argv) qtest_add_func("device/introspect/abstract-interfaces", test_abstract_interfaces); if (g_test_quick()) { qtest_add_data_func("device/introspect/concrete/defaults/none", - g_strdup(common_args), test_device_intro_concrete); + common_args, test_device_intro_concrete); } else { qtest_cb_for_every_machine(add_machine_test_case, true); } From patchwork Thu Jun 27 13:37:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B3C20C2BD09 for ; Thu, 27 Jun 2024 13:40:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLn-0002Ma-QF; Thu, 27 Jun 2024 09:39: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 1sMpLO-0001gJ-B6 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:23 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLM-0006Xf-BS for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:22 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7067108f2cdso4256063b3a.1 for ; Thu, 27 Jun 2024 06:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495558; x=1720100358; 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=bOTqGJASqbN+xq2cvidGDOZj3Yf25P/ZsUr7Yh4tZjc=; b=sJQmCuwgbShIncPBnBQaiqJgjpg/UDYFFr2kfbd4pvIRt2mCj2dp+WJ5TFD9PeJIDn gbrKLS1zKH51hwCQuoPXnHh4pUxlM4D+lHMY046ucz8ByRn9f9yj/TGK4k/vAC+pNDEm N3TxBayynRDcRiCH3hYIsCqgqrHihXw9rxULSrFCLUIHgp3fGyo8J8O2fHXBVQcYrmWn XMMTyhW6Pdf6gw/v1KNUz+FbssgTh4Mm+ueVX2DOaTY0LZI4LKmcy2kX1NuzJiNu3/mB qLY5pKO/iG4dR6tiVpc3/CzrXxgVoan7q58jzfa8NvHasJgosdHTHC4spc+FfwsofH1Y p2ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495558; x=1720100358; 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=bOTqGJASqbN+xq2cvidGDOZj3Yf25P/ZsUr7Yh4tZjc=; b=RoUM2X6eai3vb3B2QDXjcHELegeDhcOfRAI8liksbgWOiUxU2wHXkyptzNJ0O5l7uJ M7betqr8QtbZ0PDeoAjzWHcUUsxqd4eFcS0nU0IGQ5e+b7wwJAxJPcolWNbFo3DImoE5 rY6iKLcfhPr+XflaGAlVrPiXCaOpS+Lc34bQbqRD8dVIwrAxgvuL6gL0ZQl0mZ/+oDae 086tulRQGaMvoSVzFAjenKId0qw1pwy4DjcBVsokGc0A/iruKncaMQq495O6gRfztjC0 Dxh0WzEqeVQuz3Rf6t/tDj74qgemjZJp2ClaD/kdFlOXCqr0EF9iyCBKGkvYH1QmfDdd LYVg== X-Gm-Message-State: AOJu0YypLzJiVxpyNXgsfmkH5Jo75UtGyaStPCqm7otSgC7FvVN9dhVX uIDEuwLHh96+Cp8lPA2Yx/aFWACPOCZLq6b6Y9K3YtQ0bAiIvs4v+PwyN+Gyiec= X-Google-Smtp-Source: AGHT+IEWG5kSC0j6fCgKsJMYPuPASJg34e7zfzd1IrPkvGFbb3HCzQ4eIvOXePGeln+k/PXzaWks+w== X-Received: by 2002:a05:6a00:138f:b0:706:6895:3c85 with SMTP id d2e1a72fcca58-70670ffbfb9mr18643834b3a.27.1719495557805; Thu, 27 Jun 2024 06:39:17 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b491cd54sm1338229b3a.79.2024.06.27.06.39.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:17 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:54 +0900 Subject: [PATCH v2 11/15] tests/qtest: Free unused QMP response MIME-Version: 1.0 Message-Id: <20240627-san-v2-11-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::42a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki --- tests/qtest/libqtest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 18e2f7f28278..f89da7b80797 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -744,6 +744,8 @@ QDict *qtest_qmp_receive(QTestState *s) response, s->eventData)) { /* Stash the event for a later consumption */ s->pending_events = g_list_append(s->pending_events, response); + } else { + qobject_unref(response); } } } From patchwork Thu Jun 27 13:37:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2F8DFC2BD09 for ; Thu, 27 Jun 2024 13:40:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLp-0002Td-5z; Thu, 27 Jun 2024 09:39:49 -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 1sMpLV-0001j2-J2 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:30 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLS-0006YW-5x for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:29 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-70675977d0eso4113864b3a.0 for ; Thu, 27 Jun 2024 06:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495564; x=1720100364; 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=7RVNKACznzXJwsczryHdNsSEUqVvGG/uCg/TYBM83LM=; b=cVJreDbrNyiOhrzWdpvWoa3z5kTvuLhjDXUTLhXW8Uq+PdTonjEkO5lC5EqN71ahAN IjaXltu9rXc5H5oOkXfYMya8dZpXB7hua4brkq40WAAl3gTb3TTDxizO2l1+pI226awh Ac/nwwLoZFcBhrQjBY6+Mhc4noeBOZyFDGnRremwIxIINr8UCL+uBgDjzAXxcYDVS7w4 eEBwU3FmuXuj3iggb619xnhrkrDmYBQI6RRu+PC7wtPoxV7CcvqMZckrZPelGkBSJp8r P7Eu2HeHXVCnoFwP2li37eB9BG/di95dKsqc2EExVtqFq0Wr7/uUoQvXw2EBrC6UzxnQ L89g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495564; x=1720100364; 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=7RVNKACznzXJwsczryHdNsSEUqVvGG/uCg/TYBM83LM=; b=wVWH4IL8LkfWAjT56guzW86mLLF3vojw8Gq8JZPk89+yJICWwPyRZGD2UA5MN+X9Wm 9KIzZFhxuv7eHnIxELoVzh9rmQMbkOmooduuPLJbIMQwbF6KHTUrSEptVxgd8KiYHQ7o mX1t/6Peejv9eH5ExkBR3OhYOnnIVQWoxkaGmuFiA8XjyWeophdA3wbGbBzLwnkUiQQ+ oN/WV/8kCkDt6fgf4/21NBqNQPied/U6GxwsJpiyLZVrvBKmvxJhIO5V/6gzLSblqpL+ yxK80/22t0PE4lN1wGgVvVhW1/brovUCsx6eeG5Dof/CVMUUdfGQ/5u/TRZ0zuDU0tOj XB0A== X-Gm-Message-State: AOJu0Yynt2iMDJzPjFEPiX5RRRLQ3aoQYZ2QgQjb8Gsn9dZhelSpUQud KWF1+PV0jMmxGAhtdI8gtgPEY4fbNCc2LyNluH+Do68ioNW3BzxItsRHk+gL1sg= X-Google-Smtp-Source: AGHT+IHi3SFb6IfzyjZU4LPjQOe2vtYPxvsTt5zgvDsBZjlxp/FQibJVmn1SawfGhDC4rTTaywaq1g== X-Received: by 2002:a05:6a00:3c94:b0:706:7153:92ae with SMTP id d2e1a72fcca58-706745be252mr16837324b3a.19.1719495563984; Thu, 27 Jun 2024 06:39:23 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b4a0fdbesm1331259b3a.127.2024.06.27.06.39.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:23 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:55 +0900 Subject: [PATCH v2 12/15] tests/qtest: Free old machine variable name MIME-Version: 1.0 Message-Id: <20240627-san-v2-12-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::436; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x436.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- tests/qtest/libqtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index f89da7b80797..1605c0c9f615 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1509,6 +1509,7 @@ static struct MachInfo *qtest_get_machines(const char *var) int idx; if (g_strcmp0(qemu_var, var)) { + g_free(qemu_var); qemu_var = g_strdup(var); /* new qemu, clear the cache */ From patchwork Thu Jun 27 13:37:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3613FC3064D for ; Thu, 27 Jun 2024 13:41:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLu-0002hl-HK; Thu, 27 Jun 2024 09:39:54 -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 1sMpLZ-0001nL-2r for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:34 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLX-0006ZT-D1 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:32 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f70c457823so54392185ad.3 for ; Thu, 27 Jun 2024 06:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495570; x=1720100370; 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=IDtmLd4DIh+2XRkZ57QtXjyzkDOakOx1Ds4rKdXYuOE=; b=biy81hPqEVeom0tS62rhmoWFdc4gY0m71tzlpx6Ckby30aFmqMysTmlzrqKFn941PK kWpPIAU8DNXPFWTilUyfLdflVpF7aw0Bs0m0YcdYk0pkTY3lCvA3VQIkEtVkQd4QROcI +h28A3U6YpvvwgnO/56ZJBMDOOG/+6v53nv+FA2cZMDPNeCJDtqrgdi1T/v6Y8VbgbVc lMxD/pex0bMBr8tEhswoMEqaaROwHjxaGAqSGtcBPxH/S+MDtYA9pb4wpuheb/tZfMFd GastiCS36BCO2/WM1nrCWbxNZg6oDRloBAF43DwT33nEO226OWIWJC98WJXETRrt/mrB yfwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495570; x=1720100370; 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=IDtmLd4DIh+2XRkZ57QtXjyzkDOakOx1Ds4rKdXYuOE=; b=K4dwbD9R7BvyhTDsLCR5IM8+v1SZksHkfp/Ht3i8EH1KvX+l2MLu+rqBqwWDief1sD 0SM53xJsXItEtOJFfH9lsIV06BhPSCLZIBPTOIon6uXcZ/GLciETNZX6W1vcCPEgGlKQ DLO7M/h0LXwrmfFXtzOvE/HkzR1BDKilyyL4M2gPMs/OhOGamVK3yx6GjZqW7HJgEBj2 EX5pYWD1aiCROtgLx1X6g8evz6Fsc4IAZiU3Tg3r4lwMMDme3g8lAoAA5PN/Niqb8OCw LfhBC9jZHW4hy7HKdJg3rakQPKam2J1X3DKA9eXihu6HMoCkWTXMw3WeX/VAXUWx3awI lCYA== X-Gm-Message-State: AOJu0YxIyVjd2hmXvdM0nifvoz7/x5Ao+4igsyEv3sKzw4STd6eX9XGe VX3+H9JVFCWUSMrgoWlkNe9dtwspiqpT8qqsFLQxSUPhI6krdbg3IkI6+mSu/nE= X-Google-Smtp-Source: AGHT+IFzIGW+nsnWdJPHEbiNrp488hVRGEdrshmaBw10w7xHcEQJxXBh3T4EQrvFSPo6JhGmFg7hsQ== X-Received: by 2002:a17:902:e846:b0:1f6:502d:ca88 with SMTP id d9443c01a7336-1fa23f15aa5mr134051625ad.49.1719495570044; Thu, 27 Jun 2024 06:39:30 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac9c5266sm13108905ad.307.2024.06.27.06.39.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:29 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:56 +0900 Subject: [PATCH v2 13/15] tests/qtest: Delete previous boot file MIME-Version: 1.0 Message-Id: <20240627-san-v2-13-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::62d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62d.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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 --- 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 b7e3406471a6..5c0d669b6df3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -129,12 +129,23 @@ static char *bootpath; #include "tests/migration/aarch64/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 */ @@ -164,13 +175,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 From patchwork Thu Jun 27 13:37:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4B374C2BD09 for ; Thu, 27 Jun 2024 13:40:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLw-0003AJ-QG; Thu, 27 Jun 2024 09:39:56 -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 1sMpLf-000266-81 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:39 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLd-0006aO-Jr for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:38 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7187e6b3584so3721709a12.0 for ; Thu, 27 Jun 2024 06:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495576; x=1720100376; 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=66SWenAU4qt0HqdzzgzjopUq88LncGGPdZoRZN6MJBw=; b=U5OFeVL/gbCE8SrtacwXOVTRXmxTxtukIofmUMDrS+SNrQZZG5xO08Glno18CGwJTo AEnH+XgTCDKqHhodC3sfShgdniXD6b+rxJRoBBhAZnH2oxxcXhn4f3TS2clq4l4DMvPb ZH87Te4FMbvjdY1ADHstvzqTT8+wgVgBeHX94jiYTitFQOoLQN5f2m+fl/dsbSqt5hZP RjnH6w0Gnjf3EfIxkSVU1sq56WuzQs8PEhF2AsOpHjsEbjO6qggA2nPUb4ZdriNw0rx0 AgzCqneLz9msmAK86WPIn1xUHkDFYipSMdxr/e2RCZNgzHAzqM36f8f2DyxPF0XL/o68 q4gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495576; x=1720100376; 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=66SWenAU4qt0HqdzzgzjopUq88LncGGPdZoRZN6MJBw=; b=jSzU+it3/GzPbpWCKZoWY9oi1D2uRVijSTwaAsx+AgsVGI18qu8mjLH4z/iXfcun1o Vok6klRjmaSxFbshAaflvPkXZIoUZTrzfH2qUXFi6WatGb0jWVf6KNg+JDcseCu06Jjc vgEP9NuZFsUNSISICIXKXEUjCkDDRQdKYHhRdD5NEVUMkVDJmbpWlIyF20k0DA0J76Lq 2CYNbv06nlvJhGMAnQeU5Dw4UEAL2CJwCDW5QmYTSS8I73dFItkqkAF7Lghexv3MXU0D dzouMV8kp8EQYd5+SDMWbdaBqdC0zsT5/wlqTOydQupHflm+HOdjmIPMhMyBRjBJ0jsa d8EA== X-Gm-Message-State: AOJu0YymWoBLL5dn0ntvr54P3x9FkzOB0MMnMOjGJ2BQKuCkN/g1OiCR vlnUyMpyN1N9CTiDW1sG/jXOqigsQ3ACCWJerFIc9TzIGxMMJBw8XTNYLEMiIcU= X-Google-Smtp-Source: AGHT+IGK3IeNA1PsDdEds/reaHYwgDV95tDqPpf6AdGiFC4ZsLRZj1HBdWm8l3UiekhYxiotaysaqg== X-Received: by 2002:a05:6a20:1e58:b0:1be:c753:dc65 with SMTP id adf61e73a8af0-1bec753dd0cmr3363255637.18.1719495576216; Thu, 27 Jun 2024 06:39:36 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac8df617sm13243105ad.31.2024.06.27.06.39.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:36 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:57 +0900 Subject: [PATCH v2 14/15] tests/qtest: Free paths MIME-Version: 1.0 Message-Id: <20240627-san-v2-14-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::535; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x535.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki --- tests/qtest/qos-test.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 5da4091ec32b..114f6bef273a 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -33,7 +33,6 @@ static char *old_path; - /** * qos_set_machines_devices_available(): sets availability of qgraph * machines and devices. @@ -191,6 +190,12 @@ static void subprocess_run_one_test(const void *arg) g_test_trap_assert_passed(); } +static void destroy_pathv(void *arg) +{ + g_free(((char **)arg)[0]); + g_free(arg); +} + /* * in this function, 2 path will be built: * path_str, a one-string path (ex "pc/i440FX-pcihost/...") @@ -295,10 +300,13 @@ static void walk_path(QOSGraphNode *orig_path, int len) if (path->u.test.subprocess) { gchar *subprocess_path = g_strdup_printf("/%s/%s/subprocess", qtest_get_arch(), path_str); - qtest_add_data_func(path_str, subprocess_path, subprocess_run_one_test); - g_test_add_data_func(subprocess_path, path_vec, run_one_test); + qtest_add_data_func_full(path_str, subprocess_path, + subprocess_run_one_test, g_free); + g_test_add_data_func_full(subprocess_path, path_vec, + run_one_test, destroy_pathv); } else { - qtest_add_data_func(path_str, path_vec, run_one_test); + qtest_add_data_func_full(path_str, path_vec, + run_one_test, destroy_pathv); } g_free(path_str); From patchwork Thu Jun 27 13:37:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13714433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8A5F3C2BD09 for ; Thu, 27 Jun 2024 13:41:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpMN-0003wd-5N; Thu, 27 Jun 2024 09:40:26 -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 1sMpLm-0002Qv-22 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:46 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLj-0006cq-Tj for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:45 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-70673c32118so3808609b3a.3 for ; Thu, 27 Jun 2024 06:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495582; x=1720100382; 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=tYtFORlnbJN2+36DGKZvH4uH8NkkbHJaO5uVtPxgJZE=; b=rSJK99kK5W6uCphpWOC+v4YGxL8ZILNdhrJa5Va5ybMNK7R0Qnvy0bH8YL1I5VXEns gKF7E6jt2tjJxiKL/rJlbgeEIHtRTNsLnvAY6uFiyRygRJ0cvJ9AkP2Gk7nsGZph64JM cJnZolehVFqZDDoWhPWY2AJzejjJ8M9+vyUjaKJ258WmFgg6A32c9BGk0j8c/vKWSOpu uaPLyxQPygIwae78oEemGZGoBZR12hPXM/+GEaD/sNRBe5jgfZpN33vXmxotihhPnIUM DYWvBf4Y1qVQ5bwoQ9AMsuiw8ruXKJTdnpOkvUPLg17qPXMOGmK9bdrNGcLInb+shwnw jR2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495582; x=1720100382; 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=tYtFORlnbJN2+36DGKZvH4uH8NkkbHJaO5uVtPxgJZE=; b=M9BJwgbGu9QtLPkxMk8jCZDbNVoPLGqk3a1ThxZXNZNiTEEmZejZR/vpi3ieUgmMzv +QRzufSGP2tnp3ItDtkXhQU26nytxA2CbIThurlEhd1NL4ez4etuUuS5P2JwZygB54Xc 4XvZ+Qqd539qUfiDuHkEWLk2QaKY5B+eNlCUlJKK75kJzoa8cjc+GgcL+JXYN0P4yPny udzO/tt63fIhz31/KcAy0J0IAD/N1JjhMxY043VntnG5Rgsuh0QOcLwUraJn6oN0FGut QBERvTUylnYxMY2IhGscnRFoizxKSjxan4bB+07KUKARnaYfOmBlL2WreyBMiVJUgRGH m24A== X-Gm-Message-State: AOJu0YwBjmq5cS8pxdLnr4wEYo+OmJEMSYrz58GwhHtnJJkXzol3tm1F 2kOdAN3RfMV4oo2EsqQ64pY+ODme/SV2w02yTBzk2IKPAI5AeGjOdpZT3snBSTY= X-Google-Smtp-Source: AGHT+IFXFWZxtxNetDL0x3QR81Q4NSGV4KUcXaVakXLBlruN2EYupN0blY/9gL/zVeN/j6uHx6EZmA== X-Received: by 2002:a05:6a00:1d1d:b0:706:6cb2:ed17 with SMTP id d2e1a72fcca58-7067455be23mr14036044b3a.2.1719495582624; Thu, 27 Jun 2024 06:39:42 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b491008dsm1338261b3a.57.2024.06.27.06.39.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:42 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:58 +0900 Subject: [PATCH v2 15/15] tests/qtest: Free GThread MIME-Version: 1.0 Message-Id: <20240627-san-v2-15-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@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::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org These GThreads are never referenced. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- tests/qtest/vhost-user-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d4e437265f66..929af5c183ce 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -928,7 +928,7 @@ static void *vhost_user_test_setup_reconnect(GString *cmd_line, void *arg) { TestServer *s = test_server_new("reconnect", arg); - g_thread_new("connect", connect_thread, s); + g_thread_unref(g_thread_new("connect", connect_thread, s)); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); s->vu_ops->append_opts(s, cmd_line, ",server=on"); @@ -965,7 +965,7 @@ static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *arg) s->test_fail = true; - g_thread_new("connect", connect_thread, s); + g_thread_unref(g_thread_new("connect", connect_thread, s)); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); s->vu_ops->append_opts(s, cmd_line, ",server=on"); @@ -980,7 +980,7 @@ static void *vhost_user_test_setup_flags_mismatch(GString *cmd_line, void *arg) s->test_flags = TEST_FLAGS_DISCONNECT; - g_thread_new("connect", connect_thread, s); + g_thread_unref(g_thread_new("connect", connect_thread, s)); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); s->vu_ops->append_opts(s, cmd_line, ",server=on");