From nobody Tue Feb 10 03:38:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634040633708938.4799891631117; Tue, 12 Oct 2021 05:10:33 -0700 (PDT) Received: from localhost ([::1]:36262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maGc4-0002ie-MS for importer@patchew.org; Tue, 12 Oct 2021 08:10:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maFig-0000Zo-Og for qemu-devel@nongnu.org; Tue, 12 Oct 2021 07:13:18 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:38431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maFie-0007Xl-RV for qemu-devel@nongnu.org; Tue, 12 Oct 2021 07:13:18 -0400 Received: by mail-ed1-x535.google.com with SMTP id d9so55752977edh.5 for ; Tue, 12 Oct 2021 04:13:16 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m23sm4742802eja.6.2021.10.12.04.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 04:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SXwJWI5doSd/IDqwD+5r/Ku8HGS7DFHwlBHwHwh8g0I=; b=pDoEVx5zIyC4XxTlljaUsBNPuGZuCcL3LbjMtxngqLhaLMeX1ESVV8Zw+vfxwjbP5x watStRzJ6M8w+0RbnMpUdYeDaYBZtZyvvFFOgMjiHYYn0BXqcEjd+7lo9Seqav8bK30e Zn7zZuIu41bT1DwDx8CZEa06ZvOOHajF1E5kIrtsf8Ly6cHjH12o2nRSHAswgrmBI3ur CKoOVcTir8aLZQn+k3H5aQKGFE471pSrj3eLDiIV/kvz/bNRn2GmvwVteNo90uluMJwb BCYUufi+KiG1AOvB5EU5lLgfnOKqE9/zPD6Zxu6/GIWDnJ5695C0ZBuHAW2TZc0/uyKI ax7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SXwJWI5doSd/IDqwD+5r/Ku8HGS7DFHwlBHwHwh8g0I=; b=EBhPeRPjuL8zviB/WOgetXwCQJye2Y5SvCofXVYCKyMg7nYp1HLCKseYHPesgqHoLI u30eu1GSQ3cdahGjI+UGc+n9h4WZivGsXDs0p6a/zwJMLJg92SVxzbuevH369BJ+aZ/M C8aOGunPYKF/e3XiPyHQjVl0TllJoPdwo6OJO3CPbZOsphwDBd6DCR1UIE3cPEDN1d/s /3bKlJK0aV6Vvmyhk9FhqJe7a+NvorNTtFSlTlaj9/gO+f1xOCPksAOcFxw/Mi/LGdH9 +2B8sPeukJNfktmmfD2ZIgHEV0rgsRUX5YS7wR6PCgR9sZML8ViOFCAET0Ugn/Zc/wqj e67w== X-Gm-Message-State: AOAM531/7yqDlv1nPWDYVEmjwUEQLjTt4gfufYbQEXzByRDqLHXDDqSC 2Z+9Eo74nDeyn2Ei98By3A0n7RPUcXM= X-Google-Smtp-Source: ABdhPJzWf6yDO/Ml3NeRU6V+cEcH8VI4OAhMw24KsbM6ITLON1q6uJ9qt4A1M915/NLK5XVQ3MPmyQ== X-Received: by 2002:a05:6402:2550:: with SMTP id l16mr45602680edb.229.1634037195656; Tue, 12 Oct 2021 04:13:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 14/24] configure, meson: move pthread_setname_np checks to Meson Date: Tue, 12 Oct 2021 13:12:52 +0200 Message-Id: <20211012111302.246627-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211012111302.246627-1-pbonzini@redhat.com> References: <20211012111302.246627-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::535; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, thuth@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634040634898100001 This makes the pthreads check dead in configure, so remove it as well. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20211007130829.632254-9-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- configure | 78 ---------------------------------------- meson.build | 23 ++++++++++++ util/qemu-thread-posix.c | 5 ++- 3 files changed, 25 insertions(+), 81 deletions(-) diff --git a/configure b/configure index 52f89b05d6..a1e142d5f8 100755 --- a/configure +++ b/configure @@ -3146,71 +3146,6 @@ if test "$modules" =3D yes; then fi fi =20 -########################################## -# pthread probe -PTHREADLIBS_LIST=3D"-pthread -lpthread -lpthreadGC2" - -pthread=3Dno -cat > $TMPC << EOF -#include -static void *f(void *p) { return NULL; } -int main(void) { - pthread_t thread; - pthread_create(&thread, 0, f, 0); - return 0; -} -EOF -if compile_prog "" "" ; then - pthread=3Dyes -else - for pthread_lib in $PTHREADLIBS_LIST; do - if compile_prog "" "$pthread_lib" ; then - pthread=3Dyes - break - fi - done -fi - -if test "$mingw32" !=3D yes && test "$pthread" =3D no; then - error_exit "pthread check failed" \ - "Make sure to have the pthread libs and headers installed." -fi - -# check for pthread_setname_np with thread id -pthread_setname_np_w_tid=3Dno -cat > $TMPC << EOF -#include - -static void *f(void *p) { return NULL; } -int main(void) -{ - pthread_t thread; - pthread_create(&thread, 0, f, 0); - pthread_setname_np(thread, "QEMU"); - return 0; -} -EOF -if compile_prog "" "$pthread_lib" ; then - pthread_setname_np_w_tid=3Dyes -fi - -# check for pthread_setname_np without thread id -pthread_setname_np_wo_tid=3Dno -cat > $TMPC << EOF -#include - -static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } -int main(void) -{ - pthread_t thread; - pthread_create(&thread, 0, f, 0); - return 0; -} -EOF -if compile_prog "" "$pthread_lib" ; then - pthread_setname_np_wo_tid=3Dyes -fi - ########################################## # libssh probe if test "$libssh" !=3D "no" ; then @@ -4496,19 +4431,6 @@ if test "$debug_mutex" =3D "yes" ; then echo "CONFIG_DEBUG_MUTEX=3Dy" >> $config_host_mak fi =20 -# Hold two types of flag: -# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name = on -# a thread we have a handle to -# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular -# platform -if test "$pthread_setname_np_w_tid" =3D "yes" ; then - echo "CONFIG_THREAD_SETNAME_BYTHREAD=3Dy" >> $config_host_mak - echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=3Dy" >> $config_host_mak -elif test "$pthread_setname_np_wo_tid" =3D "yes" ; then - echo "CONFIG_THREAD_SETNAME_BYTHREAD=3Dy" >> $config_host_mak - echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=3Dy" >> $config_host_mak -fi - if test "$bochs" =3D "yes" ; then echo "CONFIG_BOCHS=3Dy" >> $config_host_mak fi diff --git a/meson.build b/meson.build index c712963170..97dda9aee7 100644 --- a/meson.build +++ b/meson.build @@ -1584,6 +1584,29 @@ config_host_data.set('CONFIG_POSIX_MADVISE', cc.link= s(gnu_source_prefix + ''' #include #include int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }''= ')) + +config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links(''' + #include + + static void *f(void *p) { return NULL; } + int main(void) + { + pthread_t thread; + pthread_create(&thread, 0, f, 0); + pthread_setname_np(thread, "QEMU"); + return 0; + }''', dependencies: threads)) +config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links(''' + #include + + static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } + int main(void) + { + pthread_t thread; + pthread_create(&thread, 0, f, 0); + return 0; + }''', dependencies: threads)) + config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + ''' #include #include diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 6c5004220d..e1225b63bd 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -23,7 +23,8 @@ void qemu_thread_naming(bool enable) { name_threads =3D enable; =20 -#ifndef CONFIG_THREAD_SETNAME_BYTHREAD +#if !defined CONFIG_PTHREAD_SETNAME_NP_W_TID && \ + !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID /* This is a debugging option, not fatal */ if (enable) { fprintf(stderr, "qemu: thread naming not supported on this host\n"= ); @@ -522,7 +523,6 @@ static void *qemu_thread_start(void *args) void *arg =3D qemu_thread_args->arg; void *r; =20 -#ifdef CONFIG_THREAD_SETNAME_BYTHREAD /* Attempt to set the threads name; note that this is for debug, so * we're not going to fail if we can't set it. */ @@ -533,7 +533,6 @@ static void *qemu_thread_start(void *args) pthread_setname_np(qemu_thread_args->name); # endif } -#endif QEMU_TSAN_ANNOTATE_THREAD_NAME(qemu_thread_args->name); g_free(qemu_thread_args->name); g_free(qemu_thread_args); --=20 2.31.1