From patchwork Mon Aug 29 02:09:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600857 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1684145mae; Sun, 28 Aug 2022 19:14:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7+WqNcKlbCqOVkVCRduhZl3h/pgBb438EibJEiEl73DsFFJ+Pch+N9smCH9scmhngXemmX X-Received: by 2002:a37:aa04:0:b0:6bc:56c0:63c9 with SMTP id t4-20020a37aa04000000b006bc56c063c9mr6808058qke.449.1661739282101; Sun, 28 Aug 2022 19:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739282; cv=none; d=google.com; s=arc-20160816; b=zcxDDUzMj1/ipSoEuBPEWY4iZRgfxj0XVdQx9kOEperfUPMMZi9EBAkST3vboYykJ4 G0KOBkS9TimPj70J8oLSrHMOVQa+r5I1oQhoAA/Brx/tu52ALtkSTosJfhIt/87cL5Te VaycVi7SpsYuL2Hac3N0XDgzWNPnAckK92YOnXJ1Jy8yQP9YNvJovv2ntQ2GREPsu8e8 bsmvEVQs+61zxLwjbb/h074HeLHGeuQ/0znUI6QTsQICXJ454lguVr+SNJ9LL2mjhn2g SgRLYJYjBiLq+YmeNNsTKmJV3DZS04+9IcotZSfBUGFSaDgx09kkMfM4gfzNkUE+Kvgx 8Kfw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0RVm116KJVpIo1WmvyYIGakdNu7H4Sz7hO6ZwQRM5+8=; b=wpKC+C5wf742BNN0MXVnPlztMfSPDmpPtALPxDsN0tO+N9U2kM3lIkH5OtMKujPlPR bopNnJIEA7a+8G5N0mJiu6IhnTR5cg3y34ueN39RemD75ig0uIYAF/bLPPG3mvUgCLeE aF6tC4b/bVwXDtElH/pmvs5dJJqprL+bhGNvvfmOWGhoV7nrE+k/kXRS18u1j+8EhbDk HL8Sq6uD3fSsIGfLSOyT6wvwycZuBSu/4X0NpnejaNBrfXUdOC76krdCqC8AEuURK55x fH40CUh50gOtA+AZ9EKYLRiLzsnDiFILGFl+mWT4qYiMooPyxmHt3dt66TGZBT/Go5Y3 cRDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nzz2cicT; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d20-20020ac847d4000000b003449e4c3063si3477059qtr.403.2022.08.28.19.14.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:14:42 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=Nzz2cicT; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUIT-0000ho-NV for patch@linaro.org; Sun, 28 Aug 2022 22:14:41 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 uaddr, int op, int val, case FUTEX_WAIT_BITSET: if (timeout) { pts = &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 = NULL; } @@ -7802,56 +7807,6 @@ static int do_futex(CPUState *cpu, target_ulong uaddr, int op, int val, } #endif -#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 = op & FUTEX_CMD_MASK; -#else - base_op = op; -#endif - switch (base_op) { - case FUTEX_WAIT: - case FUTEX_WAIT_BITSET: - if (timeout) { - pts = &ts; - if (target_to_host_timespec64(pts, timeout)) { - return -TARGET_EFAULT; - } - } else { - pts = 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 = (struct timespec *)(uintptr_t) timeout; - return do_safe_futex(g2h(cpu, uaddr), op, val, pts, g2h(cpu, uaddr2), - (base_op == 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) From patchwork Mon Aug 29 02:10:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600853 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1683288mae; Sun, 28 Aug 2022 19:11:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4nTf2iH37AylOtyM3LggxgwkvwJDewhDA9vW0EqjCgEBDoabEbjln7MlUdrLqPky1MjTPy X-Received: by 2002:ac8:7f0f:0:b0:344:2fd8:8a66 with SMTP id f15-20020ac87f0f000000b003442fd88a66mr8623186qtk.98.1661739092326; Sun, 28 Aug 2022 19:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739092; cv=none; d=google.com; s=arc-20160816; b=RI62t7K6urJW/qA7ORQxzATm6/f7LndjqbCDgeFa1OjouuCG4VapqIv0cSlEAVFEMj YhX4G7Gr20wAyj9MhjStdyF909wDEldf33580zr9rpwT8kKk1dtWYQoZ+7QXDShGZ6/g 8xZ1eWS65PfRSVWYZI6OvZ4FjZ2LfmjivjjHsGMmkvUikBk8F2ihwH6V3tk3uM3S1GGw 1yr8q34OXbQ2suFRELRM8iOTjAYTiPgQYTqEZqrX7E/RrsHVqDaDAp4t8CK2hyx7vMVr Xvas2OgwGL2nyvhE2W0wJpplz3k5pmbtuDXQbjGqXc4ubNMA2pZk/Ywr1SGst1ytsooB I8Uw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MtNh2w+4V2y5mwzf678UGVcQqp1eS0dpxGcLnKcxRPA=; b=Kf09gP2DAZzMTVOc1fBTW62Xw90aYQCFHo330kgouzSgp/lHEJqCWtDW/SvrRXf34M FawtKFlL3TjDSQi01zTcpBJWl7GE8lh8sdYZSqB0rq8Jzk+QM9AS2GkpcX2syeKef41T LBGIe+hOLfCfp315eE7By4x0QEjAxTPpvNbCUtYS0fvQAHLLyNWHmEH5QoWEWScNCxMb YoBq4vNCQOMF2DQgzhTth4p/DRjxnpcHnCvRQLolNrEJuSl1qDw6hWR02tdNRwPXLNE6 7lU/zVgkDbMUbwmCeqRlWd4wf26/ehIzAPJ/rJsbRX/R5ycg0JfpIdWmWYtUXrlxyDk3 nglA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ykxb3D+j; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kk8-20020a056214508800b004744c9be1aasi3057871qvb.156.2022.08.28.19.11.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:11:32 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=ykxb3D+j; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUFP-0003T3-UE for patch@linaro.org; Sun, 28 Aug 2022 22:11:31 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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, target_ulong uaddr, int op, int val, target_ulong timeout, target_ulong uaddr2, int val3) { - struct timespec ts, *pts; + struct timespec ts, *pts = NULL; + void *haddr2 = NULL; int base_op; - /* ??? 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 = op & FUTEX_CMD_MASK; #else @@ -7771,39 +7771,41 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr, switch (base_op) { case FUTEX_WAIT: case FUTEX_WAIT_BITSET: - if (timeout) { - pts = &ts; - if (time64 - ? target_to_host_timespec64(pts, timeout) - : target_to_host_timespec(pts, timeout)) { - return -TARGET_EFAULT; - } - } else { - pts = NULL; - } - return do_safe_futex(g2h(cpu, uaddr), - op, tswap32(val), pts, NULL, val3); + val = tswap32(val); + break; case FUTEX_WAKE: - return do_safe_futex(g2h(cpu, uaddr), - op, val, NULL, NULL, 0); + timeout = 0; + break; case FUTEX_FD: - return do_safe_futex(g2h(cpu, uaddr), - op, val, NULL, NULL, 0); - case FUTEX_REQUEUE: + timeout = 0; + break; case FUTEX_CMP_REQUEUE: + val3 = 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 = (struct timespec *)(uintptr_t) timeout; - return do_safe_futex(g2h(cpu, uaddr), op, val, pts, g2h(cpu, uaddr2), - (base_op == 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 = (struct timespec *)(uintptr_t)timeout; + timeout = 0; + haddr2 = g2h(cpu, uaddr2); + break; default: return -TARGET_ENOSYS; } + if (timeout) { + pts = &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 From patchwork Mon Aug 29 02:10:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600854 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1683294mae; Sun, 28 Aug 2022 19:11:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6RPmQ6lqqAZAg9ShM2ObqeBxbm60CRCpAogmGGgihAcu+qo9mE+VFqF+bE0nZJ1VtItrz/ X-Received: by 2002:a0c:b298:0:b0:473:8d6a:df00 with SMTP id r24-20020a0cb298000000b004738d6adf00mr8921151qve.71.1661739094711; Sun, 28 Aug 2022 19:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739094; cv=none; d=google.com; s=arc-20160816; b=gtI7kSaVFe5TUgZL8Iijzjb+N+gwXnNw1dh0PQIfPvE027znv+y/oeaiUG6ajknvNF Adsh+bnlIGNfn//GrKLD8g5CfADBaGDbPTZ4PooWXt25fYTllk8bOboxxEAYOEP4J/Bz zM1awEstTD0KPBVcbmN1N+f0YyHir4wIBRobWFMBqUp8Un2N0CtOOGXJUC5BX9GFEr/z VHMLYUtkm5dDVruOc9OXNUjM6tWNMRgycDhF0VeceyfMWdr3ujMbRHeXEPVjdnbDQm5Q 5DDogHsbLY5kO6LcMUoY9pRL25Fgs8NTPUe9O7rZZ879G2tPILPj+dIFbyy8PUQmem4s ETMQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J/Iuv1qBW1Q0Rkq4S69aQOiknbfSod0alnGHuF6g37U=; b=vciEQzRrWVBacyA9TCE/dSTf+5JFhrRQHdZ+MVYfC5z4thNRSREWSZhJvJwYCPiYJu 9vPcRD/DG8MKHzW4ewPUZGeIpOFh9uTuBdHqpzSi8lbStrhhsmTbBfwGh4PLeXvk+ZAl uOEkWm3jzMZTBDV9GwsfhbmVKej6CyF3ed1fsoxV2kaABS74fFHOZl/p7W5OGOChcxpA u8u7JUtM4fYzfoI3D/g3ypTHrxgcJtXk5n+uB85PtksauVgFQJvFkzRmvTDulwBZky89 DDAFsj6zLpaJlYYzykx6MEcZj6y1hlOXuLiw0VOjIOAkAiDUffYU6q4AP7niww2dj4H5 JbXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOKKl9z0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d64-20020a37b443000000b006bb677b8396si2755396qkf.193.2022.08.28.19.11.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:11:34 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=UOKKl9z0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUFS-0003VI-B6 for patch@linaro.org; Sun, 28 Aug 2022 22:11:34 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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, target_ulong uaddr, val = tswap32(val); break; case FUTEX_WAKE: + case FUTEX_WAKE_BITSET: timeout = 0; break; case FUTEX_FD: From patchwork Mon Aug 29 02:10:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600855 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1683340mae; Sun, 28 Aug 2022 19:11:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR53hJcnLpvBkg8tvXx9xtbWcY3lzzGukrQQ1UgJCNYfLDdUXyzMSnOvezv5XQb+Sa4KMny9 X-Received: by 2002:ac8:4e47:0:b0:344:94b1:c8f3 with SMTP id e7-20020ac84e47000000b0034494b1c8f3mr8379629qtw.411.1661739101579; Sun, 28 Aug 2022 19:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739101; cv=none; d=google.com; s=arc-20160816; b=SinGmabjUXV3cDNTPeqeuCy58s/4obU2DpyK+0oPiqIoqc3ATahIx3yP2XEbeeWSGO 39LyS3P0dJ813t/bpSMJ+zoiLsbUtigVocakZc5LP/iA2kAx/E04WCM3cwncHyLq4NrX tTwxu5XFAyTa3klKYr5Mf5Y7JCEeGl32IZsPcMuhAScgiXkSC8pBx57kZwhezi7IqMMF vi0iBj7WITRwif9rI8Ck2xnIw81GYLYDMWKv/6qGZ6CJKeTJ2bYiM1L/vqxOjmb+YY3h 5Ap2qUYsf0dO5oLdooWTY+bLsQDqflcuV+aFxa5mX80YSax5aZFnDtOlDY4DlC80rDi+ VLPQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vuOgmHjKOfypW7fKTz7cNS4k/xnt5yEqi5+DGy9oOvU=; b=a8TaUqneqFPPrh076XUKCxQ671WpgR/xpwsINHvqY8/cArUYEhAszyFKWpnwv6pn2U 4G3WujBnLX/RrXZFvJyQ48c+g4GJyHbnRqG/Rq/VwvP6e59V47Yq6A7giQqRGApYbwfX mqFstBqoHLf1yj8SuSeyDqxVCttxmbMe0LnWCFUIUvKg1q5PjUq6LbHWR9n1PjNwjwaA G5zV39oyvaD3f08k7dWPPQlhEzfoYMUooZWxocVgxVeEsYRqqlJwF+QZbEoR9SA91EfU yMzIcnSENQLP5CBXXp68DZCnGQTqj6c0V1scpJ8yxdzCLRbH0Fa0XTPEtHkKkuv8sKkE vyZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jh21QBT1; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i6-20020a05620a150600b006bc6449009bsi2783799qkk.129.2022.08.28.19.11.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:11:41 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=jh21QBT1; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUFZ-0003ak-4A for patch@linaro.org; Sun, 28 Aug 2022 22:11:41 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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, target_ulong uaddr, timeout = 0; break; case FUTEX_FD: + val = target_to_host_signal(val); timeout = 0; break; case FUTEX_CMP_REQUEUE: From patchwork Mon Aug 29 02:10:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600856 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1684056mae; Sun, 28 Aug 2022 19:14:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6KTPdgQwWCK1Maz5Pt99I47JRG4PzzgK0EgwudJ4S2OtM4uIFC7GxVBOov+UhmMyBuMsR6 X-Received: by 2002:ae9:eb0b:0:b0:6ba:1995:ebdf with SMTP id b11-20020ae9eb0b000000b006ba1995ebdfmr6975299qkg.549.1661739263218; Sun, 28 Aug 2022 19:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739263; cv=none; d=google.com; s=arc-20160816; b=F1XB3ZfiDcbHx3NZdQ1/Y9iAzqH0a8XIuYLNLzLeksU904C4ufJPo7zwtiWp0smtRM 8c7sToVApOQkbmodV8va8izbEk/Du8ehq/tsyM3GkGSfkpfkTlEnPFW7rfa0zKhXLSuL 4sp0pjUMtQ/dUN99sdphE0IBMOZ/L94FxSm1T6uVirxF6UNgQaKCyRqVQtMcu3Qq+6jj AROeEYmz+uQkS7IDHWf+teftwMKP2gOCKmgqdHFQ6mdWyczQvvM4Aqn1RapI4YCHO/AO egtxq7CwjjJL1UBkSsiwZbmT/S71bV1gVPeCXyHSs7FbI2T8wmZa/QThTUYgZIS+uaAo Z/3g== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LYi0lu55bGaCgaXFFBKaxC2lMAPBykVR4TgtPvHjjww=; b=oL1j4mGkHd1NGCfw/1Wsj/80ZoIGjH7mMSGXR3xkXaDza5vm7gKHc2Sy7bBOZtirSZ gEBc39iCks6OwmCYaDwgWFN5X+t1QlltEfkE3rTiLiqTHjSuuI4s1MtJpWwVwYXbWY+x wEQ9IN42NPLXBMDfeB66p/hHTjyDGUOuz9w797NOhOToIgXpUDj6rHM4pV+bNorvo4gv Iln0SjE1XxaHVpxYwwtpqRHjphQ7Qzc/M4vAHtmOjCM6TsQac4vgKgJ1CdKYBc5c7GkO vdAOrCMEH7TxQVceCMZaUD4ws7F6ZL+xFA8Gu4Gb3kkyc+73VQS8Cs9/hBPViP76SB7H omhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJDjmVuB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h5-20020a0562140da500b00496f941a7ddsi3517707qvh.397.2022.08.28.19.14.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:14:23 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=tJDjmVuB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUIA-0000dW-MC for patch@linaro.org; Sun, 28 Aug 2022 22:14:22 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 #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, target_ulong uaddr, case FUTEX_WAIT_BITSET: val = tswap32(val); break; + case FUTEX_WAIT_REQUEUE_PI: + val = tswap32(val); + haddr2 = 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 = 0; break; case FUTEX_FD: @@ -7782,6 +7791,7 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr, timeout = 0; break; case FUTEX_CMP_REQUEUE: + case FUTEX_CMP_REQUEUE_PI: val3 = tswap32(val3); /* fall through */ case FUTEX_REQUEUE: From patchwork Mon Aug 29 02:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600858 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1684154mae; Sun, 28 Aug 2022 19:14:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zQpvC67h0CFYIZMhaPFy5eaGnw6PjeOAsGiNbC2zMSHcuvR5fe9yzYgktNUazVKWGDgu/ X-Received: by 2002:a05:620a:458a:b0:6bb:c0f:c0ff with SMTP id bp10-20020a05620a458a00b006bb0c0fc0ffmr7125793qkb.78.1661739284947; Sun, 28 Aug 2022 19:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739284; cv=none; d=google.com; s=arc-20160816; b=kyK499gXr0aF5B0u9o4nIKjalmsL/qZOGz0q0/TT4XDoF20qSLh6+Oi9QYl10UzE9l aqae1SJB520UFwmH18FBz1MrL+NQrMh2lpVQYXpnAmCDQ7uMcw7e0Ds2s4U62xkKvGFa elrnngQdA8ooLYDs6AZNfisboEBMm78Y6cDYG+rIUzOqZdY+vns0BqVokQblwMktUrIh vvFpY5OfdbdnldOA72gCf5ULVnCjYKJRa/61IYdxVCoYguJRsXVfz0mK9lAlzAtMgdj1 RroHzK0xfMM5WQCTaYD1Lr5XAcszITXOfalHTjcYk6z9bVj2R739e85n8c0OF30xrh9S lthg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pwvz/hjWr74KHf0VVDf44MC9Wv0aWLdga0oygTPDgYs=; b=eOhj6uk6MMUM3iXAZy1OFBiHiRFb9qZZBAhUmKpaJATVtV+jAkRehBaNn97r6/EoBK LcspDGhfaiuDNUlKqsKhnVT3E0Xd75Je5kKSNVrn34T1C1l/L1GrPNBqIYLQDgQaOQjo h3qK/ToMkbkCiLfH+ofrQ+nq4KuSQXKvzf4eo4waRjpOGFB+kUhfi+EqntZDO4dI4wOX DxSoTtKW4hgBIS71eMDgKBzMnw32XcDBOdG2flk3hLW09KVSVjIPWLsEodWusuaL/B4C b/nEpM3BrHimtUIzaEbeKYfc3qQGmQFHYLmpsn7MWlYsxkzGEL/8/9E/oPtkaSAho9E+ gfhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u96HWsRv; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z21-20020ac875d5000000b00342f8bbd9d0si3136121qtq.671.2022.08.28.19.14.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:14:44 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=u96HWsRv; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUIW-0000pM-Im for patch@linaro.org; Sun, 28 Aug 2022 22:14:44 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 syscallname *name, #endif #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 == val ) { \ - qemu_log(#val); \ - return; \ -} + static const char * const futex_names[] = { +#define NAME(X) [X] = #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 + }; - int cmd = (int)tflag; -#ifdef FUTEX_PRIVATE_FLAG - if (cmd & FUTEX_PRIVATE_FLAG) { - qemu_log("FUTEX_PRIVATE_FLAG|"); - cmd &= ~FUTEX_PRIVATE_FLAG; + unsigned base_cmd = 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 &= ~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); } static void @@ -3625,7 +3618,7 @@ print_futex(CPUArchState *cpu_env, const struct syscallname *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); From patchwork Mon Aug 29 02:10:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600859 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1685129mae; Sun, 28 Aug 2022 19:18:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5kGIz6AZ3gvva8T3cJ0GLGHaX2TAUxKfm0wkSMX1fMbtZ9e5vpqxmxO644MTh1OK8AAzgM X-Received: by 2002:a05:620a:2157:b0:6ba:cc6b:8e99 with SMTP id m23-20020a05620a215700b006bacc6b8e99mr6860989qkm.185.1661739539555; Sun, 28 Aug 2022 19:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739539; cv=none; d=google.com; s=arc-20160816; b=iHWpSUKQj0O3pAKMveQUPiuuhSlzD/XDdptPMoxeCGaNXjVyFwixR3oJKbzaAhWTIw tSRyIjz6tPSGbE+wzvFFjdm0UmkiLncxcA5LHXq8a3qy5pPDzuM1WW0DYYmd5nqX9TKG kIqkmIo+l8Rc1NNnLmb2bIyddE33rhYfmG96FOAJjCzJriQQrDFsRLFVfRj9fDUMyKK7 NOmjXYGq7dhNZcXA1RB4halYy/LykZut/URaqBssbVr6eM49QMq2mVDcNiTWgJVKJTVS x6c2eQnhUqo2Ib2JUkv2J0tRXRu5/MZxmsGEkxIdKWdCaxfvYPWa+7YPKntspUzRjlyn SVmQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MG15NAkIAITNs1OE3bxclYfrNMvmI1vfTm8EKN0Sndo=; b=XyA3Oa/s0J/SmH3Rt9lGQApiBk4RGIlw/1fRdsO3qTGZlI0IXMHvKUw+QxUAaCnsg9 yd9MX9LYjZqpf8rOTDTwG/CVn+dtU8ihYA0du7/+ut3qc9hapkf8HdEqekhT3x2ZImz5 kfXdC93z/lHaw9+EPHlZkYJmbvhfAtrcXMIVDL+LhwV8BgfbgKe5v4W2AdvF9m8mHJAe KkaIlZy8aUu9GEIXYEMd0O+zlYDJWLNg5mF/pbSHZPUjTDG/SB5EAhB0WoNK2RNt0c6c kd7q32RhKUWrnYOZFD5QkwRXCWbGisRW3RRqPI4S4AGmYJWNusEw++EbFPknAiLDLGOP NAJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RFDTln+p; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e21-20020ac84915000000b003430651483bsi3087670qtq.289.2022.08.28.19.18.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:18:59 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=RFDTln+p; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUMd-0005HH-5d for patch@linaro.org; Sun, 28 Aug 2022 22:18:59 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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="%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 ")"; + FILE *f; + const char *format = "%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 ")"; - qemu_log("%d ", getpid()); + f = qemu_log_trylock(); + if (!f) { + return; + } + fprintf(f, "%d ", getpid()); - for(i=0;i X-Patchwork-Id: 600861 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1685179mae; Sun, 28 Aug 2022 19:19:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Vn1RXZzgyXQ337BJxEJkc+0N2jDwC7RxQUByAyNpUJq3pyszdSd2UYg1xF4/e/9svt3I4 X-Received: by 2002:a05:622a:e:b0:344:9c6a:3616 with SMTP id x14-20020a05622a000e00b003449c6a3616mr8575231qtw.362.1661739549398; Sun, 28 Aug 2022 19:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739549; cv=none; d=google.com; s=arc-20160816; b=ZG7tiaY+tlHy5HrDt6U4aYt/03viNmSDc5QQhCr1bdCVu6m+QgpMpqWxVlBCAzS/ES lJzNdf1Qk8e7uIExL19KJf0po/x7zh25GPLpCAe/ACtHKpPVEb+2PrSe+SwWFZ6wbgbp L83DyiR3hZ+XoP0OmsUZ2MKOkxl9sdzUZvTw5E0pvRtjhH0luLd7lmeLNc2CcwHu7qJ8 48g9mAQsz4ynDZeSvFwoZxNNi5tO+RWMSQfjJLMxE2ubzmvJqK712FhFDvdLBiaka7jG GnKffbqvfar/zI7uOZlMtGuiMzbiQEZRB0hS9ZrxtB73mpu0v9pVeMNbO0IsGWkZiYRG A/ow== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=55VT9o/tNovUP7KyBCwm0gq6nWLk3JJV6wEPVewGesI=; b=1JxSYWtsNyxjOyc7Zt28GWmrQr/SqzgW4wCUBEpl2bwvnPIXIGR32hMxFI6HHGjRS2 welnNuHFfy6lvLdx9Vf8WqyvjQmiMk3Qjjc24dRXKBRiLnj7DcK22aMfGEm4PsXkW7iK imGa8clttO1xLe/Di7SbLfP3voS6h9oKfV2Wobl2nfY76IKVu/DPgYte8ABJThNArlYJ fy8xGedo+sSjmgALLS338Sr3TLAUdQ6oBAUiH4B5rsW2KwQ3qKbOE0BHhf1Xvf7jslL7 kV0LC9D2nuZRc2xXzTud46c1UwdgzVAQZ9b56DE/zk8+1vpsVD+QL+jgNxjrcprZDHe3 M0gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zuQrGBgF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q27-20020a05620a2a5b00b006b5ead97164si3120516qkp.599.2022.08.28.19.19.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Aug 2022 19:19:09 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=zuQrGBgF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSUMm-0005T1-UV for patch@linaro.org; Sun, 28 Aug 2022 22:19:08 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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()); for (i = 0; i < nsyscalls; i++) { if (scnames[i].nr == num) {