From patchwork Wed Sep 28 08:15:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610086 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp169329pvb; Wed, 28 Sep 2022 03:43:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nvoUOnv38IOgojIT8ccVp3ZHa8bu1vHuDBogilQpHLuWWqa6q2rFSeNuqTtoFVrJwBtxj X-Received: by 2002:a05:620a:79b:b0:6ce:737:41fb with SMTP id 27-20020a05620a079b00b006ce073741fbmr20809851qka.783.1664361783005; Wed, 28 Sep 2022 03:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664361783; cv=none; d=google.com; s=arc-20160816; b=Zfaaf9w0NLW09PDn1UssdiIPcfoUxwV+xbPiy8ZJ82NV1FtJIXz2fV3fRW6EC5KpdM bDaEKK5EOsoGg+EiVdWSEw9CEEMCTU/suGG3aQr0er7zW8Ic+RM2O9g3lfOznpDX+jNa 0NSPN8rtrBsVxhDEi8A5j1LaIFhgYsYkOO5LppuQD9tgLA0h0lhQULGyYlm7vso6O9Im cOeXwrl0YXU/4nzimiRDEVvt67cnw4g5rZ2jNlaOCcTrZMSleznXa9hVxGwOEwg4KoG1 6z3+g/sCQUHcs79V0Aw4y+1ivOKnmiXyLHcLdtha42uOqPnb816nivK5M8z5NRwT6tnV QkFw== 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; bh=aVH6XgoRnj/lxNtTeBLZH7eFffPHtTxEsiDca0jShPg=; b=orgTu+YfSEzrLKw0QD1lxbJQzU2xCWZj5ATt3jEAfgkqUFXBXbGNm0bD9wyW3Hljoq QzjPrsFlh3b1tbYWD8Qty7pydZnj6eJ4NEAt8DNT9Su+pEV52oLlW76363pwFYCStVJv NgGWmhxavS0YggFPMCIPevFZ9uOho7fl4akYVjt/FPU6E5WFo6HKIynlbLdc3BBQSFRL jFGsOaI2g8y98TpGVoLhkZV2k9HJ556SELF3MTp6ZbKXSyXjDPtpxinNfeD4d/umsp5R aXhvF2Svz9S1nYwF0PAY/ZS5/0MMMfSyU00e7Aht+aLF8D9glrrjlK/z4d/QEAQHSY6c zbAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id oo24-20020a056214451800b004ad67db9446si2179809qvb.410.2022.09.28.03.43.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 03:43:03 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:43578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odUWs-0003J0-Fp for patch@linaro.org; Wed, 28 Sep 2022 06:43:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008FB-LE for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:41871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEB-0008DW-9H for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:40 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MysBI-1pQcdi1kPK-00vxKq; Wed, 28 Sep 2022 10:15:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Peter Maydell , Jon Alduan , Laurent Vivier Subject: [PULL 26/38] linux-user: Don't assume 0 is not a valid host timer_t value Date: Wed, 28 Sep 2022 10:15:05 +0200 Message-Id: <20220928081517.734954-27-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Tu/uklV94njT6bMi4+dmALEcFTu6CJq4x+cZNxI9FMT0RZ4r46k rPq2QIgpiy/CprG3R4Dc3e7s4a9tc4k01LyI1WWZ+WPIAIJunFwgJmizwG4JI1de8DJ4m0R 7CJ0pgt9FZi0gYj+c3ZGglgye5ovz2++1SGm/xnEINsJ43HQgtR3BvaXTFMIXm8fKSzcJh8 gp4NiOMwLW8gvqT/+dcBg== X-UI-Out-Filterresults: notjunk:1;V03:K0:B7Ln73FCUJg=:UquRtFbzNcH084GCd/yZU9 ONL5HeM86e1zfUzQfWq16QrYhoxrp5CyCyOR21rINTY5PH/3Z3yRQp45CJU6tmfcdqu7zEqLt PVtf2ufvRZ4dD8Y043lwMBFYFTgs2gRSWlnFSW9yjRQbglWyrxiFsZa+TOAUAGQeGUUZMvQdd TrgMDIFu8z4AeRd6Kfh/EzA7BQr5sJ3zgBqn765kbFVhL4hai4clEhj85GGChqabnxSeB5E6U 4HAACsGLzIyaizx5pL7bhc4pVqayRQKfnodzBbEKBuThu1qsYlQ+O7v6cTc+7Ll+0Jgx4mGEr 3nus7L5pzwzEj/153jjsVjXRD4abkr2Tslz3Q45kcRn+7MLTTseUm+eHEUQbu/Vz+GxZkZ1PS kB1ov6G2E/oNif4tnctcFWxlf3dbs1qZa2Ec5wZs2FFKE2SQlDzlLgRbrgpaoYVEH6ieacgYF BZb9HFhLxWLBTPfJUpYrq0EmcQzZkVqKvD1m1ds3IiifEsxLpTTgkshLNX/IijIjAA6vxs2cV 0Ps7GoJH4Mv9hsSHwEDUYMVlHc0u27nvfUfKWRR8ExyUuVno7PpxMqZDRAW4OjiXpT6E3EIz9 y3eiFtokEroB/CzS/eIdtRtM13Hh4Sp379Ran2uvaKTXfXh26+qNbtqTJ+sPPMoAEzFIiLPd0 +MpzMgyM9b5PEbiR4HCymDNzmqjVYBhmFJXspoV7yJQbx79K9US88PF4Z1k5KRInp5pARPwmN K/1TPcBOLqgdL1duOP7Pa8gL+ybiRDC0ueTxe+TLbG984ZeH/PRgArUPBQ8b+F7MtXAWw/ZSQ fpJRgyy Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell For handling guest POSIX timers, we currently use an array g_posix_timers[], whose entries are a host timer_t value, or 0 for "this slot is unused". When the guest calls the timer_create syscall we look through the array for a slot containing 0, and use that for the new timer. This scheme assumes that host timer_t values can never be zero. This is unfortunately not a valid assumption -- for some host libc versions, timer_t values are simply indexes starting at 0. When using this kind of host libc, the effect is that the first and second timers end up sharing a slot, and so when the guest tries to operate on the first timer it changes the second timer instead. Rework the timer allocation code, so that: * the 'slot in use' indication uses a separate array from the host timer_t array * we grab the free slot atomically, to avoid races when multiple threads call timer_create simultaneously * releasing an allocated slot is abstracted out into a new free_host_timer_slot() function called in the correct places This fixes: * problems on hosts where timer_t 0 is valid * the FIXME in next_free_host_timer() about locking * bugs in the error paths in timer_create where we forgot to release the slot we grabbed, or forgot to free the host timer Reported-by: Jon Alduan Signed-off-by: Peter Maydell Message-Id: <20220725110035.1273441-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 54b29f3b406a..e0e0f058121f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -525,20 +525,25 @@ _syscall4(int, sys_prlimit64, pid_t, pid, int, resource, #if defined(TARGET_NR_timer_create) /* Maximum of 32 active POSIX timers allowed at any one time. */ -static timer_t g_posix_timers[32] = { 0, } ; +#define GUEST_TIMER_MAX 32 +static timer_t g_posix_timers[GUEST_TIMER_MAX]; +static int g_posix_timer_allocated[GUEST_TIMER_MAX]; static inline int next_free_host_timer(void) { - int k ; - /* FIXME: Does finding the next free slot require a lock? */ - for (k = 0; k < ARRAY_SIZE(g_posix_timers); k++) { - if (g_posix_timers[k] == 0) { - g_posix_timers[k] = (timer_t) 1; + int k; + for (k = 0; k < ARRAY_SIZE(g_posix_timer_allocated); k++) { + if (qatomic_xchg(g_posix_timer_allocated + k, 1) == 0) { return k; } } return -1; } + +static inline void free_host_timer_slot(int id) +{ + qatomic_store_release(g_posix_timer_allocated + id, 0); +} #endif static inline int host_to_target_errno(int host_errno) @@ -12896,15 +12901,18 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, phost_sevp = &host_sevp; ret = target_to_host_sigevent(phost_sevp, arg2); if (ret != 0) { + free_host_timer_slot(timer_index); return ret; } } ret = get_errno(timer_create(clkid, phost_sevp, phtimer)); if (ret) { - phtimer = NULL; + free_host_timer_slot(timer_index); } else { if (put_user(TIMER_MAGIC | timer_index, arg3, target_timer_t)) { + timer_delete(*phtimer); + free_host_timer_slot(timer_index); return -TARGET_EFAULT; } } @@ -13040,7 +13048,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, } else { timer_t htimer = g_posix_timers[timerid]; ret = get_errno(timer_delete(htimer)); - g_posix_timers[timerid] = 0; + free_host_timer_slot(timerid); } return ret; } From patchwork Wed Sep 28 08:15:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610084 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp141717pvb; Wed, 28 Sep 2022 02:35:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rFjg12Foy91WV+cqzVZ1Rgo6rMMeVBzYkpuN5BfOFQnhYTy3+CIebzMM/CYxOQEADZ5HH X-Received: by 2002:a05:620a:240d:b0:6ce:7f55:1191 with SMTP id d13-20020a05620a240d00b006ce7f551191mr20319351qkn.644.1664357756527; Wed, 28 Sep 2022 02:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664357756; cv=none; d=google.com; s=arc-20160816; b=wwCykbvyUb3s5vG5aeGukOqciLoy1qZIHnlInqssozoXDTf6JL/eiQtSvLq4e0YHuu LLPi8D4TYF0gZT7sjkJBoJlyUvM70VdWKt5i9UbK7aQ+X1iosCxMmjIuaWTnovajykFl kZ4lewrSZtkfIAir+q/pgjV5FU/BHEXKYDoCe5wMLVAANEwweMbHXKzuI9SFX3YXLCCp n9rKG3fZWGVetgoe56sHgp5uucEcFxNdymG0I7h1C7SniSftYogZmWw4eYahf9a2ml0a hLZ9eRZg25htaSVL6SRh036yd5OAUXFu5PlIZ0ZlHWrw+/e6mrQtQqSGHbBdYGdxcIaW fukQ== 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; bh=6wnqkVmwXtbq0Y1JFwFpZSePdxl9eCRyQLBvrmXyKyU=; b=CidhEoldFcbagnyzEv1EAGT5pfaP8zSgUBrwYpil0Fd1v7pGEVXuI68KfBNa+daJdN effO8TaY3It50q5TD+svdBJVqsXm3j13yzxsE8RR0A3XyTN3J1gOwnqHUKKSGTDDltTw vWqXIrDHqSameV/0hoA/wn/80YFIKYVwp4q4HMlioaJfParp51ZBJhQZ7V4ZwmjwtYuJ FgNtTvdhNXbWTwU9/sgcO4HU1bhCJT3n7thmfmQCGBOvuRgukRVLvNUHDThItREwIM9w Zjv9w6KxodkJlzgy1AFoQVLSbgS8Qsc404EFgfJ9M0E/5r2dhLx+Hkz7JiJHwUYoxBw8 0hUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gi9-20020a056214248900b00497021b7fd8si2677807qvb.182.2022.09.28.02.35.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 02:35:56 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTTv-0004ku-Ri for patch@linaro.org; Wed, 28 Sep 2022 05:35:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEI-0008Ef-8a for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:48 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:48711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEC-0008Eq-Fj for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MHnZQ-1oPl6e1TNu-00EspI; Wed, 28 Sep 2022 10:15:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 30/38] linux-user: Combine do_futex and do_futex_time64 Date: Wed, 28 Sep 2022 10:15:09 +0200 Message-Id: <20220928081517.734954-31-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:SamJiBJS15wz51R/KWLWvc/jxcfEH2F6VLID+yWqWPvWdsSzIEw HGfejNoJvTaq1ExzrUF4kMO24kb9lsa/IGYjAYSk6h4WTkRuUw7xoBx3uqrZOstwdXgAkFn VCy3FWkNNlXJK6XG5NQrwu2/8bZj7aDO9vAghMWFfXrMjrKZ1kiLeEiNeWXGySMYQPpW2Js NxxEXI7qQQXNGiYVfg16w== X-UI-Out-Filterresults: notjunk:1;V03:K0:WtBhKx43KF0=:8BsGNwnM35D+lT0Utjiz3C NzLxxK4SDGduF48NrDbi3Mo4IdBOqzHQerRAvPKSlPYyqcolwLEfNMDP0ZqPm2rPmGyi9W3bx n7bWETMZKkcv4EpHj1JiwdhZ9r18Et9iUPSHEez7ixEObtbFRcE6hN2bokle5zgHd4NCKduIV 7uQtQTmRSjqoJQRimxOtLrHaA73C9rJPS6hOlEAHApszvx5VKXscwEav/1wOyQFKJ0k1Ehwy+ fccxyelPV5ywtr1gUg7M4fIbkpjAzD/DF1PdiWevo5AzYYPfBVVkrkfJdwlOCDT1OrdgLTe11 LYe84iqlcaiyYKAOWjMmRfC37HLN+48ENz8bqZRew35iCaiIpeLtzRgaIR627ZDzkNaArrcG3 DVnm6db6gGGS6gjQeY4/V+1KvcyL5Owu5evAGCxZwp2mz9ilSJOA9B2dz1AAfzelw/eESju/e 9wpD+jISg8a+qLwZ/dlou6SaPH4oxUh4o05FIQTBMivUfX5I2QNCjuDAHWKD2kA01rfn0S4Oy CAN7RVltNu7QRxO6O0K5GcsQ6mYcgrdD4PTTWx5K1sTGIJmfkWLQFGRnYXl/MyqrODSbKYMqB TOvP4WUylgp19TK8LDvEbOZL7VOb0pRzQz76mY/tXADzcRNDFFZd6VA6ECxUdUivmR6r5b5T0 iH/g/W2eaIHO7dOTl9ybo0IWomxKfQUJMUn2lJ0HXkAnr2AKo4LgJM1AYr/yhqWQ6jymLA/l/ htR09ST7zeCbEGqmCU3n52MaGVF1IL75jWRd/6cP8P9fpa4S9eX3ypsngWk6kDfGHt/7PW+JV re8fLiK Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Pass a boolean to select between time32 and time64. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-2-richard.henderson@linaro.org> Signed-off-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 e0e0f058121f..af3a605fc458 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7768,9 +7768,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; @@ -7787,7 +7788,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; } @@ -7817,56 +7822,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, @@ -12372,11 +12327,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 Wed Sep 28 08:15:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610088 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp174254pvb; Wed, 28 Sep 2022 03:55:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YjqnL0u32ju2+MCxyO44p4ZIwVIPGAdQCA3msF7Qbkm4+eG79Vt5tdBcOopU317VOoOmN X-Received: by 2002:a05:6214:5084:b0:4af:9cd2:eb3f with SMTP id kk4-20020a056214508400b004af9cd2eb3fmr885426qvb.109.1664362505403; Wed, 28 Sep 2022 03:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664362505; cv=none; d=google.com; s=arc-20160816; b=ZKzGwROmndzM4OAk+pU9/DOCD3vpMybEea+oxq9XTG4u66JicsuvlAGOtTYcEwTs94 FSsmIzoWHaOAXVL1k6HACLXDUgXR6EOn9uFkgdEUm8E/c8ZVbHpNblpsiULUWr6vgOSz rM2LlYFqmFUTvCKGkPG+E9phVHy8vSoVFIKBGWv13HQlYcYLWMnD8nFx8fc+6wAwkAzr tSBA1hpgDHsO70cNTOk9BfNT0ZrQu2MjDkwyXF2C7U2050Lc69kH+NJdcnaX5r67s7MT Ux5z/JZZ3ID7KXefnN1AHWNPats6KgbRp+zx+tDF9QJpXB4+2xqIPRpNZeZiK/VSm6cP a3QQ== 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; bh=Xu5ZYA0q7fKqcNO3p+Orp2kbGugTYczykR7Oo/W0m9w=; b=hvTULP7xYE6rIeXV0o4Y/gkZsB+IvbaenvxG8nlwjANs6oxyFqzIG/wgNYzFDMVCuR mUOo2m0LaR1TpMwpDKTNHSQwJL4y+8myZIbCNG9gDG3wb+0GgLgdVNw0Hz/BcO91N9bm VZqwtrMp6bo79xgsWy1c9bGj6fsqDX8rr9XBi6SvtGfkIfzvH65BA8MUfhMDP7/9cABy RnVmmhImTuRMrPpuecYegBrR8+3eqx+7sWGc2dbsAHgrDGpMDJhbIqazLP3fOaYAPjgv /STZdIJARHFS+2H7tYBb0cwhCKIx1Ul57D1a4LRERpW45sY1tfzDln5DNOVVfF4LG2aT iSzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u15-20020a05622a010f00b0034ab9a8d256si2736291qtw.25.2022.09.28.03.55.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 03:55:05 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:33124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odUiW-0006Au-UJ for patch@linaro.org; Wed, 28 Sep 2022 06:55:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008F5-Db for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:35471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEC-0008FJ-Q7 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MF418-1oSVzy3Jnc-00FRrG; Wed, 28 Sep 2022 10:15:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 31/38] linux-user: Sink call to do_safe_futex Date: Wed, 28 Sep 2022 10:15:10 +0200 Message-Id: <20220928081517.734954-32-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:F2vojFSJ83+rfnQq3MwZKPVeQRr+iDu/USOxEHslPkX5PQFRTxP Fmj5oKbjRd7TpUvXjxbGGwKr8TBbUei0onF0B7oBoCPMZrRgliI0JQuh8+t/I8zs9LIb7jx 3VDsfze5KTAPcrxQBnYxVrXrjlWQhsVv+Yz9/xZGJLcaXc0F3HXmL0DlmlT54n8NodiVhG0 VMkayuYT1bl5OJhPTU8cg== X-UI-Out-Filterresults: notjunk:1;V03:K0:GEbEnmnfBrc=:EEquTR23/HKaLJyx9YCf2/ a4bTXfKB2uIyXCEr7pR4IQEP8Oeewy7w/GSwXDPW+ZHbsHuSBdL8abqv2+C+j+saGCzD3YlIC mkSQoP5KUQmUYckhlQcsx3lBZDupACsG2Zypmo9+HcKOyG71apiUI5pxVZm5/khP7bPHBn8Ny q4rErxxPRATX3O1X3Wr6itwmG/Ml/qTcEYzm4RMkcQ9FqjZSSdKHXWKeW47BLRyWN50QRBe2r lo9Yg6vEbfP2Tna9apCg93Cp3haBgOooSlW7OCsML13oBKgUQJqdsyzDpTJatvVpMq9nW3Fzu kBp6HIb/99VNfCsGod3eu52FL93LmrCUEl7E29vMN+BtzYXTw3B2QmDo3ioppCVfHE8xefVQc AzP1pmkDHtPR3JIJLCn999da94b1jJLjL1t5+hFCrunRoCMaLo+B4aQ43GFURSn79NWxCaY+A Bgn5TOiadGivCqxzjmkuIIua3dfUjWRyZbi8Rl03hdjhOAMntIPCIihlxd5K3OPs7+bqOsdW3 b/Ge8MSPcqWPmlMNOKZnv0NWaWCZZ7QJb9gWfNKgThNZDdLdNaTdptde6Fi4cm/im40fR3jla 7CJxBD489ZRXAQ3XcZCFbPdkA4bQx4YRX+e+7VWXIb+rpBTDOOW3BopciZgdwo0XmNolPzZpr B3C/mkXwPwmASOTAVbYG3GOI0bf6waaGp5lN0WCrQBrq6fI24i+nI9lQgWZYLgi4xIBfJ428o So3PbIK+WZwbHgUBhNy5IuS1bDcps90Obwm0N1vQvE1GKiIYoasWsWvn2zwwuKY0CIkIhjwKh m2TLNfT Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220829021006.67305-3-richard.henderson@linaro.org> Signed-off-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 af3a605fc458..17e17f480456 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7773,11 +7773,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 @@ -7786,39 +7786,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 Wed Sep 28 08:15:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610087 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp171729pvb; Wed, 28 Sep 2022 03:49:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Z4Wpxn4QmMzwcOYh1KX6wvYPtiTAXyGUK1YfECBxTAQKBvwVaag+bOEpFK753r2YpkciU X-Received: by 2002:a05:620a:4155:b0:6ce:3e56:c1e5 with SMTP id k21-20020a05620a415500b006ce3e56c1e5mr21095408qko.350.1664362154259; Wed, 28 Sep 2022 03:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664362154; cv=none; d=google.com; s=arc-20160816; b=aEoxRW0NCHBvXRe514XnzA2AdclqIIiGxRphelA+Ht/5T9WPgM6SSeag/uViHLaX0U YUmcJg2mv5X0qIjClK0GffE9Knr+ogqV57VMzW3WFI6M7o4clxu/e1RILiPmayf2ZEhx 1dMeJF93mHMqlptSg3dk71sFSHjKoB3I1am9OXGsuFBTgoMMoShXAZrawBeXRENcdLBM POfbLLM4zmbAPhzXRx7RbC+gSPb1PBUv/nveKceO8cH3DvsUuJ0Jznj75UK+Ddr7cZuK fk6X4kiR3G2TLjCevdfvkbUTRPCb6nv9gZC4gCWVvi+G7Ki0FoU5448nFDBRs1vowsAs Aepw== 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; bh=YF9+4kBAVm5Yh6Z4eDUXac8hJFpAnSNxfDKNa0w/4pU=; b=KG2gk7YxYStbsFMuvRZsw3c/ZUpANCSP3TkazwGVOM+IswzNdneU1DKcWBBpFf05By /5B+zGjJpi08ft4NNxqNQwTFkffzN2jBjruVJx6V8FJamovcaRDFwg0S0o7+dRvKNW8Q q43EID9BLuobo5HmFiA82mLkTC1VGFbU5IXAwzUg8suY0k3UQYbjChkJB57+PvJxmin0 P59im4WB0JDx5nbFn0WOBaVd2isJ0OJUYNevu8/5ajjQtXJTbij7wDhZQOOHS9xiav8Q rwb29mi1ndaW6nuO/pISK8RWX2pgKjtg1UPwU2MdQYu8+mxIxg8ZVHiaNfBrS+PJiTh9 1ASQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13-20020a05620a430d00b006bb286a68d5si2514231qko.111.2022.09.28.03.49.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 03:49:14 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:39758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odUcr-0000Mc-QO for patch@linaro.org; Wed, 28 Sep 2022 06:49:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008FC-M0 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:60275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSED-0008Fe-HP for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:40 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MiZof-1p88Po0xmB-00ff0P; Wed, 28 Sep 2022 10:15:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 32/38] linux-user: Implement FUTEX_WAKE_BITSET Date: Wed, 28 Sep 2022 10:15:11 +0200 Message-Id: <20220928081517.734954-33-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:NpZNtQbKCA1kTY97l8yx3W+Jmt0aNr87dA16Lk07ICBAGSvJ94t uSYpo5hQcaSbwW+qHoka07z97/ccXvc+iJI2+i6V438mW8nwiRWrS4x0T0JbfXKxbGIRa8Z O9LtG7PvgQuxebxmOtLw48IH4rrjwNo/JLmM4WtEIiBJ0NbwGhlbEvyrnKz/+wpUm0EfvlS guBL+LpOd8qZ3k0MnAhLw== X-UI-Out-Filterresults: notjunk:1;V03:K0:HeA2M+Tmnx4=:TdDxkzPfdFE44YE0EfI8Ex wUMvmnObwkCScqpQb+VqSXbEkawjCVZ2iL50OKlI5IHoHaHh6mToNhzG4RgSi2DmvoMi9zR19 ySF27To38LN6yonioF6CCleemLCvyTHk7R7pNW6zW0jH0INp5j8WY00MclvKRoiemMU5iZ3Nt 2Ecga2dSa+gCAESfzChnJ9hDDH7pEikKCpB+JWSSE69RIMIux2uayraxjyr0aGd3rswLy24q8 9A0CCKjOmfviEcSCBMb0l0L1bzt2hzOsyTomR9KMeCMkXiuxEL7WAEjkQnjIhYKh4WAuXYUPS 9qnhfs2uxuoMNqdrrE/m5U3ZOYJsWTbF+nFvMgCMmVzPF5YiAjWMtiM8xEyaizLBBVzfMqnRs F5WB8UJlXci5szVzbTHCq4w2E0WTyv8zxPZ2zeHRo5xuUQeQSgJ3cve1ZPX5OqgvywdoHUE/H kL/4EnRRNxa8DxafS8F+zyEz9l83l9r1B4mrDG2OW1M9CqTHAgQGeG5jgZ+G0jG9eje7pyhyQ OD7VvfPZTyInOPbuFjthW2U04Gt1q/25915oW7f1+i7XFWbE5+URfCd9Wmv1ZGiUCdq0Ryt3b blowzwF87EH/Xn2DeHjg8icb1tHEqJBDITc8bxTGKrFWMLddHJNv7eR1xHZp/L5qTMUEQmqy6 9lRS/SG3zMA1YwunU3rYKJunskdxMVjFKmTRaMC07gl2dGG9nMpvqsGdd8iTFciGWiqxOcR5y A2QxOREmVKj5le9blaIeaBPcEUx0WGKQjEzs12e/sCnA/AM89XVwI2yEHodm9b4bwsnR3xNiM vIWEAHj Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-4-richard.henderson@linaro.org> Signed-off-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 17e17f480456..e2b6b564e6cb 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7789,6 +7789,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 Wed Sep 28 08:15:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610091 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp186956pvb; Wed, 28 Sep 2022 04:20:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VIksCpYdYl8YHoDh8Skv3fZER1g/N8MjEYVsOJbPf11+Vqdfr27DWEwXF7yKet5xAMfuT X-Received: by 2002:a05:6214:f6f:b0:4ad:1599:3b7 with SMTP id iy15-20020a0562140f6f00b004ad159903b7mr25838808qvb.94.1664364007787; Wed, 28 Sep 2022 04:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664364007; cv=none; d=google.com; s=arc-20160816; b=NoTQFSW5USI+OVSGWFIgQEqClvXLiGzHbJp9HlFLJBeuVhYZOjSXS2etk0hikGv4ft ZDuWsptufoHd+avy9vMGLugqUmAKU78IJCFwH9EGfDgk+7I8IBCJCGkj37TXDjrhG7mc NPePJKTCxVIAFxt2s3xcoSogPg0YFweMugNJqLEsTEn84P/LUWiMH0qTFMqEtTf5aeJk VgIha/u/Mq4o0piQ1XDlkJIdJcrgee9rj1LfIttnJXGS0JRl8/WIlFj7G5ElAP6abdul YBBD1H/B3/FN+J22nZ8RraynPAkBTYV8uy5PKJ99xJEzLlZ0lBRXLdgJOmuE4Bv2JnBg Nc8Q== 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; bh=UwHywidPfehjkXp/kJ6T79Fe022LSXCYVHND6WPWu1s=; b=1IIVOl8DNYU2F9KIXZCqx+wlLn09LtfqLyBX/mt/GeaVxzfCXxwNAhylx2wrcxdcVi elVvd+uMHCatddBbhk/ODUz1fNL/pVF2gIxTPP6MShtZcseasvGuI0r+JKdUyURUDEP0 nE1kM8PE6q1L6e9Riqfg1GPMHynI2P0Ay7h/LuyBUsJj6+3CxVoAfCun5n23F8cX0lod DWp6DwQzl6TDA7Dr3NcpIkdePcs4JJshzvEG5KicfQRHRWpDj1Z/UEpzjRbwCCEPH9nx 6iz5sI0TAhtQt1BGk0ic/JpMiFw5zE3ZEtH0HmnYlWDXSCkhwT+BNVuGCnkGDrfnc8Xk W/5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w1-20020ac87181000000b0034370f21c52si1974936qto.391.2022.09.28.04.20.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 04:20:07 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:53932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odV6l-0003HP-87 for patch@linaro.org; Wed, 28 Sep 2022 07:20:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008FA-Kk for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:54455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEE-0008G8-Aa for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:43 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MEFCF-1oTryE2ld7-00AEFz; Wed, 28 Sep 2022 10:15:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 33/38] linux-user: Convert signal number for FUTEX_FD Date: Wed, 28 Sep 2022 10:15:12 +0200 Message-Id: <20220928081517.734954-34-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:3RAJaY3DtebYhEIu4IehU09BFpQeaT0lT0hcZ11RWkvrE/cQFsa wEyMBPp6rNu4hxk3Hsm/Oc1wDTOjfayGdZwIaI7I4CsjG2Kr51+uSz/80VTOCAAsEngcMEj fEmXGzyI5yd0spRz6HLsg45bmwZLjZmOe7QcUKsfKAPkH/ZMH/b3892Om7RcglDzfOK0lNS iuBSmWqGkbkhaRAhp11Jg== X-UI-Out-Filterresults: notjunk:1;V03:K0:LpcVzUnbprI=:xQnRAUpukqNi71hEwKBelt JcYzrXIJpAVr9KzFd48jtVbpVT11eqcIYGTj+XCmIuHDIlZgdTX8SJnmXMEtGt+aHv+rTrz+O PJjF4jGI45zgcs7zU+L6C8F56l+MPGOsdQkiqKZFqnyptGUwuFqdnuWjUTd+kGo1Ke/9pnQB1 cMOJ5CT6KTe4wk3YAfvsypjZLjsZBrUdpHnbtS41S5pFVsHPvQ+NJSlGVQB4L4UnAW4HsBZ6L +SZRsZYVUKOv1VAe4gT2iS3EDpMbnO0XOh9kVVxNAdvYib2mLtrZ89kK/37IfPmK742J1RjLk /HpV11j5UEf/teIR/klryrDBBl81Ec73yliCTe5loGz3Sgxz+36asK4+3pMKDFayQrC6Upjfw ny+ivHQV5mmS+ilFPSlruDxz+V3muApDl7dnKAWBCeYncf1laBypz0nCqxgEt8bT/Idrlygm0 KHCgaH2j+Hd1Mq6ZA0VO0ZWtjJqWffwFe/unJVYoGXARui7Cy11t1hUOsyEKMHPq3KhFbQ2Jq OygLRtHYkY4KrZfXLwx4dgBagJLuaATK1Ftqz506vpSuYiwU3AdNRpjTT04YRb43Q11myFEU4 B/vdNwSTNJHq1Klby2uHIoPvlQYOGdO060WU37t9ytY2vewR6Yt9er5FoY1/9dNEeH0vD8Kqa VPR3jyu0JWgn+kIGWsXqRBwbemXS8zjEpZB1bOqjMmsAjHFZuNThQKjYW1zgat8GctOld0H4W IYObqhTMb9C+rfK0pzCPETSlIFVsiJxoSRolAkk9vPmZoLdCSRmBLq8v77/93ownX+sqtis7B PHCO8KP Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220829021006.67305-5-richard.henderson@linaro.org> Signed-off-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 e2b6b564e6cb..3f144e3c1f5d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7793,6 +7793,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 Wed Sep 28 08:15:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610085 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp148398pvb; Wed, 28 Sep 2022 02:56:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ekO//DP0rVjB1d069Ph6E6/OCDmA5K/irSsEZTTepXv9hDTlbZUJfwOA5dKSTYl7U7Ofk X-Received: by 2002:a05:622a:92:b0:35d:58bc:4a4a with SMTP id o18-20020a05622a009200b0035d58bc4a4amr468890qtw.391.1664358964540; Wed, 28 Sep 2022 02:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664358964; cv=none; d=google.com; s=arc-20160816; b=PeHYlz5QzP+kf/q7WptI7Ru41a7wzJD0QH7xJ/DHGj220S4DrR+2UjmGC8jbvalE3e JLZulhQnrIB91LfM6UDvRwFlMcOfLduuQkhTbDspThuPAOnt3VPR2wYM0nO623fRtGyJ KsTkQOYqj1XQ09wz0cf+rA/kF8Zo6TSEogjPvPnexd0htd1eXL012WknFj8Uc52ZiekK 2goAvgdplzqZi12/3pNMmYKWc9pSDqvHbg38uFfBXCtyr3MbcnCHUpRNcphpXR7SePHQ Q+uPBXT4DKm7B+z9zxbHCTF78aTT26dJgCyOijOxtSFAwtzsbSOnUUoMqDtZkGEgbHAq IGJA== 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; bh=6y8xU0F66KIoMvplobXnbP/sCMXlkm3LwPz1PJrcq9c=; b=tRj5t9MhIVpt5xZXkrgza9H2Xd5nP6YxMz0hkujfhCNsyZ7LO2BMbnEain80EyGjWl sny9jmvUEC5TRJ+pQgHF5QBo7ilDmhqyg+fAOVc8n6Kb0KRXFrJ2erFcUUjDwAjoDuTF vQLV4F/ZyM16V6jsJ4wKgu4mF27a+y1H67t9ChiP9rf96NmQh2WhlALLSXpnh8KfD5u4 rvoXAb7LnR9I23y0pIAKqSIpD9P9A2KlQmhzYQSeHmzVWcEFnk2cZtitxbYfm8IqCkJ7 VGGrRypcxhJmrhNeNjd2iHNb19VoqvAuB/icWNmSCdziNbPjMZfMEFzoW46JcFyBJbmc duKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y8-20020ae9f408000000b006cdcce30ce3si2124361qkl.396.2022.09.28.02.56.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 02:56:04 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTnQ-0000Be-1s for patch@linaro.org; Wed, 28 Sep 2022 05:56:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008FE-MK for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:39337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEE-0008G4-Ak for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:43 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mrxjf-1oyp0n0Lcj-00nwjH; Wed, 28 Sep 2022 10:15:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 34/38] linux-user: Implement PI futexes Date: Wed, 28 Sep 2022 10:15:13 +0200 Message-Id: <20220928081517.734954-35-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:4K+CKP9O1oEKj0MYZ5BWZFjbTXYYxV6lfFCtK1/B14hG+wbPrBA 6Le1oaOcKMted6Kg34LUoShfzbk1TvC8FZRuggEEaMXJOyLyYiKHjv3sBm9of/6qXX/QbRN DNONK5nsUpHN+sJkflElwR/r0Sa/uHSJCymwqAtv7I3TpuKd2R1EpvUWaouiANybIZw+e9b wUov5ysbGMJN8pvhUH1qw== X-UI-Out-Filterresults: notjunk:1;V03:K0:0opjmy1l9dk=:cc/gPryyzukaOuyM5fTJ61 MN4FB0s0PtCWxsLr/4tC3YMBUXq+hNC/y/Ls8aTR/6UgpCLIijbUp/R/u0cHJRJ6OYy8X1w2H 6lzihdZH+5kxfU3KiJNwUfXCVl8QoCrTJ6aVxajdClh5z5dhabqvQWq460N0SacAR9LuV3PB/ puscwuX4WXvFP7jcyzDJP0h9S1XnlHSbOcyIqgxFSXPRYq9TScwSeYkF6kPabs5cchHLPVGn4 eURoKzHHrb4LzAAC0vCkEI9w7Wgk6kdmMO/gB7XnPddc1uDsuSaiclgXCIvJpyBVM1HcLd5+V /eoQqSeRSDno/DKKCmT3F8MgTqeVI6sIFEM4UW6XtAULI6OVmAqpXJHnGaQSUVVfFf5y5ueMP 7t9d5w2DH1vShRx1yyX+2kNpVNTqlsAGvZ6KLY0bmwUqnGL2Oi3Kj4IxcDi/q60Lr3QTWjrZ1 cdvStH+b5i5WIcCqSbZbpOsA4jVe+XKBOgKzJQfh7kHc6hurFcdNkD5cI8v56Wth0UuNY1wID dzRRNrKtXTUczPMl73ypqfg++V7N0X8tsHiBxrXjNwIPZHLOn2MoHUiAr7oZlinIFXOMW3IuR TwElnZe8zvr7lsMMAcnH+qE0Piu7289QopH110RqoMhB/pSE2BDBC8fw8qQsFOVtw0yuAayuK kAOxcqbaq/pm6pIlzFfH3NIRzuhxJ2XEfj1SFSLJgiypWRFoa5sPY83Ge9sLLtgXGyLP/6Tz8 EWTXE80zZUK/XtoafrW/rGnTObrmXpdXjQTelvdWnkklmoAHUnYeYB34530qV0AONKYp2h9Xm UsGEbQ9 Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Define the missing FUTEX_* constants in syscall_defs.h Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 10 ++++++++++ linux-user/syscall_defs.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3f144e3c1f5d..2e954d8dbd9e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7788,8 +7788,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: @@ -7797,6 +7806,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: diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 1e3577bfa56f..01ee10a88fe0 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 From patchwork Wed Sep 28 08:15:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610089 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp179997pvb; Wed, 28 Sep 2022 04:06:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM704v0wqsYviHkj1GsBBU2cPsv5cVb3DmdeBlw7TH3oKRPi/u/rw2kOBhktoZVFRGnQYUoj X-Received: by 2002:ad4:5dcf:0:b0:4ac:b150:2e78 with SMTP id m15-20020ad45dcf000000b004acb1502e78mr25615185qvh.90.1664363199257; Wed, 28 Sep 2022 04:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664363199; cv=none; d=google.com; s=arc-20160816; b=VaWEgWUIaJdPugMym0DtBnjM3N9F9oyMFF4sZ2g8ZqoKt7oai6u0ytcqkM1pctxs2r z5lJ9NgHG22LDjnKWc8FdBZ2irwunhfuamuchNn8UhcWD1UoqPDGX4RYZH90Tpz4f2sf ZAzxgpKo96JUkfvJd9RUJ32+6NG+z8mRSxDERAlkPzJ3Bi+3pu9UVFZrQXn3IsblgGHp 627cRBCojDU5YdcJhkNfpjHhtuJSPE65l+1mhYXXeiL4OKq10+2quJrnUX5hh7ZCIDVs 0PypA31Dgt/+QPF6GaL9JxJR/lCxzA7pa0C+rik2UhiFrmJa8CcL5I/FOoC6g5L4GJZu H3Cg== 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; bh=75i5cvTneBUkPxfiqy5WTWxGGAt9iK/Fwt8pP7WD8cg=; b=aSPyGRuO7tcH8L2cpbgw0MbaQReNtAUiNER1h8BVah66iw+0skRvylTK73z8g76zPg zx8cUBjjptoMd+RsoogadWMKtu7/X7JX809lTPukqGujdzW3nOWYS5cZYur4zwWwn97F IPma+wMFg6i3sUxhQrfKbbTNSW09y8vCsPcXJUCjvOvJA5hmyoQb4KcoHADdAcTukj28 kCsYyDk0Ccq1EM8Shx2+Io4AnCZwbLfQav4eL53E23Lnzr2LKSxtdeA6NADfzY5kJvwS pCaGuBLYp8NCUMymzbmLXiCus9/PEsIio1fdc8OWrWHcJGAuEpZnFzcMEz783n0obKJE yuFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kj25-20020a056214529900b00496f3e26879si2311904qvb.331.2022.09.28.04.06.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 04:06:39 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:36914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odUti-0007OO-Ll for patch@linaro.org; Wed, 28 Sep 2022 07:06:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEN-0008FL-KM for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:53 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:45261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEH-0008H3-3M for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:46 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MORR2-1osOso241W-00PvRM; Wed, 28 Sep 2022 10:15:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 35/38] linux-user: Update print_futex_op Date: Wed, 28 Sep 2022 10:15:14 +0200 Message-Id: <20220928081517.734954-36-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:L9lncU1G2iarxIbxOUr1tjTNU6d9JPQrW1TgMl2h/nO2Po/+4R5 vcvnvohdPQOIjTCHbPe6XbOaUBl4KZU841E0ck3Y1ezVfewZldZXaDRGPdQHaFOXJxFxw/z vV0i3bWwc+tYnkHKhhq2Y64o7+qPAnoZbWvMB7r6vOpsDGuSgqHupIfiemjTmXLS6mHpUv5 0GVmNlhJEbXb7XLQVfV0g== X-UI-Out-Filterresults: notjunk:1;V03:K0:a5EujZJU9Ws=:GX7+Fxr4zYZZxJ9GLOMtEE G6rh5BnhaD7FPkckraNPegdeanQnvGe5inOJ4p5e72yA4kvNawIgcE1OplFJlMSXcdLm+vS2T XORjdc27WLxmHgVUk83IQR6Bt3rXNtA8nO9NLp3gV+5YJHhKNhI1KpwJogMIuTM7OoWe7ShPG uuYfLerOnohxruJMT6StHlRry/89LWPhguNxKUlou70N44NaPoYMb5OFF0c1930p0vXOiR7ie 8k/C7SbbXbikDr1NTGcmAcM8p9TFKBS1+KPgIWOHyBxA4Rv6MqiFHG9cJPJ0CknspjyKOUIam QE6xhYKOAR5noj1SQxQ+dkpukn8rd1eeSeyxbeVm9evXBRfa8dfie0odHyeT9Npsrzvpz2Ecm LXXG2uQm9pHTSZf8kFN/K7KnRAKuIifKWTRMNjFrekefELdJTW0I2gBjdh/+cAGRAqnKotDvw 8UA39JgWWik2Uz0uif9C31j2jYMU9c3Ff9HNxGgAauhc6DIHvH4eqGVqm1KGyjcdgOAH9yXmK zZxLEuv35PajYzEwtaMq5m+R9u3pGCf9AeuW/YQw3JqPPMJJ2wfkP1zC/CHtLYHbo2v0UEvji HE7iwwnYE1cHbvDRpO65SZxKnYjFH2IzkLCV4Hzpj5SwGpACOizGS7ZkOqqfCRxpzSeYFQ8sR t5N1qiO9m0ZLISGIJtxB/ofiLNKBfaTw5YYMKfxQJMX34tkD8VjgypRKbQH2RsdfYjy20VHsD xnWnGYa37JEiL1z3A1dCur0erj45+me+tqAokvv0OiPGY5Umi0+0JHG9WsCl90THFlwLPejVu ckLMS9l Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use a table for the names; print unknown values in hex, since the value contains flags. Signed-off-by: Richard Henderson Message-Id: <20220829021006.67305-7-richard.henderson@linaro.org> [lv: update print_futex() according to "linux-user: Show timespec on strace for futex()"] Signed-off-by: Laurent Vivier --- linux-user/strace.c | 70 +++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 2deb84a2c106..faa733125624 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3710,44 +3710,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) -{ -#define print_op(val) \ -if( cmd == val ) { \ - qemu_log(#val); \ - return; \ -} - - int cmd = (int)tflag; -#ifdef FUTEX_PRIVATE_FLAG - if (cmd & FUTEX_PRIVATE_FLAG) { - qemu_log("FUTEX_PRIVATE_FLAG|"); - cmd &= ~FUTEX_PRIVATE_FLAG; - } -#endif -#ifdef FUTEX_CLOCK_REALTIME - if (cmd & FUTEX_CLOCK_REALTIME) { - qemu_log("FUTEX_CLOCK_REALTIME|"); - cmd &= ~FUTEX_CLOCK_REALTIME; +static void print_futex_op(int cmd, int last) +{ + 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 + }; + + 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 - 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 @@ -3763,6 +3756,9 @@ print_futex(CPUArchState *cpu_env, const struct syscallname *name, switch (op) { case FUTEX_WAIT: case FUTEX_WAIT_BITSET: + case FUTEX_LOCK_PI: + case FUTEX_LOCK_PI2: + case FUTEX_WAIT_REQUEUE_PI: print_timespec(arg3, 0); break; default: From patchwork Wed Sep 28 08:15:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610092 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp191093pvb; Wed, 28 Sep 2022 04:28:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zW4zaKj3I5NqXCqIo6vrwf2FA95AkyrsZiQWVwgTW9XxJfcVD17b24uR3LUOxE27lTMlV X-Received: by 2002:a05:6214:27e9:b0:4aa:9ff0:e8de with SMTP id jt9-20020a05621427e900b004aa9ff0e8demr25093571qvb.99.1664364529315; Wed, 28 Sep 2022 04:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664364529; cv=none; d=google.com; s=arc-20160816; b=mWR7/5fRv9cR1JKD5ezdigkYj5ZGrpv8RxcdvIwhMhQllwKcx3fMhRwMdwi/rZW0Ij 1h5ify7G7ShPiE4psbQeRdWoyigiv9dC4s/w+DqYxnCfjKT2OGpizoC0tvoTCEfuRIgh OgL+iw2VPtwVXi9HV/f9uMHP8mdcbe/4sawfRMvaygb36sbuydVLynXXW/rJvv2Hw26D yJullv0FyG2EX5efehkX4NWFb1+RziXbBBQL7EjhnhudnMQy8eby91wG65et4wiZF42o KxRH8KxbtGVNuEQ2odcOPO9rHNBiVmU2PVjNoFF/gsps0rtG0eDgq10eRQZun0M/BKOd AYnQ== 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; bh=c2yVu58Igc/rF97GdGSBnNGv+o/zkcCaimjjWk4smDs=; b=QQvTorR0V3OMvI6o6FTU/o3NsTU+bwdd+e4Y9xZmp7zFLC6r9aqGP2qk90ykJfNq// Fvn2O3R7IyCMAXKpgIl8lnRJ9lp7Ug92PVlEzbVHO5QeG+5/c59qe9hlqBca4wzJnZn3 tYDywh5hbkkqYDeFalKtSzdZifDMw5NPQFhDfG+hAln4dcZbzxXfaixy3L6nU9pFeLiR FC9n+rHC23wWNdpHqEN1Fd4DergOp7HmS1tK1U6Abz3oWziWn3DI5BeVE8Ek5obN/0t5 AmmII96U6qIdGfwAiRNY+RIho9hjLbfV2Zh0FBR/24xXTPXikmGL+Y8I7RfzbUEoRG+F eyew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ey8-20020a0562140b6800b004a27d691afesi3380151qvb.383.2022.09.28.04.28.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 04:28:49 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:45298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odVF6-00061C-Gy for patch@linaro.org; Wed, 28 Sep 2022 07:28:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEP-0008Ff-HQ for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:53 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:37479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008HH-DT for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:48 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MzhWp-1pQLn73msL-00vgUF; Wed, 28 Sep 2022 10:15:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 36/38] linux-user: Lock log around strace Date: Wed, 28 Sep 2022 10:15:15 +0200 Message-Id: <20220928081517.734954-37-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:TWXvrr7PU6WcMeI+mKtdiE3jbUWgER8+6r7lUgh/TAqGP5CQGs0 /T380f8LlLO0UdjOd5/cM6g3l7Fdaw+c8cDYAnZ8xuPflft+mKkxd6gghe8LjTwIjwQC8qP UZlNqZxcIbUU6f7QrwTvW4Mp7QGRnzCV5R3tp9EJpfeuLNgBsbgPHQyNlmzNsRnsYFZkeQ0 8W1B9c8gtxY8B0wnHp98Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:7c/b14zdDCg=:hx1cmdsrSQmyEgFoAKy/1a XtipXmOAeWhjj+UvOh9Za0RSOp3H2DTe8DctfTHR7Lg36RP0IWa8mdixDPprgQ4hyxgOnb00B +W18H64eQ0xic88luo/KEkzd1aXm6yb4mIIqhqbGFdJA5+JqC4Eugqk7RCVn9klAua8NTv9/9 jRiMe29VjMlGsQCu1JWt4NZ+Zbrdc0Hyo2mtoaaCD84kna0qxVhDBfxY/3SeDpZS+V2Swv9ku OChp6rsrGq/xJmIqYdZvdnwtriSuTSI0ar9oEitappPjiQpuWVltAFKaXOU8gIiJXWprYitA2 uTgCknPerbGhXb+RCwtWB3j7rQBCA9/ntXQKXtAuVFJgZDtajGyS3Eb16joANY9tQxknHifGo sY0/YihNuWu50jS5B8pPvxoZWdncDWt2lkh/YJU21LY02vmF9il98PNHThPQrTeQEig3Q0siV ZseynwsGZwbrNfQ9DiMZHLSksGY9GR96sQ/bmV3FOjeZtwbno3CrhIn4e/27D9CcqdKcOeT3q pewbbJtfakxP3Fw2z55K3od8yLMgPO7fMT/MYhwmrwScYUnmq8wq2UYK+6xC+QLWiML+ghEty vYNoRTbCDGt3ZToJip0rhRFbqPDWcgOJxx5rfqvlG1ZcbtM83dmHBle6iRXQEG67RAdJFIfwm 0ul5fFgXBBlNbjQ2aAMpR6Ic7/shTyhMJL+Zkl34SomFsyRPFTMsFgfU6FAWKAynLpq2bNZDl 2Xx+/C5nBSNG2TpdJyzqT0/yVxkG3qu/h92gGFzlGk+8y6lWfZ1Zc8oTyoim3PQKFAZqcIP1q Q36uReO Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Do not allow syscall arguments to be interleaved between threads. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-8-richard.henderson@linaro.org> Signed-off-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 faa733125624..37bc96df9bb6 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3919,26 +3919,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: 610090 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp184354pvb; Wed, 28 Sep 2022 04:14:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ESC78JBfdhx9OeQdy5d89svYjMLHdbwKk59WIJqtl2zm51/QUqZMPmlIVKU0kVgNFE9xR X-Received: by 2002:ac8:5b53:0:b0:35b:a603:6cdf with SMTP id n19-20020ac85b53000000b0035ba6036cdfmr26460842qtw.357.1664363685372; Wed, 28 Sep 2022 04:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664363685; cv=none; d=google.com; s=arc-20160816; b=MMGlWCD78Q9A/pbCSXi691sSD/+OAeD88pzYa0vT8nDcMn3ou/OI/bIZ392gflzuba 8EusGV7aqlzFSo1hqiDbwZmNWT2xT8T+JWJPqE7/vc7KfUzP6TtqM4c9OerCtXjUH2LS vv7gYYddxC25z372talcpaBfFpOw856c7a/xaCEZFUO/rMipqTuW7sCxJJIqhxsl9n3z KpWvRde7mUkHzEb2Rrdo4b+kC15uR5zSaDvDQvh5Kzao/3RAiDzMIQuxh0LaVPbOWpHT K1qIk0Oz646LDPhENncNWcViDxXv+UoHvnK8c/NJLDjIGaDEvbblN3NRKOmYWCVIEoH1 R+pA== 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; bh=T2xuYH/ZkXKnO9KmgNKLrbBAYDtKrtJcNEccYigp+s4=; b=liVdnHw+F05gibBm4mvYX2/lGD7mSE90qDRZFezG6F6aTxitF7yHVMv3Ut3u854LUg OpGg2nzNxLNiIrs8OQI6JJWxLXbJ5vGBbxbmIqxyWCVNhIuI3mSow58pfihnbN+MG7zE f2Le79StKFQBKhRc0AFHQuJ/TomMnmqN5BRIxtPA2We3DC8WCCmEATH06OdWwerZ0r2T QGeHnnCJ6wwwkydwxSWOKl5UeYIITFv6G95tgCwkCbh/8rzq2gTjKUwSz1rsZjmxiz3v k21Jm14fJZXE3BAjcrdnLlDypkqc70UJlT6nKisAZGuzIceXvcYWvmboAVF/Z3h+iPud 4V2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bj33-20020a05620a192100b006bc58c26447si2501339qkb.437.2022.09.28.04.14.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 04:14:45 -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; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:54748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odV1Y-0006F1-P0 for patch@linaro.org; Wed, 28 Sep 2022 07:14:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEN-0008FM-OU for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:53 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:38067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEJ-0008Ho-Gj for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:46 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MUGRh-1onBH81P8N-00RLfN; Wed, 28 Sep 2022 10:15:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 37/38] linux-user: Log tid for strace Date: Wed, 28 Sep 2022 10:15:16 +0200 Message-Id: <20220928081517.734954-38-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:i5ZY7Coc5Bj5XrtIawWcES17e8izESnLioTNJdl8kUcOFK+ffrM LVnVJ2fUkhZcHkEpU0ZgfCBRJggcQhdi0npW4JSZYz2dSW+A+N3Is3HZrvrBjY+mTmfB9xx Q9c3iFQpm0r6eHGqxAlsRy9g74VgTeCuuq8UxtfHULecuqZtFb62vj1J0HW3k77tOWnOvA0 n+Kfx1xYluqRXoXDvGqKg== X-UI-Out-Filterresults: notjunk:1;V03:K0:xitIvZ3Wpok=:IzuSQAShq3Q9xX//W6QnpV NpuwYNCtgTvxnJDOufjaA6c14plZev65yKJ4rtb7UHrjnAuo5JkvVvP0bqBkECtrcmXAjSAu6 Sc9eH74AQBOXye9qcIAeSqAkQu4Hs7I1ekcCb8xPBxD08PVJUUM3iJ3VgBbsGOZCumb+Rw8Bs GicAU36uwLJ6XnfF2ep55nKCO/dTYT1zyimzC1gCgpRhUSiZfRA2pjJL5YOj6b/JnmwvdkiVZ WJi3KVxa8HeoTctASI+A6xBMsnXQeZSWD4eKv3n+M8V3pvZUYiYFl3wRmou1ndDYcfriFb3iR Z5wAaD29BEWgVTwMUngMbQWPEtp5rBqmZDu9IhHAOaewQoxaOZXyrGKNgaB4A/W00MoPnISyB pU3FPePw7dwdFm7uyxfzyEtQvgRNCmdPp0c6WqhZ8omRN733UxSGWb4d/IaEOKwx8uYA0HSzb UHJ7VD8N4BPots0lFOmq+znyIkK7CWfqGjDBp9Ck2NURYhi3P9wbI9MvZtjikYt6MGulIE4Rv ecK1NfMyxIzMgTcaZmsUk0RapVfhYH1YOKm8tnERWxL99JmR8Y9Dwnvfn9XRj6y/XtDiuA0U4 +DIophvkfUTpWVB0+HJ/6tyvAhOM6SO8W15x+JC/UopsV8zjbl8h1h8gDaF0DPMDi0g0H8ZVL UIPbno9Ag7iGcJ2VKVwyStdHJkO1riti2vKildpGARcDIS7Ik9dAhKUgW3h0826b2+bfzCcQU c77PsQgSShwTQtkDb0O5nlf4xdLs1pEW5P3rReH1gqCyMNTiKJJ7d+UkFrUzYHsAQXogNUtrx XKcbd8Y Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Printing the same pid for all threads isn't helpful. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-9-richard.henderson@linaro.org> Signed-off-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 37bc96df9bb6..e02dbc3a7108 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3928,7 +3928,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) {