From nobody Sun May 19 06:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677076917; cv=none; d=zohomail.com; s=zohoarc; b=Y4yNHxtLfPxJrRkHuIJhKnFXM+OPQo9cPUu0MiXdLvDNgyfdUPAILJ+V0Qm/D7nlgfkbaYu2GJnDM+tKBsFo+9rcGC3xNvbJpiNPl+injFTETz/FNltDHdgfJFoWV/fZcGcVnj7hnS23FDxM/YyJe+rsKvHMMHXMveDcsRfSJYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677076917; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s0tX8VBgYcGXBq1dpKE2ZApE6KKmq6gbbOOdDD68uRU=; b=F+BTYc1kMaw5G81iVr5cnoyeTsvczMhBcxh+7Pm2deFjNkkxeEgqzBWopr1WohwjYSoAOcT1moeDBdDmV5BWNHvXfb+pIXIbMwt+Q3EXzc4dzLslAFUukGUg9VdYZI30dxY73rF/v5NC80iCycskrww+d6vPTEnYrJYX7y+I1iE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677076917813518.204714238482; Wed, 22 Feb 2023 06:41:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUqJ5-0003i6-Ax; Wed, 22 Feb 2023 09:41:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ2-0003dS-0t for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ0-00023S-BP for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:15 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-671-dPJKC2EQPoCZ5WfvzybFxA-1; Wed, 22 Feb 2023 09:41:11 -0500 Received: by mail-ed1-f69.google.com with SMTP id h13-20020a0564020e8d00b004a26ef05c34so10637352eda.16 for ; Wed, 22 Feb 2023 06:41:11 -0800 (PST) Received: from avogadro.local ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id um17-20020a170907cb1100b008e076ae6783sm2032696ejc.14.2023.02.22.06.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 06:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677076873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s0tX8VBgYcGXBq1dpKE2ZApE6KKmq6gbbOOdDD68uRU=; b=FJsbJZp1FbsV59H8/+to0fuGdkRv0P4CZI1j/KuVt9DR6EGmYplGRYFm0MimoJmC+5KLq8 k608LQlUGdPACGwlDdPWDxiShCw54ViAbpAreN+2pcv5mddDTEGJp7YvQTUVBMu5DffCiF 8r1952pb+QXkSoDZ/A0KWG2ixZwFIZo= X-MC-Unique: dPJKC2EQPoCZ5WfvzybFxA-1 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 :subject:date:message-id:reply-to; bh=s0tX8VBgYcGXBq1dpKE2ZApE6KKmq6gbbOOdDD68uRU=; b=QfWJaFazGX7hDkO2T82Ek2OGrnACLO52yKhboumhvMQ4yon/wID+SduKHHbN70/9lu 2D6d+BavhWlohVBSKupat3xaL0ZLkvjjVfJKD0zvIbuNa2AbNaVom4z4kKACAv+KURnx PyQSHk2X5g1w5K2urdkF1dPjwzYk1V5kxPPFw+AjWBRPLEW2gtiwFUM0meJDSIEDIQ+1 AHXjKi3Yqi4D3oL1pHfM5YDkGQYc7mZ9DHahAR13aYZNqF0hWW54EsZKL+/ffBf7gh6g 0YFwEDFXsyNHabSBTA0wF7ErY9aFD84zJOcQzkILzme+AmpPGg3AxUzR/nXiEVWY34MP C/lQ== X-Gm-Message-State: AO0yUKXhW/1aZMCLSbJJ/Zom3z5cC3oK016uQlxRrnRtS9V4lj10Xwf3 MmkZJKRHqtEG6az1mJLYXCajmkAr/Js9uMAO+TLK1IbYiZ2fcKA7PrVe5j47hRsG5KLBRcyqIs3 yzJTyJf9MTiqylgotHlnyn368lGSj4oB7mR4/bw2n9Kfb8z2ezlFZpPN8Hky1VKdKmskd8CiY X-Received: by 2002:a17:907:94c5:b0:8b1:319c:c29c with SMTP id dn5-20020a17090794c500b008b1319cc29cmr21998022ejc.70.1677076869787; Wed, 22 Feb 2023 06:41:09 -0800 (PST) X-Google-Smtp-Source: AK7set/egbJstapyDNVUNYj7JrluUEwqd2Y4JjGTdIhnsuiwm09Ok6kJihPzwx6pNYQnXaVMHytPwQ== X-Received: by 2002:a17:907:94c5:b0:8b1:319c:c29c with SMTP id dn5-20020a17090794c500b008b1319cc29cmr21997995ejc.70.1677076869448; Wed, 22 Feb 2023 06:41:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/4] target/i386: Fix 32-bit AD[CO]X insns in 64-bit mode Date: Wed, 22 Feb 2023 15:41:00 +0100 Message-Id: <20230222144103.467002-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230222144103.467002-1-pbonzini@redhat.com> References: <20230222144103.467002-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677076919489100003 From: Richard Henderson Failure to truncate the inputs results in garbage for the carry-out. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1373 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230115012103.3131796-1-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 2 + tests/tcg/x86_64/Makefile.target | 3 ++ tests/tcg/x86_64/adox.c | 69 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tests/tcg/x86_64/adox.c diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 0d7c6e80ae87..e61ae9a2e92d 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1037,6 +1037,8 @@ static void gen_ADCOX(DisasContext *s, CPUX86State *e= nv, MemOp ot, int cc_op) #ifdef TARGET_X86_64 case MO_32: /* If TL is 64-bit just do everything in 64-bit arithmetic. */ + tcg_gen_ext32u_tl(s->T0, s->T0); + tcg_gen_ext32u_tl(s->T1, s->T1); tcg_gen_add_i64(s->T0, s->T0, s->T1); tcg_gen_add_i64(s->T0, s->T0, carry_in); tcg_gen_shri_i64(carry_out, s->T0, 32); diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.t= arget index 4eac78293f2e..e64aab1b81c6 100644 --- a/tests/tcg/x86_64/Makefile.target +++ b/tests/tcg/x86_64/Makefile.target @@ -12,11 +12,14 @@ ifeq ($(filter %-linux-user, $(TARGET)),$(TARGET)) X86_64_TESTS +=3D vsyscall X86_64_TESTS +=3D noexec X86_64_TESTS +=3D cmpxchg +X86_64_TESTS +=3D adox TESTS=3D$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64 else TESTS=3D$(MULTIARCH_TESTS) endif =20 +adox: CFLAGS=3D-O2 + run-test-i386-ssse3: QEMU_OPTS +=3D -cpu max run-plugin-test-i386-ssse3-%: QEMU_OPTS +=3D -cpu max =20 diff --git a/tests/tcg/x86_64/adox.c b/tests/tcg/x86_64/adox.c new file mode 100644 index 000000000000..36be644c8bc5 --- /dev/null +++ b/tests/tcg/x86_64/adox.c @@ -0,0 +1,69 @@ +/* See if ADOX give expected results */ + +#include +#include +#include + +static uint64_t adoxq(bool *c_out, uint64_t a, uint64_t b, bool c) +{ + asm ("addl $0x7fffffff, %k1\n\t" + "adoxq %2, %0\n\t" + "seto %b1" + : "+r"(a), "=3D&r"(c) : "r"(b), "1"((int)c)); + *c_out =3D c; + return a; +} + +static uint64_t adoxl(bool *c_out, uint64_t a, uint64_t b, bool c) +{ + asm ("addl $0x7fffffff, %k1\n\t" + "adoxl %k2, %k0\n\t" + "seto %b1" + : "+r"(a), "=3D&r"(c) : "r"(b), "1"((int)c)); + *c_out =3D c; + return a; +} + +int main() +{ + uint64_t r; + bool c; + + r =3D adoxq(&c, 0, 0, 0); + assert(r =3D=3D 0); + assert(c =3D=3D 0); + + r =3D adoxl(&c, 0, 0, 0); + assert(r =3D=3D 0); + assert(c =3D=3D 0); + + r =3D adoxl(&c, 0x100000000, 0, 0); + assert(r =3D=3D 0); + assert(c =3D=3D 0); + + r =3D adoxq(&c, 0, 0, 1); + assert(r =3D=3D 1); + assert(c =3D=3D 0); + + r =3D adoxl(&c, 0, 0, 1); + assert(r =3D=3D 1); + assert(c =3D=3D 0); + + r =3D adoxq(&c, -1, -1, 0); + assert(r =3D=3D -2); + assert(c =3D=3D 1); + + r =3D adoxl(&c, -1, -1, 0); + assert(r =3D=3D 0xfffffffe); + assert(c =3D=3D 1); + + r =3D adoxq(&c, -1, -1, 1); + assert(r =3D=3D -1); + assert(c =3D=3D 1); + + r =3D adoxl(&c, -1, -1, 1); + assert(r =3D=3D 0xffffffff); + assert(c =3D=3D 1); + + return 0; +} --=20 2.39.1 From nobody Sun May 19 06:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677076930; cv=none; d=zohomail.com; s=zohoarc; b=ceqgxd23FY5cdxY+l7zIRIWgKOpKJiWynfC8P6SgSJ4ac25hRB1QF2E7VLvGaqGzXBTrR24xVq666XCO4fZqUlFt+/CsmLFmK71G5o1jv+PrexLlQg6CsGr0R7/stVZar/8J++bc6zj3evbgaT08GwqvVY3QyuxPgQ2jxLvgU3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677076930; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EDwV9NVTQ9xnrAkZPIYEhW7epM/BGeF1PsDaqusl4Jc=; b=ZgsS4qaIpUjUCKgfIjHMa2C4ZHltYNtQLsk3/09vzmJouqPAOi2hbk2weo8ASCniqim47rZIfaRkA8ZvbNphaGqTnfssEpqJGOfDJswBdFE2O++0xaTACT2EsL2m3rLlv2BATnAtMauHwkQ0EPrBEOXX9fKU0E9sPSzlZ+ExD2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677076930526687.4898248326983; Wed, 22 Feb 2023 06:42:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUqJ6-0003iR-4S; Wed, 22 Feb 2023 09:41:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ4-0003gT-Df for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ2-00023u-Rz for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:18 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-655-r3O8sdX3PjmyzFN5pG0EZw-1; Wed, 22 Feb 2023 09:41:15 -0500 Received: by mail-ed1-f71.google.com with SMTP id c1-20020a0564021f8100b004acbe232c03so10762909edc.9 for ; Wed, 22 Feb 2023 06:41:14 -0800 (PST) Received: from avogadro.local ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id dt23-20020a170906b79700b00889db195470sm8450907ejb.82.2023.02.22.06.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 06:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677076876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EDwV9NVTQ9xnrAkZPIYEhW7epM/BGeF1PsDaqusl4Jc=; b=SQEN1blxuonTruvNFD1IsAn67HYz1bxpxhFbmSH8M30RrT6nNaY1+iyyuGXmDZnaFf0gbw 0/2F92FIqcyEQzsICVmFuz7gkOCkSOxkHXy00klm9XdOIDh3OqSf+UrcK2w/ctnUVzblVY rxuB1VerdCQDBSeEFbk0VMg/KzddnsY= X-MC-Unique: r3O8sdX3PjmyzFN5pG0EZw-1 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 :subject:date:message-id:reply-to; bh=EDwV9NVTQ9xnrAkZPIYEhW7epM/BGeF1PsDaqusl4Jc=; b=xhLNtH2lpBTXqnhAyR+w9BPPO0aaCtllASe3P0fqmEBSSGxv8qu15hBHYi+2J30xNW wAuBsXewYLVGEuERGo1wQMJK+rwBth0ZA0p1xBDQfXZep6tS94IVTCJlPLpdof6zPmks 9SzOyDULoffV8ltwW3kULfdLzh81vYTE4P6rMe413AbJ/yoNprN6phzH0XF/KhmiAHX3 3O+yeBBfBvBG7Wjd8OlBU9mCvHlreNUGPGV9M/OI1AdI7s9vhL0Yv+eQV2p76XZgzXcq mAo8TSz1avvza1jrFfE/r+xI7aV5mLkliZI+3CJwGzd5A8eieUZYRj+OId2MOJCYu+tN E5/g== X-Gm-Message-State: AO0yUKW5uP5MNlhqtAtYZ8+5+RR7MoCGFsPEDEQ0ya0VkfzrsNh0DeVM H7OkXB1jCVz80UgPNKnVvIpSpYA8jHre4yurNN2gVKS38329C/xpZzoochaQTqd/zQZ3bu9e8RH uofti2MYhYNX0rGmfyq9BzNjfeiBvEMHhoWjBTivQ5/nAF6eJ0v3n1ycYTr7q84NMzbw2kJTH X-Received: by 2002:a17:907:3f0d:b0:8ae:6b88:e52d with SMTP id hq13-20020a1709073f0d00b008ae6b88e52dmr14960914ejc.7.1677076872859; Wed, 22 Feb 2023 06:41:12 -0800 (PST) X-Google-Smtp-Source: AK7set+qKsypQyiMrAUGQ1JQVcRQWLg8O48gWDpxTkCEowDvjbeXnb2Bs3Y8YoneM4P+FS5ohZjbnA== X-Received: by 2002:a17:907:3f0d:b0:8ae:6b88:e52d with SMTP id hq13-20020a1709073f0d00b008ae6b88e52dmr14960877ejc.7.1677076872493; Wed, 22 Feb 2023 06:41:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Brad Smith , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 2/4] thread-posix: add support for setting threads name on OpenBSD Date: Wed, 22 Feb 2023 15:41:01 +0100 Message-Id: <20230222144103.467002-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230222144103.467002-1-pbonzini@redhat.com> References: <20230222144103.467002-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677076931489100003 From: Brad Smith Make use of pthread_set_name_np() to be able to set the threads name on OpenBSD. Signed-off-by: Brad Smith Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: Signed-off-by: Paolo Bonzini --- meson.build | 12 ++++++++++++ util/qemu-thread-posix.c | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a76c85531250..86e8ff91093f 100644 --- a/meson.build +++ b/meson.build @@ -2133,6 +2133,18 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_T= ID', cc.links(gnu_source_pre pthread_create(&thread, 0, f, 0); return 0; }''', dependencies: threads)) +config_host_data.set('CONFIG_PTHREAD_SET_NAME_NP', cc.links(gnu_source_pre= fix + ''' + #include + #include + + static void *f(void *p) { return NULL; } + int main(void) + { + pthread_t thread; + pthread_create(&thread, 0, f, 0); + pthread_set_name_np(thread, "QEMU"); + return 0; + }''', dependencies: threads)) config_host_data.set('CONFIG_PTHREAD_CONDATTR_SETCLOCK', cc.links(gnu_sour= ce_prefix + ''' #include #include diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index bae938c67084..412caa45efb7 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -18,6 +18,10 @@ #include "qemu/tsan.h" #include "qemu/bitmap.h" =20 +#ifdef CONFIG_PTHREAD_SET_NAME_NP +#include +#endif + static bool name_threads; =20 void qemu_thread_naming(bool enable) @@ -25,7 +29,8 @@ void qemu_thread_naming(bool enable) name_threads =3D enable; =20 #if !defined CONFIG_PTHREAD_SETNAME_NP_W_TID && \ - !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID + !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID && \ + !defined CONFIG_PTHREAD_SET_NAME_NP /* This is a debugging option, not fatal */ if (enable) { fprintf(stderr, "qemu: thread naming not supported on this host\n"= ); @@ -480,6 +485,8 @@ static void *qemu_thread_start(void *args) pthread_setname_np(pthread_self(), qemu_thread_args->name); # elif defined(CONFIG_PTHREAD_SETNAME_NP_WO_TID) pthread_setname_np(qemu_thread_args->name); +# elif defined(CONFIG_PTHREAD_SET_NAME_NP) + pthread_set_name_np(pthread_self(), qemu_thread_args->name); # endif } QEMU_TSAN_ANNOTATE_THREAD_NAME(qemu_thread_args->name); --=20 2.39.1 From nobody Sun May 19 06:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677076898; cv=none; d=zohomail.com; s=zohoarc; b=B+J3/9eT+AQ5iZzMzMXn8PJ1sZYMQ9gzIINemvaH4QphffILvCs3BWe/iqn9Pcstm5R/bz35GAoNzVD7EE7fxlLEqHL5ykHu6BwqP0jCAfb1bgqfuZgeaaume9aPWMwStRuVMwtUVza+aAWzv2d8HeFgbwgGRuncEmy9W6B4gEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677076898; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NwGmVlbnTJRO4XtFjIsIWEQS/c4kjx3FDHF/wrPTbLI=; b=G3vgQWEinrxM9/b1OBBARFXgGpNwmu78KpYyTpS+iifAdieRAPsZiQBT1WYcIJar3YV8XB0Zk7FHQzjHH1O2CZf0VEQBeA6HarTCqUwglSnGYKlyApfDmCVVNcqdhaXTMb+02zjNTrgxPMC4xXTxtKfoeV567KHp1X1w1dzMM6I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677076898660732.4819411715471; Wed, 22 Feb 2023 06:41:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUqJC-0003jC-6K; Wed, 22 Feb 2023 09:41:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ9-0003ik-CN for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ6-00024S-E5 for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:23 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-182-u2WwFl_oP-2EwLS6vIHrJw-1; Wed, 22 Feb 2023 09:41:18 -0500 Received: by mail-ed1-f69.google.com with SMTP id eg35-20020a05640228a300b004ad6e399b73so10190115edb.10 for ; Wed, 22 Feb 2023 06:41:17 -0800 (PST) Received: from avogadro.local ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id a27-20020a509b5b000000b004acc7202074sm3132759edj.16.2023.02.22.06.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 06:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677076879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NwGmVlbnTJRO4XtFjIsIWEQS/c4kjx3FDHF/wrPTbLI=; b=b4wo66Nn0ooZ2B7UeL+JIYj0goM+HF+G1DICGnzLTN49ZLYT/Zwk9Wngqk6/9GJOnhsopn 4AFmlXz5FC+uQ21cx0hvzpx8ktzfj7IEPDmji2XoPACLK5OziwCO32wsPYg7lAaW7AcGeb auk9XPvPr/CSUydmlWseZaV7LlPR7Ns= X-MC-Unique: u2WwFl_oP-2EwLS6vIHrJw-1 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 :subject:date:message-id:reply-to; bh=NwGmVlbnTJRO4XtFjIsIWEQS/c4kjx3FDHF/wrPTbLI=; b=8SRG4m+Vlt+vzDbl1wWFgPwf/u92dkJAhdGIQoiJr5Qxj388ripR4hEiHTPYH6fdLj bRpZpNtlu9x6JyfxJmf4A+w1YMZaYmExOh1EbcojWgs5ALwY7+KvefKXRsseCvjopUol R1wyYqRPEVP9UbN0uHpixrsrvHgQ/rOG7rRvy4HHrX4Yofqn38kcGdeXMPyqVJ6R7uGK t+tU38x9mni2jVJop7ZDrXwAA28cRIBbYmwHVr2lbsTt6yEo4C7ZTlnggaT/GiYGeNYZ 63ft2j391Iy9Q6t/G9K5dbh4F4saszs0domZHkQxfCUIEV87EaZHV1wwCxRIiByU9mv1 to9A== X-Gm-Message-State: AO0yUKWU13O19h/bT+7zrP+s3hwV5UdRT0fSLJryHziy13UMv+iANFMe q6XZKmcjIYZogz5FHr90w0/6pnu/PZ1CHnKZGySFEGIPUJnPhEpj/iZGiMZt451DPNB96lZUvoR LULvZfN3GD0KX6ZDBN5cDZ/9QIa9spoxOj9ZUVd8oM+VJe/x2+4DktGL6xxiyVRA2Av9S6ZBW X-Received: by 2002:aa7:df96:0:b0:4ad:7203:9b2a with SMTP id b22-20020aa7df96000000b004ad72039b2amr9489332edy.19.1677076876246; Wed, 22 Feb 2023 06:41:16 -0800 (PST) X-Google-Smtp-Source: AK7set/xImzL0z0UZu+DMd36owHMttHKXcIRttal7fo0DDQE1bfw+lJcr1hW8ONoAtw49eeeMMyQFg== X-Received: by 2002:aa7:df96:0:b0:4ad:7203:9b2a with SMTP id b22-20020aa7df96000000b004ad72039b2amr9489312edy.19.1677076875910; Wed, 22 Feb 2023 06:41:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Markus Armbruster , Peter Maydell , John Snow , Kevin Wolf , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 3/4] docs: build-platforms: refine requirements on Python build dependencies Date: Wed, 22 Feb 2023 15:41:02 +0100 Message-Id: <20230222144103.467002-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230222144103.467002-1-pbonzini@redhat.com> References: <20230222144103.467002-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677076899307100001 Historically, the critical dependency for both building and running QEMU has been the distro packages. Because QEMU is written in C and C's package management has been tied to distros (at least if you do not want to bundle libraries with the binary, otherwise I suppose you could use something like conda or wrapdb), C dependencies of QEMU would target the version that is shipped in relatively old but still commonly used distros. For non-C libraries, however, the situation is different, as these languages have their own package management tool (cpan, pip, gem, npm, and so on). For some of these languages, the amount of dependencies for even a simple program can easily balloon to the point that many distros have given up on packaging non-C code. For this reason, it has become increasingly normal for developers to download dependencies into a self-contained local environment, instead of relying on distro packages. Fortunately, this affects QEMU only at build time, as qemu.git does not package non-C artifacts such as the qemu.qmp package; but still, as we make more use of Python, we experience a clash between a support policy that is written for the C world, and dependencies (both direct and indirect) that increasingly do not care for the distro versions and are quick at moving past Python runtime versions that are declared end-of-life. For example, Python 3.6 has been EOL'd since December 2021 and Meson 0.62 (released the following March) already dropped support for it. Yet, Python 3.6 is the default version of the Python runtime for RHEL/CentOS 8 and SLE 15, respectively the penultimate and the most recent version of two distros that QEMU would like to support. (It is also the version used by Ubuntu 18.04, but QEMU stopped supporting it in April 2022). There are good reasons to move forward with the deprecation of Python 3.6 in QEMU as well: completing the configure->meson switch (which requires Meson 0.63), and making the QAPI generator fully typed (which requires newer versions of not just mypy but also Python, due to PEP563). Fortunately, these long-term support distros do include newer versions of the Python runtime. However, these more recent runtimes only come with a very small subset of the Python packages that the distro includes. Because most dependencies are optional tests (avocado, mypy, flake8) and Meson is bundled with QEMU, the most noticeably missing package is Sphinx (and the readthedocs theme). There are four possibilities: * we change the support policy and stop supporting CentOS 8 and SLE 15; not a good idea since CentOS 8 is not an unreasonable distro for us to want to continue to support * we keep supporting Python 3.6 until CentOS 8 and SLE 15 stop being supported. This is a possibility---but we may want to revise the support policy anyway because SLE 16 has not even been released, so this would mean delaying those desirable reasons for perhaps three years; * we support Python 3.6 just for building documentation, i.e. we are careful not to use Python 3.7+ features in our Sphinx extensions but are free to use them elsewhere. Besides being more complicated to understand for developers, this can be quite limiting; parts of the QAPI generator run at sphinx-build time, which would exclude one of the areas which would benefit from a newer version of the runtime; * we only support Python 3.7+, which means CentOS 8 CI and users have to either install Sphinx from pip or disable documentation. This proposed update to the support policy chooses the last of these possibilities. It does by modifying three aspects of the support policy: * it introduces different support periods for *native* vs. *non-native* dependencies. Non-native dependencies are currently Python ones only, and for simplicity the policy only mentions Python; however, the concept generalizes to other languages with a well-known upstream package manager, that users of older distributions can fetch dependencies from; * it opens up the possibility of taking non-native dependencies from their own package index instead of using the version in the distribution. The wording right now is specific to dependencies that are only required at build time. In the future we may have to refine it if, for example, parts of QEMU will be written in Rust; in that case, crates would be handled in a similar way to submodules and vendored in the release tarballs. * it mentions specifically that optional build dependencies are excluded from the platform policy. Tools such as mypy don't affect the ability to build QEMU and move fast enough that distros cannot standardize on a single version of them (for example RHEL9 does not package them at all, nor does it run them at rpmbuild time). In other cases, such as cross compilers, we have alternatives. Right now, non-native dependencies have to be download manually by running "pip" before "configure". In the future, it will be desirable for configure to set up a virtual environment and download them in the same way that it populates git submodules (but, in this case, without vendoring them in the release tarballs). Just like with submodules, this would make things easier for people that can afford accessing the network in their build environment; the option to populate the build environment manually would remain for people whose build machines lack network access. The change to the support policy neither requires nor forbids this future change. [Thanks to Daniel P. Berrang=C3=A9, Peter Maydell and others for discussions that were copied or summarized in the above commit message] Cc: Markus Armbruster Cc: Peter Maydell Cc: John Snow Cc: Kevin Wolf Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Paolo Bonzini --- docs/about/build-platforms.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst index 1c1e7b9e11c3..20b97c33109d 100644 --- a/docs/about/build-platforms.rst +++ b/docs/about/build-platforms.rst @@ -86,6 +86,38 @@ respective ports repository, while NetBSD will use the p= kgsrc repository. For macOS, `Homebrew`_ will be used, although `MacPorts`_ is expected to c= arry similar versions. =20 +Some build dependencies may follow less conservative rules: + +Python runtime + Distributions with long-term support often provide multiple versions + of the Python runtime. While QEMU will initially aim to support the + distribution's default runtime, it may later increase its minimum version + to any newer python that is available as an option from the vendor. + In this case, it will be necessary to use the ``--python`` command line + option of the ``configure`` script to point QEMU to a supported + version of the Python runtime. + + As of QEMU |version|, the minimum supported version of Python is 3.6. + +Python build dependencies + Some of QEMU's build dependencies are written in Python. Usually these + are only packaged by distributions for the default Python runtime. + If QEMU bumps its minimum Python version and a non-default runtime is + required, it may be necessary to fetch python modules from the Python + Package Index (PyPI) via ``pip``, in order to build QEMU. + +Optional build dependencies + Build components whose absence does not affect the ability to build + QEMU may not be available in distros, or may be too old for QEMU's + requirements. Many of these, such as the Avocado testing framework + or various linters, are written in Python and therefore can also + be installed using ``pip``. Cross compilers are another example + of optional build-time dependency; in this case it is possible to + download them from repositories such as EPEL, to use container-based + cross compilation using ``docker`` or ``podman``, or to use pre-built + binaries distributed with QEMU. + + Windows ------- =20 --=20 2.39.1 From nobody Sun May 19 06:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677076908; cv=none; d=zohomail.com; s=zohoarc; b=hKAPlzuWaiOELCwGqbZbDS+G8lqcghGV39JlrrU/V7ytocu5Dr2xMU96Eti52oiPHvpxsl7zpKR9ySzjRvnB/o4SC7LjSjGt8txIFi+MTe+dLelUSojeoWQ8WHfJjg29xRyGEkb/N/FuoFQPPdNRzekCMcd2DTLk1p6/nov7O4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677076908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PfsG5DMetFuzBEjkHodWxxuvVXtGrylwCyzdwqZVZXI=; b=fup192CgWU95vnKgHzMK64lwIkyMZnuRxZEjG8DLemnbT1qxy5+XRQ7dhYN5dqP2JWkde5EMpzkDngNQKL5LylGVLyVP4sHka9upqtlza+5daGcp7tjbrtuWNb30ZXvm7Jm9/ZK7+8QfS2iBJ7LnAcen0NY8sj/ubiYcXTN0Kg4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677076908681740.8287619135133; Wed, 22 Feb 2023 06:41:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUqJC-0003jg-V4; Wed, 22 Feb 2023 09:41:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJB-0003iw-2W for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUqJ9-00024o-Fq for qemu-devel@nongnu.org; Wed, 22 Feb 2023 09:41:24 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-299-HW2QdJN1Ns25SOV_ddWqaA-1; Wed, 22 Feb 2023 09:41:20 -0500 Received: by mail-ed1-f69.google.com with SMTP id co14-20020a0564020c0e00b004aab4319cedso10475214edb.2 for ; Wed, 22 Feb 2023 06:41:20 -0800 (PST) Received: from avogadro.local ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id c30-20020a50f61e000000b004aee4e2a56esm3993520edn.0.2023.02.22.06.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 06:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677076882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PfsG5DMetFuzBEjkHodWxxuvVXtGrylwCyzdwqZVZXI=; b=GhpA24F5rE2X43m10ooLI1ZFuOt0U9UXAT7NAwbp9CunEAm8DrQrRm0iUHi6kYAo3Toxpi ey0wK/y0E+2NGdpxy6dAmRFtvtrXRbexXEEFJCkKzaaPxxVLrdiHmnak1nyKlR5f20nq6+ 7Xs8QbNLdSfnL878naPrOj3IEPBwDUA= X-MC-Unique: HW2QdJN1Ns25SOV_ddWqaA-1 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 :subject:date:message-id:reply-to; bh=PfsG5DMetFuzBEjkHodWxxuvVXtGrylwCyzdwqZVZXI=; b=vtmIgNtKUiiYfVFLLrbJzdI4KBf6BS20ZGWotN5vr6job4OQ+GW4v01Q9KbGu2qW3Y Ea8frQRkW73aPZKaAbvAERnPtiRogTU6W1cDfGSYHJ4IE+CGXlFGNwVkPV3AwDmnc9wB Kzsv4/ky0Riq7MBYGQ86jfl/FtqMjKDUBh0fJ/fLmmF2xreOrtM2SruUQ3uq94XI6D62 9ts64Z94yHsgKFiF/7fTaluvDEcCupZ08CUnEVTjLTSwC5a/6OVaSPU4aLdprmV95cuz 9MY0QAdIvieXZrVZlUmAQQ+Z95aAB/vzL872VoB0arVqqtxDkn5Vk9qeKLvRX4jpWLe4 4h+w== X-Gm-Message-State: AO0yUKWhUlbXHtfNUQBvLprgNawVS6b3KmEZ2mGfcd4rJo4TQl6L2JaW gRtOoTmNX1HZLRL65R8rSb/QhpcThDPCfpMABA5iwlHeU9Ffkfeod8fb+KDEA2ptGyr/i6XncCc kN7tYafLceDFMCJN8ETycNDp9oAUwp0gMaOKBVgVZf3fna7RUxg5cGL2NLnqaN/jzhdw+u6xK X-Received: by 2002:aa7:c692:0:b0:4ac:b614:dcfc with SMTP id n18-20020aa7c692000000b004acb614dcfcmr6525137edq.9.1677076879249; Wed, 22 Feb 2023 06:41:19 -0800 (PST) X-Google-Smtp-Source: AK7set9WytsdYP2+HacGmGo0QLjMuMCPwOfggdHeG1muBDRHvAGXCGWfjwbJ9ZmO/MfMp8RKkKqYfA== X-Received: by 2002:aa7:c692:0:b0:4ac:b614:dcfc with SMTP id n18-20020aa7c692000000b004acb614dcfcmr6525116edq.9.1677076878927; Wed, 22 Feb 2023 06:41:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: TaiseiIto , Richard Henderson Subject: [PULL 4/4] target/i386/gdbstub: Fix a bug about order of FPU stack in 'g' packets. Date: Wed, 22 Feb 2023 15:41:03 +0100 Message-Id: <20230222144103.467002-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230222144103.467002-1-pbonzini@redhat.com> References: <20230222144103.467002-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677076909345100001 Content-Type: text/plain; charset="utf-8" From: TaiseiIto Before this commit, when GDB attached an OS working on QEMU, order of FPU stack registers printed by GDB command 'info float' was wrong. There was a bug causing the problem in 'g' packets sent by QEMU to GDB. The packets have values of registers of machine emulated by QEMU containing FPU stack registers. There are 2 ways to specify a x87 FPU stack register. The first is specifying by absolute indexed register names (R0, ..., R7). The second is specifying by stack top relative indexed register names (ST0, ..., ST7). Values of the FPU stack registers should be located in 'g' packet and be ordered by the relative index. But QEMU had located these registers ordered by the absolute index. After this commit, when QEMU reads registers to make a 'g' packet, QEMU specifies FPU stack registers by the relative index. Then, the registers are ordered correctly in the packet. As a result, GDB, the packet receiver, can print FPU stack registers in the correct order. Signed-off-by: TaiseiIto Reviewed-by: Richard Henderson Message-Id: Signed-off-by: Paolo Bonzini --- target/i386/gdbstub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index c3a2cf6f2825..786971284ae7 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -121,7 +121,9 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray = *mem_buf, int n) return gdb_get_reg32(mem_buf, env->regs[gpr_map32[n]]); } } else if (n >=3D IDX_FP_REGS && n < IDX_FP_REGS + 8) { - floatx80 *fp =3D (floatx80 *) &env->fpregs[n - IDX_FP_REGS]; + int st_index =3D n - IDX_FP_REGS; + int r_index =3D (st_index + env->fpstt) % 8; + floatx80 *fp =3D &env->fpregs[r_index].d; int len =3D gdb_get_reg64(mem_buf, cpu_to_le64(fp->low)); len +=3D gdb_get_reg16(mem_buf, cpu_to_le16(fp->high)); return len; --=20 2.39.1