From patchwork Sat Feb 4 16:08:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 650641 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1435153pva; Sat, 4 Feb 2023 08:09:06 -0800 (PST) X-Google-Smtp-Source: AK7set+Vuhh4ksr0ldoNMgfHT3IV0eiVDJjSz2kOA51fDDCf/5X8Ava7DTQ4sCyC1mzcVWEjMo4G X-Received: by 2002:a05:6214:5442:b0:537:6bc5:6c3b with SMTP id kz2-20020a056214544200b005376bc56c3bmr24288189qvb.30.1675526946098; Sat, 04 Feb 2023 08:09:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675526946; cv=none; d=google.com; s=arc-20160816; b=f12mHFYPFteAcVPrhGcP2SC8eD7N3TTej6Jt+lSth/HsiIlYbx2zemLotxJuhwISll c0j0vd3Ac24374mwe7aHBhrQ2CbZfWSXITf86/Mmm8VV8xvLiv1kil3DcICHtZ+e2ukD Q7WLRcw+My+vDQm8D9YGjOhGf15VovmUnMAGso7pJRPAWM+RaDUt6g4yRQah+UPEPhJx jFQb+GGvhKxBZF/mq9sVs5N9dmHx5PsBDlFTogl+eLrK+pzEYI01o+cXmCNIIxMy867t y4e3Ye4N1LWeuHOfivlmxp5XmZxf8OlSaNaMg2ilsCygE3VPKp53OXNi6s2/gIcGlFup GKbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=4x0vH25wu+z06cvNaiBhJ0G5/gOiL66z3YHCgUhQmu8=; b=wPLLFMX6UrjrTR+Zzs1ZAmC5/TVd4dhoq9ouWGyfCQunVwzIfmHY+ezdLcc2ew4dyC v8T7B+UsTz9/wqWIffqB4JpwNjGu1CElWRvjd1MKkn7ICxhbRdqCZ6Tt3wS8SErJmDXN 8942H/lwKJIcZbUFl2/6zX+POROjId+8F3YHyp3QSInAWzmVQ26gaZGjxNx9sKq3ckS7 6Q0okvyfz+XapxvFgQ/eTpOMX76vgzVxbQSvGzBT1Yh+39MW8GyfSzHSzppjqo4bRUVa G+/Ro6HJu40wffuqHjmAUw0arC1JNLVaaLN5PDxleguo4mkv86hdc4inSQPZ7DJ302eW DSCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ef8-20020a0562140a6800b005354bcd8cc5si3679869qvb.572.2023.02.04.08.09.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Feb 2023 08:09:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOL5o-0005At-J9; Sat, 04 Feb 2023 11:08:44 -0500 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 1pOL5l-00054q-6h for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:08:42 -0500 Received: from mout.kundenserver.de ([217.72.192.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOL5h-0006u9-TX for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:08:39 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MWBGG-1p8W8u2nRy-00XY5X; Sat, 04 Feb 2023 17:08:34 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 01/22] linux-user/strace: Constify struct flags Date: Sat, 4 Feb 2023 17:08:09 +0100 Message-Id: <20230204160830.193093-2-laurent@vivier.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204160830.193093-1-laurent@vivier.eu> References: <20230204160830.193093-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ww6E4GBQVIgoAwjoBcEGp8wxBInQNIbPz0KfCNPVFzuEExhcso9 muF7eOly0bBuTo5C8NX/tLG0xufWG2p7YfSvIW0nRsA0usbodWvcFggd7P9dW8WjFkxtfbK a2WgxE0wxQ84upSWKKm3MXbFgXY19QgED2Z+ZMNy+hpEkuABbkPhyaK7rNdRFbg/IV9SJnd ud/G8kLTjGn+Hc/o9jx3g== UI-OutboundReport: notjunk:1;M01:P0:Kqdqdyhosj8=;vSrnSoHtRzrSP9f8oJSQhc2xSb4 cVOvCex2tGjmfc30PHoNlzjjEW7ijdgIMLQ5SJ37QYCs05BVGbLq8TOSL0FOqLlFh906MHg6p EyN1I4kvAJU0cZZj/YM59jh1VZAIkhpYwtaaWtu7OT5c1W8H+O+5N3dsJxKhFsfB4IyPadXAO gQnTh5JzeLLzsJIy8aso5rQnwNbCga0gINVvYSQunfD3xnZprzyel0mkoBlHcahVJqdKw2byF vGVJe4WmZNMWiWmokvigQORm4OmwYHN2eOlRP3Xi+i7GIfq1BJbbKwIu4tb2K2epcQMzgBlxS nmMmJhb/a14Y8/Wr6wEAkce/4nOXjZOzWqSBXIBLUgMn66WGqVw1kw/0WIrY00DgMx2xGdWYF ZbfQsMcjg9McsSw7/3MOuGTNZVACMGL/D7js8c4EVoEx1yufjnpSHveaoyEOwd1cXhIN89CxB 1GguS5cGuWRhJEDnFHWgKODP97dbNK5cW2BHmwKnrUibbgvBBwv/ZITmFJcycqD/I0St7HQIU FhXBpYrYD7kMvXBYbPQyVFcZwOahMXO0MNHZuaDGPb+kvkzzpWJuQF3NyjOvzl7eZaXwKpMJC XYs6Xa0TTrTnVuCgj6jPacE6YIorLfLMFVGZxyGbIbkzzWUKQc7mTdHsyOUpEVoY732nGMxkc rFBH1Q1Gq9Tx1o9jusp0M3f2XL/+A2ysw7i38A0emw== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé print_flags() takes a const pointer. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20221104173632.1052-2-philmd@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/strace.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 9ae5a812cd71..25c47f03160d 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -945,7 +945,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name, } #endif -UNUSED static struct flags access_flags[] = { +UNUSED static const struct flags access_flags[] = { FLAG_GENERIC(F_OK), FLAG_GENERIC(R_OK), FLAG_GENERIC(W_OK), @@ -953,7 +953,7 @@ UNUSED static struct flags access_flags[] = { FLAG_END, }; -UNUSED static struct flags at_file_flags[] = { +UNUSED static const struct flags at_file_flags[] = { #ifdef AT_EACCESS FLAG_GENERIC(AT_EACCESS), #endif @@ -963,14 +963,14 @@ UNUSED static struct flags at_file_flags[] = { FLAG_END, }; -UNUSED static struct flags unlinkat_flags[] = { +UNUSED static const struct flags unlinkat_flags[] = { #ifdef AT_REMOVEDIR FLAG_GENERIC(AT_REMOVEDIR), #endif FLAG_END, }; -UNUSED static struct flags mode_flags[] = { +UNUSED static const struct flags mode_flags[] = { FLAG_GENERIC(S_IFSOCK), FLAG_GENERIC(S_IFLNK), FLAG_GENERIC(S_IFREG), @@ -981,14 +981,14 @@ UNUSED static struct flags mode_flags[] = { FLAG_END, }; -UNUSED static struct flags open_access_flags[] = { +UNUSED static const struct flags open_access_flags[] = { FLAG_TARGET(O_RDONLY), FLAG_TARGET(O_WRONLY), FLAG_TARGET(O_RDWR), FLAG_END, }; -UNUSED static struct flags open_flags[] = { +UNUSED static const struct flags open_flags[] = { FLAG_TARGET(O_APPEND), FLAG_TARGET(O_CREAT), FLAG_TARGET(O_DIRECTORY), @@ -1019,7 +1019,7 @@ UNUSED static struct flags open_flags[] = { FLAG_END, }; -UNUSED static struct flags mount_flags[] = { +UNUSED static const struct flags mount_flags[] = { #ifdef MS_BIND FLAG_GENERIC(MS_BIND), #endif @@ -1044,7 +1044,7 @@ UNUSED static struct flags mount_flags[] = { FLAG_END, }; -UNUSED static struct flags umount2_flags[] = { +UNUSED static const struct flags umount2_flags[] = { #ifdef MNT_FORCE FLAG_GENERIC(MNT_FORCE), #endif @@ -1057,7 +1057,7 @@ UNUSED static struct flags umount2_flags[] = { FLAG_END, }; -UNUSED static struct flags mmap_prot_flags[] = { +UNUSED static const struct flags mmap_prot_flags[] = { FLAG_GENERIC(PROT_NONE), FLAG_GENERIC(PROT_EXEC), FLAG_GENERIC(PROT_READ), @@ -1068,7 +1068,7 @@ UNUSED static struct flags mmap_prot_flags[] = { FLAG_END, }; -UNUSED static struct flags mmap_flags[] = { +UNUSED static const struct flags mmap_flags[] = { FLAG_TARGET(MAP_SHARED), FLAG_TARGET(MAP_PRIVATE), FLAG_TARGET(MAP_ANONYMOUS), @@ -1092,7 +1092,7 @@ UNUSED static struct flags mmap_flags[] = { FLAG_END, }; -UNUSED static struct flags clone_flags[] = { +UNUSED static const struct flags clone_flags[] = { FLAG_GENERIC(CLONE_VM), FLAG_GENERIC(CLONE_FS), FLAG_GENERIC(CLONE_FILES), @@ -1136,7 +1136,7 @@ UNUSED static struct flags clone_flags[] = { FLAG_END, }; -UNUSED static struct flags msg_flags[] = { +UNUSED static const struct flags msg_flags[] = { /* send */ FLAG_GENERIC(MSG_CONFIRM), FLAG_GENERIC(MSG_DONTROUTE), @@ -1156,7 +1156,7 @@ UNUSED static struct flags msg_flags[] = { FLAG_END, }; -UNUSED static struct flags statx_flags[] = { +UNUSED static const struct flags statx_flags[] = { #ifdef AT_EMPTY_PATH FLAG_GENERIC(AT_EMPTY_PATH), #endif @@ -1178,7 +1178,7 @@ UNUSED static struct flags statx_flags[] = { FLAG_END, }; -UNUSED static struct flags statx_mask[] = { +UNUSED static const struct flags statx_mask[] = { /* This must come first, because it includes everything. */ #ifdef STATX_ALL FLAG_GENERIC(STATX_ALL), @@ -1226,7 +1226,7 @@ UNUSED static struct flags statx_mask[] = { FLAG_END, }; -UNUSED static struct flags falloc_flags[] = { +UNUSED static const struct flags falloc_flags[] = { FLAG_GENERIC(FALLOC_FL_KEEP_SIZE), FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE), #ifdef FALLOC_FL_NO_HIDE_STALE @@ -1246,7 +1246,7 @@ UNUSED static struct flags falloc_flags[] = { #endif }; -UNUSED static struct flags termios_iflags[] = { +UNUSED static const struct flags termios_iflags[] = { FLAG_TARGET(IGNBRK), FLAG_TARGET(BRKINT), FLAG_TARGET(IGNPAR), @@ -1265,7 +1265,7 @@ UNUSED static struct flags termios_iflags[] = { FLAG_END, }; -UNUSED static struct flags termios_oflags[] = { +UNUSED static const struct flags termios_oflags[] = { FLAG_TARGET(OPOST), FLAG_TARGET(OLCUC), FLAG_TARGET(ONLCR), @@ -1349,7 +1349,7 @@ UNUSED static struct enums termios_cflags_CSIZE[] = { ENUM_END, }; -UNUSED static struct flags termios_cflags[] = { +UNUSED static const struct flags termios_cflags[] = { FLAG_TARGET(CSTOPB), FLAG_TARGET(CREAD), FLAG_TARGET(PARENB), @@ -1360,7 +1360,7 @@ UNUSED static struct flags termios_cflags[] = { FLAG_END, }; -UNUSED static struct flags termios_lflags[] = { +UNUSED static const struct flags termios_lflags[] = { FLAG_TARGET(ISIG), FLAG_TARGET(ICANON), FLAG_TARGET(XCASE), @@ -1380,7 +1380,7 @@ UNUSED static struct flags termios_lflags[] = { FLAG_END, }; -UNUSED static struct flags mlockall_flags[] = { +UNUSED static const struct flags mlockall_flags[] = { FLAG_TARGET(MCL_CURRENT), FLAG_TARGET(MCL_FUTURE), #ifdef MCL_ONFAULT From patchwork Sat Feb 4 16:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 650640 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1435059pva; Sat, 4 Feb 2023 08:08:54 -0800 (PST) X-Google-Smtp-Source: AK7set+30M0FySHkXWQdSIV+i0IbgVkS0vFTIp302G3CtUvthuNlI3JRwGqT1ZjO6q+y5UnjtgRj X-Received: by 2002:ac8:5f10:0:b0:3b8:6b6b:28c2 with SMTP id x16-20020ac85f10000000b003b86b6b28c2mr24868444qta.68.1675526934382; Sat, 04 Feb 2023 08:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675526934; cv=none; d=google.com; s=arc-20160816; b=Qt4gnbeFZoeMjtJwa5jcQn/DvutkuD5nWeh3otC3Yur5LxZk4ZsfRQRxo/wwVRcdm1 tCk4NAh4yTo1YcjqVOqa6G+SDTanUQTfN3jgFOzEl9KWT64A63J1krWf2qKotCJDn4Ld 1pMljrGFc+reA61TiuEy8QGy8xRohCrf5pUetRz7BHjILCr7O103OO1TksyZKrmeoKaE 2huLQmKJA8JJUpfS5QHqEGxeuXxZm6CAjQRKI00vJWpR3dMhzMm6aVxoFT5Badsgq4rC HeEX1JqXhGDPzRzcU/EjVmEK3xHwcDlITDXCkAFDakxJFdZKnnIXTYyoVRl/LkAEKEHa sUvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MYHax3KomdEi9/+JkpNiXL/NyGKdRnuq5Qlfur1hEPE=; b=gmZ8gcY9PuxnfHRzNXLeFyoXkrPXZEPXVn2fmiyvJ98653bvqNKW2ethBJWSfkZtjY qgKXjBRz6k0/1wDJw+PNrPqmxEjUUHb0j0u2AZISFvtx7rBkr6onFV+CzgCfIALPthhy Z0d+fMAAnXIBvsghc6OP9dP7hEJsSpOyXwFOt3PJLzvmqglwIlTGMdui8elVGTJWJuUU 7K4IxDmNXKvvMcdcfxKI0FbyDbHbt6FL66s93LDgLNGsWG49UrqAeMVJjEB5l0nOPN6j WNCczOhWkZsH0l7BWbAzv906hHW0T8VyHixmr5JeQMImSredyoIUA3BhEmO5EGjoLeJm C2EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d20-20020ae9ef14000000b0072b86bfb504si4089683qkg.474.2023.02.04.08.08.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Feb 2023 08:08:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOL5s-0005D4-RI; Sat, 04 Feb 2023 11:08:48 -0500 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 1pOL5m-00054w-LE for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:08:42 -0500 Received: from mout.kundenserver.de ([217.72.192.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOL5j-0006uL-Pz for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:08:42 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M58SY-1pNFA13WJ2-001EhF; Sat, 04 Feb 2023 17:08:38 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Laurent Vivier Subject: [PULL 07/22] linux-user: un-parent OBJECT(cpu) when closing thread Date: Sat, 4 Feb 2023 17:08:15 +0100 Message-Id: <20230204160830.193093-8-laurent@vivier.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204160830.193093-1-laurent@vivier.eu> References: <20230204160830.193093-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Owlqyx/EvkIoUWNRsGD4j+1tCD4Nki7NYcXG55uQHL7ZVWMbifu 2AgzM+olSZVjAUb3g/wRaqopX1csaZ/3wS+CCoN7AZePULsy/LhICylAy51dg1IZDb/OJT5 6yNzGjO8tJ2pOjYCqSACDI94s4q81Hjf19NPLr6E3uxfx6GjzhFmUagHeK/aB3YSa+2Loer EoseEHop/6SX3YKaf9ywA== UI-OutboundReport: notjunk:1;M01:P0:PrJprO64Gww=;4oMAwbGPJHekz3HNgnTbk3NPld7 yk5NYxI9dzEK+FwBmnLtPDec+Ifz/fGAHjso3v0KCG7EXncGWt8p2nSzPMga3MK2vFGN20ZMU 2CFV4pR3FNbspeYIVSjR/C5JULPVsJDe4iGrcpXPLBZjWOYOATVAGkl8Hjf5+m6nVUc6IPXtb r7ssHKjKN6ZvIj1LXVxd5Ng2O9o3Sq9PQvE268W8aLwUv5KaJggZPO19BXUK1Ww01g0V5khlD NS2AbuQtaLUA0KVaPtD7f/EV6OP84crS2hPV8gLXRhtwLt7TlTN4GEFt6TkSKTgXiorP2MLNt be3Ojq7wuFYS1FuApW9pcG6g1HHmRn5RnweQuaJULuV1Qixzwb1jhmrm8nUSxIIlzEjLf/x1p 8xjNo2gnJCRDvKNYEYtm6wNhcw9L/+SWqc7qNCTIOzF+Drq5Rt76qw8D9sO/eeDzghBnNhxTH FllDg21r3jJ8yjYPx17kvDBMIutImCxKpavz0D8nIdmblMWRZE02tmL9vKInrvBkPZPy7i9sG d5D4lqw0n16WZYResDFshfD3ILfvFywCCxdHqx3041kH1SbWFLXRaeN0JMvE6yM3yZOrE76vS Q3iN7Y5A2VOZ2Sb0XX2IRDMeUEprkrVcSx319/A/rwla+S1nq/UkpqFehEJgFQ8whHjNo0xn2 AIK21Q04YxV6esUa37yTFwj48m50jlSHa+/BftSF/w== Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This reinstates commit 52f0c1607671293afcdb2acc2f83e9bccbfa74bb: While forcing the CPU to unrealize by hand does trigger the clean-up code we never fully free resources because refcount never reaches zero. This is because QOM automatically added objects without an explicit parent to /unattached/, incrementing the refcount. Instead of manually triggering unrealization just unparent the object and let the device machinery deal with that for us. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866 Signed-off-by: Alex Bennée Reviewed-by: Laurent Vivier Message-Id: <20220811151413.3350684-2-alex.bennee@linaro.org> The original patch tickled a problem in target/arm, and was reverted. But that problem is fixed as of commit 3b07a936d3bf. Signed-off-by: Richard Henderson Message-Id: <20230124201019.3935934-1-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3e72bd333ede..dbf51e500b4f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8756,7 +8756,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, if (CPU_NEXT(first_cpu)) { TaskState *ts = cpu->opaque; - object_property_set_bool(OBJECT(cpu), "realized", false, NULL); + if (ts->child_tidptr) { + put_user_u32(0, ts->child_tidptr); + do_sys_futex(g2h(cpu, ts->child_tidptr), + FUTEX_WAKE, INT_MAX, NULL, NULL, 0); + } + + object_unparent(OBJECT(cpu)); object_unref(OBJECT(cpu)); /* * At this point the CPU should be unrealized and removed @@ -8766,11 +8772,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, pthread_mutex_unlock(&clone_lock); - if (ts->child_tidptr) { - put_user_u32(0, ts->child_tidptr); - do_sys_futex(g2h(cpu, ts->child_tidptr), - FUTEX_WAKE, INT_MAX, NULL, NULL, 0); - } thread_cpu = NULL; g_free(ts); rcu_unregister_thread();