From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739343; cv=none; d=zohomail.com; s=zohoarc; b=ntdJB23MGhsiPeKzSdILJ5HuFtlAkUzU7SKpJ3PnOR8F/slW1hx1QNU9Xm+kN+jGArr6SsIt/vsb42z0yLGNDm4rrZEKcdOCFjFf77YZxjgLcQgBTkLJQodedNxZ6Mgxu9MEUVaPl9l5Vkb08TId8H+rCzAiNqscx5zNaxBJ6BQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739343; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0RVm116KJVpIo1WmvyYIGakdNu7H4Sz7hO6ZwQRM5+8=; b=ljjLKYAO0qbkbBI2pXwpaLZCC+SqPVoypbF50otHuTMEFQsvk0hbzxDvUFhLwgZKGZBoC2P6jctw4PdpOfduv0m03Lihb948uJs3px2lJhWn224Mo3lW9iSnWMB9bn+W81lIrjBNqDyt9rQdszqq9smWtZlUMI7P9+UIfQB+xpk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739343845115.03597027906244; Sun, 28 Aug 2022 19:15:43 -0700 (PDT) Received: from localhost ([::1]:59412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUJS-0002z6-OR for importer@patchew.org; Sun, 28 Aug 2022 22:15:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUE9-0003RX-Cv for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:13 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:45737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUE7-0001b7-Hf for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:13 -0400 Received: by mail-pj1-x1035.google.com with SMTP id h13-20020a17090a648d00b001fdb9003787so1852775pjj.4 for ; Sun, 28 Aug 2022 19:10:11 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=0RVm116KJVpIo1WmvyYIGakdNu7H4Sz7hO6ZwQRM5+8=; b=Nzz2cicTkHlT/rQiuUBxpgG+TWlPsWFWRUvWuzsJZyjAzlnG2wJ1uPT5I0h/VOB/gH z5sCvKp+4X9M8EndyKvvmYdUBk+ptY8AmiS2HLuVD3gIzjDNJiKskKPKiavIZpqvMq8h o/SNK7Y8Brq6p0Wxywg/+Vfiiwfq4naKxSfg71qP86LCY4itP/iIZGOHfOzncePWKb3B AIKrYzd2ZQGhAeSLwIEcv2OHiHIgdckrV5b/jZL7n28BVBCEYJ+j4q8tEp91iblCaPGY pZFCgfSStUcTy4w+iH8hNgzxPpcC8aBYV+K6oJgknHinw8143khjY/ONUFLYoGcNgP4P 67Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=0RVm116KJVpIo1WmvyYIGakdNu7H4Sz7hO6ZwQRM5+8=; b=ScPuMU6mP22WsL/cYHsijvW1ASLwC1mBUl+ck52F9BkzUsLUZt6ztdhjebnz9DUqwb VOBedHWtOslJZTEddaTOKlJYpsGXMxlgpWTk+5WB2/xdHkp4kNotyYouV0jZVeNvR88p M55HBwn1E4/PlNYPNilEekB7/BBB8YTqKVbo06e+rzHBbAGedYRIL31gDsF+TONiovrX q0GbPdctMP/KjMsdTJj6VFDHHNTeV3Z66+a3ephDyF3je6rfdrX4rnFTBP1TY/zqfQWJ me6LGz1NDmABOLGcCCo76TnB6q4hyyq7bzpt+KPeuSYhqarQkL/LLeoN267ZcVg//4PZ j5OA== X-Gm-Message-State: ACgBeo0qPKcysjmcpkbQyelsOgXIEranuzKQdSWBsebh60JJ2UIe1XlQ zsSIiA96ohNlZ5WsPdE9/yWR5mFhb9Alqw== X-Google-Smtp-Source: AA6agR7A5ARwCfOdHAlp4sRpq+wrK3vAooJBy1NKNr4Q9WpVRPO5mO7t4l/6K8i0+OBAGa28lO2aQg== X-Received: by 2002:a17:902:dac8:b0:174:cf17:6e87 with SMTP id q8-20020a170902dac800b00174cf176e87mr2324253plx.129.1661739010031; Sun, 28 Aug 2022 19:10:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 1/8] linux-user: Combine do_futex and do_futex_time64 Date: Sun, 28 Aug 2022 19:09:59 -0700 Message-Id: <20220829021006.67305-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739345334100001 Content-Type: text/plain; charset="utf-8" Pass a boolean to select between time32 and time64. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 67 ++++++++------------------------------------ 1 file changed, 11 insertions(+), 56 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f409121202..a7e66d8d28 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7753,9 +7753,10 @@ static int do_safe_futex(int *uaddr, int op, int val, futexes locally would make futexes shared between multiple processes tricky. However they're probably useless because guest atomic operations won't work either. */ -#if defined(TARGET_NR_futex) -static int do_futex(CPUState *cpu, target_ulong uaddr, int op, int val, - target_ulong timeout, target_ulong uaddr2, int val3) +#if defined(TARGET_NR_futex) || defined(TARGET_NR_futex_time64) +static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr, + int op, int val, target_ulong timeout, + target_ulong uaddr2, int val3) { struct timespec ts, *pts; int base_op; @@ -7772,7 +7773,11 @@ static int do_futex(CPUState *cpu, target_ulong uadd= r, int op, int val, case FUTEX_WAIT_BITSET: if (timeout) { pts =3D &ts; - target_to_host_timespec(pts, timeout); + if (time64 + ? target_to_host_timespec64(pts, timeout) + : target_to_host_timespec(pts, timeout)) { + return -TARGET_EFAULT; + } } else { pts =3D NULL; } @@ -7802,56 +7807,6 @@ static int do_futex(CPUState *cpu, target_ulong uadd= r, int op, int val, } #endif =20 -#if defined(TARGET_NR_futex_time64) -static int do_futex_time64(CPUState *cpu, target_ulong uaddr, int op, - int val, target_ulong timeout, - target_ulong uaddr2, int val3) -{ - struct timespec ts, *pts; - int base_op; - - /* ??? We assume FUTEX_* constants are the same on both host - and target. */ -#ifdef FUTEX_CMD_MASK - base_op =3D op & FUTEX_CMD_MASK; -#else - base_op =3D op; -#endif - switch (base_op) { - case FUTEX_WAIT: - case FUTEX_WAIT_BITSET: - if (timeout) { - pts =3D &ts; - if (target_to_host_timespec64(pts, timeout)) { - return -TARGET_EFAULT; - } - } else { - pts =3D NULL; - } - return do_safe_futex(g2h(cpu, uaddr), op, - tswap32(val), pts, NULL, val3); - case FUTEX_WAKE: - return do_safe_futex(g2h(cpu, uaddr), op, val, NULL, NULL, 0); - case FUTEX_FD: - return do_safe_futex(g2h(cpu, uaddr), op, val, NULL, NULL, 0); - case FUTEX_REQUEUE: - case FUTEX_CMP_REQUEUE: - case FUTEX_WAKE_OP: - /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the - TIMEOUT parameter is interpreted as a uint32_t by the kernel. - But the prototype takes a `struct timespec *'; insert casts - to satisfy the compiler. We do not need to tswap TIMEOUT - since it's not compared to guest memory. */ - pts =3D (struct timespec *)(uintptr_t) timeout; - return do_safe_futex(g2h(cpu, uaddr), op, val, pts, g2h(cpu, uaddr= 2), - (base_op =3D=3D FUTEX_CMP_REQUEUE - ? tswap32(val3) : val3)); - default: - return -TARGET_ENOSYS; - } -} -#endif - #if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE) static abi_long do_name_to_handle_at(abi_long dirfd, abi_long pathname, abi_long handle, abi_long mount_id, @@ -12318,11 +12273,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env= , int num, abi_long arg1, #endif #ifdef TARGET_NR_futex case TARGET_NR_futex: - return do_futex(cpu, arg1, arg2, arg3, arg4, arg5, arg6); + return do_futex(cpu, false, arg1, arg2, arg3, arg4, arg5, arg6); #endif #ifdef TARGET_NR_futex_time64 case TARGET_NR_futex_time64: - return do_futex_time64(cpu, arg1, arg2, arg3, arg4, arg5, arg6); + return do_futex(cpu, true, arg1, arg2, arg3, arg4, arg5, arg6); #endif #ifdef CONFIG_INOTIFY #if defined(TARGET_NR_inotify_init) --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739150; cv=none; d=zohomail.com; s=zohoarc; b=HxjVdzc8nNwVSm0MMP4jxjkpe0IZrcnVu7jzZFvgIh3vIa5CON0MJC2+WzYIaUnoqvqqqObtwHjHLMKmu1MTXdO+fhbq0Z735kkFXV6rUCqpjy38RdjH45ULxiOK3JLXmfdIRXhTBiVDnCcNOzdRQYEzkD92q6SAne0AKuf9w7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739150; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MtNh2w+4V2y5mwzf678UGVcQqp1eS0dpxGcLnKcxRPA=; b=Sx9AG9tk37YtFXLKOnygEiuBlyRpjO5yk+gypzXLeyKKddd8vDbrM8j8zADb9swLzSZ9WeyWI2g5NF7sfnTA8ox0NNwPkQ5GGWo1LVU8KQTqKmSnXVJCt6wuGC1IfGXVdSAYmJdx26IQjlWPi+pjnebOV0bNSwH+bWuVwEDm40o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166173915057033.603631979102374; Sun, 28 Aug 2022 19:12:30 -0700 (PDT) Received: from localhost ([::1]:37526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUGK-00062a-M0 for importer@patchew.org; Sun, 28 Aug 2022 22:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUEA-0003Rh-F8 for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:14 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:34653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUE8-0001bC-MV for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:14 -0400 Received: by mail-pl1-x629.google.com with SMTP id f24so3857462plr.1 for ; Sun, 28 Aug 2022 19:10:12 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MtNh2w+4V2y5mwzf678UGVcQqp1eS0dpxGcLnKcxRPA=; b=ykxb3D+jBicZuCoKrxF2tf0nUUnJpeuYoCdvWAQpGUaIMA8p1FGZRNVlb85I6jEct5 1zPi3NHjRJvn+wkIuZ9Zz0msqzvSwVRIS3Cn1yk+bMCFSILCLptBzIH7Bk2/zjl2bxFX MEIbbiZyVYzvD6Ugzx+8Wiuj8GuaMlJyDFWew4CI2FrGPogtPr6JwcMF1ZEgvrpFHsS8 CHnlQ00mS8CZ9EgIbVi9RgsWBe40HdEKHR0zePW+UJ8KGa3484f1rS+wmJG9/vddev6V WIEPi+HLRs4H6SSFcKxqCGJUYK5djIv5srYGyCsOgVqIs2MXu4kmDhsLht6b4425tTJ2 fEkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MtNh2w+4V2y5mwzf678UGVcQqp1eS0dpxGcLnKcxRPA=; b=CrL1zWnDuZV1rm4JFSb8E0QnL7TYkBrlHCihFI9NIKdcR5N9SGu7vnYAJxU/EEKvng 0IGJYTQvY01gxkkyeyf55lWWG9ao3BXiZOxYtGU+Y1Eyw2COLf1WFcUpWzf2Gai4DznI zOTXlK0f0yESFELBMVPFNB9UHGDEcxy+7E1cHEO3TdLEY2gM7bRqhU5fzTxVluaoXJwc DJlthei06x36bq5kamXe8clRpn9RO2F5hcGc0sEUX4EeAQTDAnRrB2h2nnUC/PfSJHQ7 Z/m7d1rOwJbeIs8vq9aA8B+23PmU2zlkcprpcchRKbYIwmvjFXtQ9O7+bSdI0RZiWCgX Nolw== X-Gm-Message-State: ACgBeo0oy9RS3iacjKJKWkBeSmdLQz0OX/jwSmG3XNTwsMMrBMRUFgC5 c7FguzEi1UL5DNI7+6e3itcbZ/HVoIHPNQ== X-Google-Smtp-Source: AA6agR7c2Z2wNMXzI33uLb4+1nNBBGUwgeqI0ROnFkilsfDcTFlRnRAtjQBvHjsubZH9NV4s+68cKg== X-Received: by 2002:a17:90b:1c8e:b0:1f7:524f:bfcc with SMTP id oo14-20020a17090b1c8e00b001f7524fbfccmr16186305pjb.132.1661739011064; Sun, 28 Aug 2022 19:10:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 2/8] linux-user: Sink call to do_safe_futex Date: Sun, 28 Aug 2022 19:10:00 -0700 Message-Id: <20220829021006.67305-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739151604100002 Content-Type: text/plain; charset="utf-8" Leave only the argument adjustments within the shift, and sink the actual syscall to the end. Sink the timespec conversion as well, as there will be more users. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 60 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a7e66d8d28..8fbd5a9556 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7758,11 +7758,11 @@ static int do_futex(CPUState *cpu, bool time64, tar= get_ulong uaddr, int op, int val, target_ulong timeout, target_ulong uaddr2, int val3) { - struct timespec ts, *pts; + struct timespec ts, *pts =3D NULL; + void *haddr2 =3D NULL; int base_op; =20 - /* ??? We assume FUTEX_* constants are the same on both host - and target. */ + /* We assume FUTEX_* constants are the same on both host and target. */ #ifdef FUTEX_CMD_MASK base_op =3D op & FUTEX_CMD_MASK; #else @@ -7771,39 +7771,41 @@ static int do_futex(CPUState *cpu, bool time64, tar= get_ulong uaddr, switch (base_op) { case FUTEX_WAIT: case FUTEX_WAIT_BITSET: - if (timeout) { - pts =3D &ts; - if (time64 - ? target_to_host_timespec64(pts, timeout) - : target_to_host_timespec(pts, timeout)) { - return -TARGET_EFAULT; - } - } else { - pts =3D NULL; - } - return do_safe_futex(g2h(cpu, uaddr), - op, tswap32(val), pts, NULL, val3); + val =3D tswap32(val); + break; case FUTEX_WAKE: - return do_safe_futex(g2h(cpu, uaddr), - op, val, NULL, NULL, 0); + timeout =3D 0; + break; case FUTEX_FD: - return do_safe_futex(g2h(cpu, uaddr), - op, val, NULL, NULL, 0); - case FUTEX_REQUEUE: + timeout =3D 0; + break; case FUTEX_CMP_REQUEUE: + val3 =3D tswap32(val3); + /* fall through */ + case FUTEX_REQUEUE: case FUTEX_WAKE_OP: - /* For FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, and FUTEX_WAKE_OP, the - TIMEOUT parameter is interpreted as a uint32_t by the kernel. - But the prototype takes a `struct timespec *'; insert casts - to satisfy the compiler. We do not need to tswap TIMEOUT - since it's not compared to guest memory. */ - pts =3D (struct timespec *)(uintptr_t) timeout; - return do_safe_futex(g2h(cpu, uaddr), op, val, pts, g2h(cpu, uaddr= 2), - (base_op =3D=3D FUTEX_CMP_REQUEUE - ? tswap32(val3) : val3)); + /* + * For these, the 4th argument is not TIMEOUT, but VAL2. + * But the prototype of do_safe_futex takes a pointer, so + * insert casts to satisfy the compiler. We do not need + * to tswap VAL2 since it's not compared to guest memory. + */ + pts =3D (struct timespec *)(uintptr_t)timeout; + timeout =3D 0; + haddr2 =3D g2h(cpu, uaddr2); + break; default: return -TARGET_ENOSYS; } + if (timeout) { + pts =3D &ts; + if (time64 + ? target_to_host_timespec64(pts, timeout) + : target_to_host_timespec(pts, timeout)) { + return -TARGET_EFAULT; + } + } + return do_safe_futex(g2h(cpu, uaddr), op, val, pts, haddr2, val3); } #endif =20 --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739151; cv=none; d=zohomail.com; s=zohoarc; b=Mlsq/rQT8NBj0qK4IgvFUlA5U9rl+hqtqUPU9b0XfZ+DFtC43jfmVVpclSMCc/nP6f4EBumy4UfPWo+WKvFlHk279cJLmt3W38+DNanUaTy3PYUYVW8KrvP5AxSUtLiA0D8GPu8WOHGx3bdc3fSAZup8WZpzJjd+YucyPxOaaVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739151; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J/Iuv1qBW1Q0Rkq4S69aQOiknbfSod0alnGHuF6g37U=; b=blfhfMbeErRMQEKwvuiEJRdMv+V6hCSig1+ypi9Zn4KnCJfWclvS2qKUtOwLLBXxip5fpkrsDRaHmle7OrX5uSxOaRP07PiCBPvsUrti85JJjQNlcJurRk7fBaf1NgRLXCPpdhwdiKHvit7o2v+Da3INwXYa2AKoFQVyl/nNQtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739151662260.3546796098136; Sun, 28 Aug 2022 19:12:31 -0700 (PDT) Received: from localhost ([::1]:37528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUGM-0006AM-K8 for importer@patchew.org; Sun, 28 Aug 2022 22:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUEB-0003SG-AD for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:15 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:42696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUE9-0001bR-NC for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:14 -0400 Received: by mail-pg1-x52e.google.com with SMTP id q63so6429594pga.9 for ; Sun, 28 Aug 2022 19:10:13 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=J/Iuv1qBW1Q0Rkq4S69aQOiknbfSod0alnGHuF6g37U=; b=UOKKl9z0pDVgVjAhr5qSNRYj8gCsivYZ2vUv1BiXakcZM2Bt9Zr6g1E6Dj0wm+povj oChEUW8mDelcWz4hLR29bAgFavCO9lYdU86OAHvJbzgoZZlCaFcRGRacaSJmCVKHcNby i1gHhsKmjKyOCOpRrKjTz8VhHXOKE4jcxCGK5MvuYQt5OmkFhZD8quIxZmGzGvpnzEe2 3x47ZUK2iNZj2mZWF/xm/b7UKsCEYDNejEjfkMtBos8Qn4T4iDtadCYPFRMsJrQrHO10 F28pQ2dCEcYw70Q3oSD3PNcKw+Hxc+QlkIO1r4olHjgFi1bDj9vlMOxS0knY45RYNmKF 2t8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=J/Iuv1qBW1Q0Rkq4S69aQOiknbfSod0alnGHuF6g37U=; b=ZtaQEnyNnJMOq5MllKUzFY2p43FK8wT9gWBD+AJxFItSR77d9prlGkbWGJqiwvm99p Y4cOoK+sDxORGCkVKcQ4TKy0p2eLfWjG+VehldKDf4CKhT8nu2ovhSgtHsy4q+EscnFM k7enG7R5z+WV8QZOXFUR1mNXQ6IezBiuJiszm26gEKu+zZZ3YvGcp26zWoUNy4H2Fulw UF7Snm/aeKV8Ng/Bni9s26dqnx7txtkFnURk3YV5n+VFcGq32Ed8pIt0eJ39TQi8o1ZP +d3CqO2QGaUB5IH6CTCmgkOM3zcdBC5ozL0tfx/CnA7jGKkw4il+pzkVdN17jKlxOgHl vJcw== X-Gm-Message-State: ACgBeo2VEoDIP71lLPGzEIzMjSy/Udv6ITOKdnJZ5lE53uDiSyyG9J/E 8neQSIL+l0HPDt4VQK4L/aF7RvxS9hwDkg== X-Google-Smtp-Source: AA6agR7OeZGF0kOb2owBhpnLGPy6L+xgR20ad8B2ZknkiRr6efvsMACiQxNsstOeIeuyYvKqem9tXg== X-Received: by 2002:a05:6a00:174b:b0:52f:c4d1:d130 with SMTP id j11-20020a056a00174b00b0052fc4d1d130mr14196082pfc.23.1661739012413; Sun, 28 Aug 2022 19:10:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 3/8] linux-user: Implement FUTEX_WAKE_BITSET Date: Sun, 28 Aug 2022 19:10:01 -0700 Message-Id: <20220829021006.67305-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739153316100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8fbd5a9556..8bf4b79a9e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7774,6 +7774,7 @@ static int do_futex(CPUState *cpu, bool time64, targe= t_ulong uaddr, val =3D tswap32(val); break; case FUTEX_WAKE: + case FUTEX_WAKE_BITSET: timeout =3D 0; break; case FUTEX_FD: --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739155; cv=none; d=zohomail.com; s=zohoarc; b=ERPY2NN3lNB48VdIWIjDyRNhJhekp1xk0lRR/AgRvwNwXKGmb3+vlyQMExbAS6uYgrZRmXZ/vduNnrdpcovWvstozQYuWwTocK0xWKgwY02yBpwP5Pq27OUte9pP6R8ENJcEWNzbhqoSzvS1y3/mQ4MZSIHbVrNfV/3LKHbp5OE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739155; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vuOgmHjKOfypW7fKTz7cNS4k/xnt5yEqi5+DGy9oOvU=; b=BgPzmfFYVnM8iKLAzmInGlnF+r1SPqcKpQjQifM5jwHfn6hQR7NhbYbMbHeXRIr4GoA1VCQv8sDbc3NdusC8gyXD+ML2OieGS+ZCKVRh9h+6LZtCI7BbalPwfMZHAwNjZR7BOYHMChk0e7krEpXn2M7up0e7vNYcMg+jxnQMn4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739154992704.5278381440327; Sun, 28 Aug 2022 19:12:34 -0700 (PDT) Received: from localhost ([::1]:37530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUGP-0006Io-RL for importer@patchew.org; Sun, 28 Aug 2022 22:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUEC-0003UE-EN for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:16 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:46867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUEA-0001be-Qk for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:16 -0400 Received: by mail-pf1-x42c.google.com with SMTP id p185so6819115pfb.13 for ; Sun, 28 Aug 2022 19:10:14 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vuOgmHjKOfypW7fKTz7cNS4k/xnt5yEqi5+DGy9oOvU=; b=jh21QBT1S2S+J4/UbtQkKpU4GBeu2kzAqeSmnsiY7CW2T0XJlGCsOFgXf4arS+OLpE BYEpR1skBfPzb+6NvSK/eoG1y0+cR6gk9M6xyEQOBQfQpUXA404NlIPXp1FEVdRltODK Y4hYJaiuxtKsggW1lht+8Kov+I/zz1OG7QVYeJM+HOOpL43ungSgthSBO2uNMzM6QBus iWHdHvRshiqBtQ6lc+8kD9dPAmTW5+P05VhCKecuxEPk7dM7tDuqvBYuto1m/EWp9RL2 XafuEFVBpOGIWRSksW3HhnFLErv929kjoXujWnlxCczqPt4RgvbNuKjJy4SFG+u51iwe l5Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vuOgmHjKOfypW7fKTz7cNS4k/xnt5yEqi5+DGy9oOvU=; b=yH4YW9hCqDSv0yQf1ddIx2+uZ0B0ommDrCuf9e7EA0n9D4fHBZMK9mMNTaVm+47nCF ppHka3XYBRcJBcKI9A2MpIRY5/mfEGvJcd4Jzc+wW3BLzxHBYj5UcbUzhz4RdaOaBTw7 b490ZVS0Jj1mGKo7EsAffHCOxRuhzhFcXP6jTMsAJWnFIq00BXO1sCwxK53E+x1v6i9K pDhWkNJUB/fgfR1RvVWRGgqwz/UueAxTRhGiLcR7ueFm1HRodRqbS/Eu4DwtlW+ZBcJF Wc3VgTvIts3ad4ChK5Qs7MrFFU+ahqiGiEmoBFPlBVdQYTi6Kw0OyN5UKpJc1UyLkAMr 2fKQ== X-Gm-Message-State: ACgBeo18PJt3KwIkKzEx+gQbK/Bm8dA7q/VY2qckCNMsfzaxgGUhVI+4 UP0Oq88i2hkJCq8Csdo4mzjRU6oJYv56dQ== X-Google-Smtp-Source: AA6agR7JqmcPsCAjEeMS93uBNdbJuOgLO9oatLb3+2vwLRPJN0HC+DaFfNdQaZ9WwzhHPVZJ+uRHrA== X-Received: by 2002:a65:6d0f:0:b0:42b:42f8:efe0 with SMTP id bf15-20020a656d0f000000b0042b42f8efe0mr12485952pgb.197.1661739013317; Sun, 28 Aug 2022 19:10:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 4/8] linux-user: Convert signal number for FUTEX_FD Date: Sun, 28 Aug 2022 19:10:02 -0700 Message-Id: <20220829021006.67305-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739155328100007 Content-Type: text/plain; charset="utf-8" The val argument to FUTEX_FD is a signal number. Convert to match the host, as it will be converted back when the signal is delivered. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8bf4b79a9e..f50cc70f1a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7778,6 +7778,7 @@ static int do_futex(CPUState *cpu, bool time64, targe= t_ulong uaddr, timeout =3D 0; break; case FUTEX_FD: + val =3D target_to_host_signal(val); timeout =3D 0; break; case FUTEX_CMP_REQUEUE: --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739313; cv=none; d=zohomail.com; s=zohoarc; b=FjWnFrnp5SYcpj3YjqicCgUxybQ8uH4j/T5a6IazW47lcG7XBYGrAYraq4IPIHmlgIFHwa2gXEb1X35/2cwjSWw7D1KZmPYflwtN/xzIGIAMwWibP7eCL2m1Dqa2TE0tmxJ0AVNO33caslqNIzZlLdyo6aMyVpDtdHxcV2S64C4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739313; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LYi0lu55bGaCgaXFFBKaxC2lMAPBykVR4TgtPvHjjww=; b=YFhB2Sdzc61UOeWfBpCuZfuYdYrDTc5ViX4+Rx1F0+hFxmK4YMYNfO/iq9tppDzrc8Ky8Y4hULQEddbe9DPJjunVPUwfp4r8BNPME5c2faHzZfH0CeesCivGtphWxHLOnYsU5J8qMGrKCNb4pAkDAhl6pSIB+balobmuXAnmuTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166173931341256.69617645056587; Sun, 28 Aug 2022 19:15:13 -0700 (PDT) Received: from localhost ([::1]:59410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUIy-0002ug-DY for importer@patchew.org; Sun, 28 Aug 2022 22:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUED-0003W3-55 for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:17 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUEB-0001bq-It for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:16 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 202so6434271pgc.8 for ; Sun, 28 Aug 2022 19:10:15 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=LYi0lu55bGaCgaXFFBKaxC2lMAPBykVR4TgtPvHjjww=; b=tJDjmVuBW9gcxkyqRY6D3k+ZXFcqNAe7Z0EuxQkOrRMPQF8M+Zxy8u61G3K6jVY1ei S8uTr+1OT5Axi7gwTqMjncFELU+NIwl6IRjkEovXjInV/DTsFPSg/srDt4ChNxGMhxv1 ySq6ySHGYFGR7KghPnqKpXY1b+DTYcmaRjEa4JBvXOTVJsYg+hEikcGIfsrjz+xjo0Y4 6ujqTtq5xryHPE4IuROmM/W3sxS/G0mGYOfP4o7ZLaPKe8tVPfU/SjPwd9r0hVaJJw+2 9TmCPou2nC4Adqln8VTpMWmwGgGlWKciM6HntOE9vKOW38rgztqRLS3y/MY3gew9Wct9 oXSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=LYi0lu55bGaCgaXFFBKaxC2lMAPBykVR4TgtPvHjjww=; b=nEJ8BlfSEeYrRDnPV3Ff3sL7JZ3zpaZ93yYuKi6mP1wdWqku5uOvqGLkCvm9Ghg9lS CFGiFkmjEM10gfMTy6qMG9TGmyHXGstpwObHiFMFFCh0QpHIw4xVUDdanD3NIFvUtEDA XqLEhdFkr514mBhmY5ALOR8ELoAipbBjBNno0ROO+wROcmFT5aBSE6dynpVvuzwcvlc9 elhOIJ1APIYeV7b4///Gr0gXV7dbncvqOIO7z9ziM6hR6xjWFc6zzag9GNR/wAOOKHcN Qg2uySd7mOLsdDbprX+oY+/dYYY/jpw+r5DCCS5v3ceX9a3OLqOP+mLfdID1+IkCGAaN GlQA== X-Gm-Message-State: ACgBeo0rc1ahYGas9i6GgHQRORz0D/w0zaW+5HHgIWkp+C1dpI79d5Ti 6TeC1cVdoHz3cG0m8nEYDpAkbyu5W0vFiw== X-Google-Smtp-Source: AA6agR5CcSDjS86R15eVTljKSa9MN2SamuqgC4nBovWcxuoA7WLai2gwwAZcgHSuRfNRwfSht8bZjA== X-Received: by 2002:a05:6a00:1356:b0:538:1bf1:7cd with SMTP id k22-20020a056a00135600b005381bf107cdmr4996808pfu.32.1661739014313; Sun, 28 Aug 2022 19:10:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 5/8] linux-user: Implement PI futexes Date: Sun, 28 Aug 2022 19:10:03 -0700 Message-Id: <20220829021006.67305-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739315175100001 Content-Type: text/plain; charset="utf-8" Define the missing FUTEX_* constants in syscall_defs.h Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall_defs.h | 3 +++ linux-user/syscall.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 85b0f33e91..9a6d7893d9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2699,6 +2699,9 @@ struct target_drm_i915_getparam { #define FUTEX_TRYLOCK_PI 8 #define FUTEX_WAIT_BITSET 9 #define FUTEX_WAKE_BITSET 10 +#define FUTEX_WAIT_REQUEUE_PI 11 +#define FUTEX_CMP_REQUEUE_PI 12 +#define FUTEX_LOCK_PI2 13 =20 #define FUTEX_PRIVATE_FLAG 128 #define FUTEX_CLOCK_REALTIME 256 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f50cc70f1a..d2d18d29a6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7773,8 +7773,17 @@ static int do_futex(CPUState *cpu, bool time64, targ= et_ulong uaddr, case FUTEX_WAIT_BITSET: val =3D tswap32(val); break; + case FUTEX_WAIT_REQUEUE_PI: + val =3D tswap32(val); + haddr2 =3D g2h(cpu, uaddr2); + break; + case FUTEX_LOCK_PI: + case FUTEX_LOCK_PI2: + break; case FUTEX_WAKE: case FUTEX_WAKE_BITSET: + case FUTEX_TRYLOCK_PI: + case FUTEX_UNLOCK_PI: timeout =3D 0; break; case FUTEX_FD: @@ -7782,6 +7791,7 @@ static int do_futex(CPUState *cpu, bool time64, targe= t_ulong uaddr, timeout =3D 0; break; case FUTEX_CMP_REQUEUE: + case FUTEX_CMP_REQUEUE_PI: val3 =3D tswap32(val3); /* fall through */ case FUTEX_REQUEUE: --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739347; cv=none; d=zohomail.com; s=zohoarc; b=XU4x4dHqrulZgIQFRAaojQOXgoN8bGeuvGf4QbYussO48LrVdGhTCy3bITzg8JkqfSuAPixsG5rRdayf6Qddx/O1u1gf4GzLWxDqgaN0CPrx7twIKqfBuAuTg6dgv8bgCKhwNa+h/gBOGH95+ARWR6TlCfizD7o8ypGSgq/G9tQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739347; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pwvz/hjWr74KHf0VVDf44MC9Wv0aWLdga0oygTPDgYs=; b=k3PrO9QQK00FjzyBSaxN1QWriOdaKsbN6lq8emy/uDa2L/C5iUfYdXjcC/1ZuLJLWDmSFWwz5hcLtkr01O8X46DHh8Jj+992sMWUSpm6cyXR32PVC8+OvbpL1DEoMqaQhSLVZojCY3tF4hnfFtfYU7bhv7TxPYY97JFQllFOBDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739347391868.6061203317297; Sun, 28 Aug 2022 19:15:47 -0700 (PDT) Received: from localhost ([::1]:59414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUJW-00034s-CL for importer@patchew.org; Sun, 28 Aug 2022 22:15:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUED-0003Xg-NC for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:18 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:34653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUEC-0001bC-2b for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:17 -0400 Received: by mail-pl1-x629.google.com with SMTP id f24so3857570plr.1 for ; Sun, 28 Aug 2022 19:10:15 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=pwvz/hjWr74KHf0VVDf44MC9Wv0aWLdga0oygTPDgYs=; b=u96HWsRvQD0EEbdIEdckDlhCx9a0fFv3Px+vrau15S2moR0OOc4LbFidUM10CQ17r3 UDQuIdXgFVAlRz7VnBL9SIoDGAoc/EzeiKuxNzutyzhN/CCJetGZ5MPkicYhC2H2eYYa YbDphix/SMoOfUs0o1CrJv6Wa1QoIjzabomfZyUEQrwN4XM0cpJppiJkfDyDFpgdrk+l MQuSJXITKWMRlQExGRm7qWrvh9iJUriT37HZcUP/+7O1eColOjMXk3pxlfejc8LieAU+ II2YvMY5GwpHXBEbeNiIDPsBUT3Jqzswr17D6G8WeBczVKk6d6f49FG9nnw7axmSRNRR 5oSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=pwvz/hjWr74KHf0VVDf44MC9Wv0aWLdga0oygTPDgYs=; b=JrXlClEoSV/JjFZWJlM3RCJ06vdKRKfxEjzmWoOYXTVuviHBJYIOCsXF3CO43Wgtyu u8rGRusHC8d0NLi2shbBJOzQYhRRCpbzKWbC8TY7z44r7MYCrkZ2y7K56H5pIrGBIJXk nJey7Q5vqeo5RG58dZki3OPQCiybSlRsyshpe/Pnv/l90UaNVKDr5WjRdLzznbtIxDeo 0qrBQxRqgJ2TkY2HZgD5cRc5BNpnK6Nnd1H1ejIgJuYaBuB8m6Vs5617nRFLoFnJfi/b y81VdWK1EXS6AnwvO9dtR9n4fQA1NLjDaWTPxLKrTkb1zwc3+3CGtCYn3/Tcv2UybI7x XQfQ== X-Gm-Message-State: ACgBeo1BAbQvO2caJVQLuBMEjU0cTSnJi54jtuvxHnjKGG+2FQEzjwpW d24EditGvmVQj5whDNsEeVCHMCsLoQhu7w== X-Google-Smtp-Source: AA6agR4JslWUBxLdpxYBmAKTOSuDy2UbTZlj9NuWexuZe8zP0Pz6TBgoGhEj3RHq0cWeWXyrUqKFig== X-Received: by 2002:a17:903:2c9:b0:172:57d5:d6f0 with SMTP id s9-20020a17090302c900b0017257d5d6f0mr14959181plk.61.1661739015205; Sun, 28 Aug 2022 19:10:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 6/8] linux-user: Update print_futex_op Date: Sun, 28 Aug 2022 19:10:04 -0700 Message-Id: <20220829021006.67305-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739349469100001 Content-Type: text/plain; charset="utf-8" Use a table for the names; print unknown values in hex, since the value contains flags. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/strace.c | 65 ++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 7d882526da..8eadbed39e 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3576,44 +3576,37 @@ print_munmap(CPUArchState *cpu_env, const struct sy= scallname *name, #endif =20 #ifdef TARGET_NR_futex -static void print_futex_op(abi_long tflag, int last) +static void print_futex_op(int cmd, int last) { -#define print_op(val) \ -if( cmd =3D=3D val ) { \ - qemu_log(#val); \ - return; \ -} + static const char * const futex_names[] =3D { +#define NAME(X) [X] =3D #X + NAME(FUTEX_WAIT), + NAME(FUTEX_WAKE), + NAME(FUTEX_FD), + NAME(FUTEX_REQUEUE), + NAME(FUTEX_CMP_REQUEUE), + NAME(FUTEX_WAKE_OP), + NAME(FUTEX_LOCK_PI), + NAME(FUTEX_UNLOCK_PI), + NAME(FUTEX_TRYLOCK_PI), + NAME(FUTEX_WAIT_BITSET), + NAME(FUTEX_WAKE_BITSET), + NAME(FUTEX_WAIT_REQUEUE_PI), + NAME(FUTEX_CMP_REQUEUE_PI), + NAME(FUTEX_LOCK_PI2), +#undef NAME + }; =20 - int cmd =3D (int)tflag; -#ifdef FUTEX_PRIVATE_FLAG - if (cmd & FUTEX_PRIVATE_FLAG) { - qemu_log("FUTEX_PRIVATE_FLAG|"); - cmd &=3D ~FUTEX_PRIVATE_FLAG; + unsigned base_cmd =3D cmd & FUTEX_CMD_MASK; + + if (base_cmd < ARRAY_SIZE(futex_names)) { + qemu_log("%s%s%s", + (cmd & FUTEX_PRIVATE_FLAG ? "FUTEX_PRIVATE_FLAG|" : ""), + (cmd & FUTEX_CLOCK_REALTIME ? "FUTEX_CLOCK_REALTIME|" : "= "), + futex_names[base_cmd]); + } else { + qemu_log("0x%x", cmd); } -#endif -#ifdef FUTEX_CLOCK_REALTIME - if (cmd & FUTEX_CLOCK_REALTIME) { - qemu_log("FUTEX_CLOCK_REALTIME|"); - cmd &=3D ~FUTEX_CLOCK_REALTIME; - } -#endif - print_op(FUTEX_WAIT) - print_op(FUTEX_WAKE) - print_op(FUTEX_FD) - print_op(FUTEX_REQUEUE) - print_op(FUTEX_CMP_REQUEUE) - print_op(FUTEX_WAKE_OP) - print_op(FUTEX_LOCK_PI) - print_op(FUTEX_UNLOCK_PI) - print_op(FUTEX_TRYLOCK_PI) -#ifdef FUTEX_WAIT_BITSET - print_op(FUTEX_WAIT_BITSET) -#endif -#ifdef FUTEX_WAKE_BITSET - print_op(FUTEX_WAKE_BITSET) -#endif - /* unknown values */ - qemu_log("%d", cmd); } =20 static void @@ -3625,7 +3618,7 @@ print_futex(CPUArchState *cpu_env, const struct sysca= llname *name, print_pointer(arg0, 0); print_futex_op(arg1, 0); print_raw_param(",%d", arg2, 0); - print_pointer(arg3, 0); /* struct timespec */ + print_pointer(arg3, 0); /* struct timespec or val2 */ print_pointer(arg4, 0); print_raw_param("%d", arg4, 1); print_syscall_epilogue(name); --=20 2.34.1 From nobody Mon Feb 9 18:22:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1661739635; cv=none; d=zohomail.com; s=zohoarc; b=ZpQXPmcdkaS0CiJfCAUy7zdI0JuhISCNi9TEhH/taTmy0O5BI5WivZuyh2mDQ5AnJwDMfi8E8coL+EkkuLIpwI89912Bb5Sn04wCKznkZKKoV/BnBHu/AfxgLhyL5PtlwVB0Cb5xcG3WPCjU1r4FiTnCWkIb33+NKlJotkquK84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661739635; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MG15NAkIAITNs1OE3bxclYfrNMvmI1vfTm8EKN0Sndo=; b=XvDWYOcuJuZezn4y2Hpbde7R6hTofoMTuLsSXPOWUxUEaSIybAYyMipwyLbFzi//ZQVe78gQ5tzJmdYUe6cz5HCCgD2lB9jK5Tmgjm0SQOa4xUD/EGD6+xRysv0kM5pCcoJtL3waj3izH8HfGrGcJLKnEGgzwZHFHtbX1MxTZ78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739635137117.30484071839032; Sun, 28 Aug 2022 19:20:35 -0700 (PDT) Received: from localhost ([::1]:54724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUO8-0007K3-Ij for importer@patchew.org; Sun, 28 Aug 2022 22:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUEF-0003as-QK for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:19 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:42982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUEE-0001cH-3D for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:19 -0400 Received: by mail-pl1-x62a.google.com with SMTP id v5so392088plo.9 for ; Sun, 28 Aug 2022 19:10:17 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MG15NAkIAITNs1OE3bxclYfrNMvmI1vfTm8EKN0Sndo=; b=RFDTln+pSjDUmG9UXyVj9H6FTR0ihRkPbzZpLHxIqKUSURhGJ140a1LbMaUE2DQ8+J 3pVkbBQHuGi/YU3NnyC8PfpSUnCcAfEbv2H9cFwRlxqGxRtQl1TTEs+HZxrFA7Qg3HdF EMK0ukMsL3fBgXULEh5DyM8HpVSvJtT5KeuZA0RWuj2h06L1kiXVP1G9//8lKHvlZzB1 bNLAm5oQnrTvQfV6Aq0IHR22lYeVXxUJj2du/xCKxjwprx7NLo6x6WX4Ghi2H2PV5xJg SglPiCWC6xme1oVTRUShLH4hZR7XNwh/pY1q+UeTloafvkAADhmQB/kkBgcFAPaZ+tVK E+zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MG15NAkIAITNs1OE3bxclYfrNMvmI1vfTm8EKN0Sndo=; b=Q331+3CR/9fKr+5emaVHcuZe2wCZDoSdSh30RzwRpiFARWkkmgEwGmc88WPm4WYjBh zaZFjZlnsh3+N/OgEMByMdp3vgSoYYJ1ymlblbiNY+qQxsrMJsE97WVdDhk7sp2ZAQt1 ONHqayBcOQE8hbs7hv+WvI0Vv0PsftaQCjb073GSl9V/BlSvZk3qO03fJ4KdxlPg3ORT rwPqXlnoAYgaJCr7K/qLSMY5GHWMHCAKZCQoWMr0mH3/jbQxO/KvfhHQmnBZrecqFWn9 zRK0KmpslFSKsiT5JNN3piH+DjyCozSS1BDkDKSoJ+CNAHv24VNCuldjMP/1Caz2BXvp aUZw== X-Gm-Message-State: ACgBeo1mV6+b3PlmX7oJmomXgXysUCDeQ/M+cpVl78fl5Dh3gloLme0o Z27f3HD7qw0Ng27YsokJzwpqTZ6DLHmnEg== X-Google-Smtp-Source: AA6agR7QIf9y01qZDpoBaHEZIjUOA6KwkZwn/k5XxjDHvH2g7n4b0i1ETUaiP7VNencgSaKgDIyyrQ== X-Received: by 2002:a17:903:2d0:b0:172:b63b:3a1e with SMTP id s16-20020a17090302d000b00172b63b3a1emr14610369plk.76.1661739016406; Sun, 28 Aug 2022 19:10:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 7/8] linux-user: Lock log around strace Date: Sun, 28 Aug 2022 19:10:05 -0700 Message-Id: <20220829021006.67305-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739637032100001 Content-Type: text/plain; charset="utf-8" Do not allow syscall arguments to be interleaved between threads. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/strace.c | 65 ++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 8eadbed39e..c47d91bb3d 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3773,26 +3773,37 @@ print_syscall(CPUArchState *cpu_env, int num, abi_long arg4, abi_long arg5, abi_long arg6) { int i; - const char *format=3D"%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ","= TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_A= BI_FMT_ld ")"; + FILE *f; + const char *format =3D "%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "= ," + TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," + TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")"; =20 - qemu_log("%d ", getpid()); + f =3D qemu_log_trylock(); + if (!f) { + return; + } + fprintf(f, "%d ", getpid()); =20 - for(i=3D0;i (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661739639239638.0590885565779; Sun, 28 Aug 2022 19:20:39 -0700 (PDT) Received: from localhost ([::1]:60642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUOE-0007WK-4H for importer@patchew.org; Sun, 28 Aug 2022 22:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSUEG-0003cB-Be for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:20 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:43849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSUEE-0001dS-Ol for qemu-devel@nongnu.org; Sun, 28 Aug 2022 22:10:20 -0400 Received: by mail-pg1-x52c.google.com with SMTP id v4so6433559pgi.10 for ; Sun, 28 Aug 2022 19:10:18 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:2fa6:2ab5:a96e:2a35]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bdc98730bsm6035139plb.151.2022.08.28.19.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 19:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=55VT9o/tNovUP7KyBCwm0gq6nWLk3JJV6wEPVewGesI=; b=zuQrGBgFmMCQ4pX79kNUORVWR0cViTr22oZUZIwMhmkPKkCUDJMId08BiCFhrqNG3N TvVvkr3a2yrB9P2fUwM/ty9+60JeT2U0roSYx9t9vNkS9frvxvwtbZIJyI/+Hb6d4YUS 3XP7cFntzpvM1u1ewsNBqaETzYS8iq5TBVR5ChSY2eaMdtYbSFZVoXJfJYWHj17zKI23 mr0AXjTZLkHR/MTlxmx91FTGMnGURtQ2Y1ol3MJyRntjQlkZs+GYQ+75YON4Uh0rmSC8 YJVIqd+n1m1zNY1gLo1g94K7rfBe4v/FONyLFT9/kTwS1/WQaqJfp5Xv2AkK9GS7hVZq BM1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=55VT9o/tNovUP7KyBCwm0gq6nWLk3JJV6wEPVewGesI=; b=P/WX1D76C6T9ARnQ5FvRgKktMAq54AX/A0SA13CtGDdLwcm0vRHDnz25FwTgCHpJMd b1DVWcuknUd71QVNUqSA1G/rSRNr2Y8D1jKaW+gzaLrdQmtf8jL7FD/Dn89nikzFX/tq VZxoTLVjnF3huTbrCtsdKcFBSP3rkogRU4Q4ImqLGe+qTIEE3R0tLbG/vuskw8bt413H uUqw3qXhfBlymGOMmM4es6sf8wrMo4gLqzEO1S7ICO4/gHMuvM/m4uyYdYmpJsrL+8eR EAvRlpe/GSN0r8anwrBPpKgIzQNL3lDDZQr+fFIxGhRB85TXnBbc15QcVsTq7WcgDW1o fINA== X-Gm-Message-State: ACgBeo1LtlF3HUtpBACNHQ45fy+9SOZtEkiQdYnJ6Z6TH2ADoLMhp6GQ 3BQ4UzK3tyuh3ZtrV+hziE1cuza8Ohu+6w== X-Google-Smtp-Source: AA6agR7nzrv5NyJHjevcA5q7kPGGTbkuFObJ/m2c67LGu2yEGL6EmbbNRPuHIk4AaE0OLDbIH7P81A== X-Received: by 2002:a63:4e44:0:b0:42b:1fff:72d1 with SMTP id o4-20020a634e44000000b0042b1fff72d1mr12355972pgl.432.1661739017405; Sun, 28 Aug 2022 19:10:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 8/8] linux-user: Log tid for strace Date: Sun, 28 Aug 2022 19:10:06 -0700 Message-Id: <20220829021006.67305-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829021006.67305-1-richard.henderson@linaro.org> References: <20220829021006.67305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1661739640792100001 Content-Type: text/plain; charset="utf-8" Printing the same pid for all threads isn't helpful. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/strace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index c47d91bb3d..ca9d44fa7c 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3782,7 +3782,7 @@ print_syscall(CPUArchState *cpu_env, int num, if (!f) { return; } - fprintf(f, "%d ", getpid()); + fprintf(f, "%d ", gettid()); =20 for (i =3D 0; i < nsyscalls; i++) { if (scnames[i].nr =3D=3D num) { --=20 2.34.1