Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp422598imn; Wed, 3 Aug 2022 09:31:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Mx4n/4VZnJ6P8u7MHeVlTL/7cc7Zfoj+sjuJouqM67t2GEh3/Q5wGKz/dbgcYR/FCmMTt X-Received: by 2002:a05:6402:424f:b0:43e:6d89:4316 with SMTP id g15-20020a056402424f00b0043e6d894316mr330234edb.408.1659544282437; Wed, 03 Aug 2022 09:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659544282; cv=none; d=google.com; s=arc-20160816; b=vjSGAvTWX8V1vWHe3FvypAeIO26byN4nvYfq77NxVv+Oi1lPPgAqn7v3ev1CxAo9JY yVISKeo1RlNKLHCljR4833wiGCZ/US3/g4zTdZ/9F7TmR8SojfHnzD+HFM2gTNWJi6Gj JwO8+D2X9ld2Yb1Hgoan9cMmr7gWK+lgqog7V3oRgT/sZYk7OD0H0/J4Z+BPvIe8DeWL v3vk/KsJmEj2+v0PyIapBiKD5B96LGBqrBydl23LFNcy4vc1u8HUOg79a3EFaC26Qkea JYf+52w6FuKifmop7/x026GVcZKaszzu2XHyVClVsfAeVn+OM9xGY7T7TFDvPcQL7FzF mS2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=P8Kl/xKU4IYrDHB8lVGv34ItbSelul5121WYDgLOaI0=; b=utsdhAHM7lYkkC4fqJcP0KHOvCk7Ov4XRjGUOdvICXXYHLK9+Vqhf/2YY/ieWLiXrT Om4Il13J8VS1IDRG50c6nAtZhFXZ/k9bJZ3qRl/TqOaRqVjgW9liiUbOlRY+RE/k/Rfd epcOUFV9sKziVbfs8tGsSdRTDI05vejms69ovo/5lzTmVPvv0OfOiRixG1ux6CHASY3f NH8onrkiq2zN3RgawXq+wPOOUYo8GyovhoO9S9V371WVdfu03s4a12vh489N36DrC7PC rFevpwTaduv7MFsa7I8OsuwjLce+A1RNKoXrNUqFH9LA4CEoQ/dYBh9g9uDWxIYNG+rb TovA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="AxI/+//w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go43-20020a1709070dab00b007303cde561csi7497639ejc.947.2022.08.03.09.30.56; Wed, 03 Aug 2022 09:31:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="AxI/+//w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238126AbiHCQLC (ORCPT + 99 others); Wed, 3 Aug 2022 12:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236287AbiHCQLA (ORCPT ); Wed, 3 Aug 2022 12:11:00 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383B232EDC for ; Wed, 3 Aug 2022 09:10:59 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id s5-20020a17090a13c500b001f4da9ffe5fso2496734pjf.5 for ; Wed, 03 Aug 2022 09:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=P8Kl/xKU4IYrDHB8lVGv34ItbSelul5121WYDgLOaI0=; b=AxI/+//w2k08IiKw07QSnQ9ESu4dwG+wQ2H1SGE72Li0sSxNMpJ1h74H0Sl4CJKqsa ih4rUvBv/IKrC+E+wGXXNKFxSl7R7LsDyo7QhY8j3ZKQFk/x5XOWF3SohPzArzZc4FId y0S0s1uCBL7zRxZmyrax7xPhctcK9wyQJl1iQa3qwhzZBZ1qUWh6cU1SwH23tg25LmC8 jBcT2MqicnNp3pX3l51BnQDlLyL6gz89Z9nzF04zcjcJZEzZWF8b1I0ueoZnVcTP6M/F 8B2+3QzRsv2P/2XqGNrJUbuo11iswfZMfh/VT12eZ01MuohkIatWG1v+qHWPimCnW99S FJPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=P8Kl/xKU4IYrDHB8lVGv34ItbSelul5121WYDgLOaI0=; b=x9vfZJ2MYwiCHM9c0MuSVZMKXPdKt9aqUOHRQ3SyB/cCN3p7jfNsh1E3pY8HA9kKBq i2W8AMfqAA8CB2jBcP46UJ1kl6elf0vN3RIoI0+s/JDNGHdNNp7RJwXOlK8zTOarYbbr esqXAUXw+ZXYe1R/wYSB5/g0xW/LTxybI4uvRXgsbOv1oWRW77KY8INhqe/gnxBDZiKf 3CKaXzhSKkekLR/gP/bPyQjOrGW6mQO4gKJbFED3RHE4vvPO0DT6eWEylB3AYncHAird gQWUyE795z3JlDI5sTGusURwkGlw+DDX5KNLD8aOqQHc4cQiFKqAOoFn7guut90TzuU+ Eybw== X-Gm-Message-State: ACgBeo27UYcxG3IvAtyjm8x5FPXI2ezxzRPfzBgSqwY/s/FIK9UBxB9p a5kTjjlcb7UMjWK7IeefF4qJ5Q== X-Received: by 2002:a17:90a:b010:b0:1f3:161c:30a0 with SMTP id x16-20020a17090ab01000b001f3161c30a0mr5426664pjq.243.1659543058557; Wed, 03 Aug 2022 09:10:58 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id d9-20020a170903230900b0016f057b88c9sm2226388plh.26.2022.08.03.09.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Aug 2022 09:10:57 -0700 (PDT) Date: Wed, 3 Aug 2022 16:10:53 +0000 From: Sean Christopherson To: Andrew Jones Cc: Jinrong Liang , Paolo Bonzini , Wanpeng Li , Jim Mattson , Vitaly Kuznetsov , Joerg Roedel , Jinrong Liang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c Message-ID: References: <20220802071240.84626-1-cloudliang@tencent.com> <20220802150830.rgzeg47enbpsucbr@kamzik> <20220803142637.3y5fj2cwyvbrwect@kamzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220803142637.3y5fj2cwyvbrwect@kamzik> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 03, 2022, Andrew Jones wrote: > On Wed, Aug 03, 2022 at 09:58:51PM +0800, Jinrong Liang wrote: > > My ldd version is (GNU libc) 2.28, and I get a compilation error in this case. > > But I use another ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31 is compiling fine. > > This shows that compilation errors may occur in different GNU libc environments. > > Would it be more appropriate to use syscall for better compatibility? > > OK, it's a pity, but no big deal to use syscall(). Ya, https://man7.org/linux/man-pages/man2/gettid.2.html says: The gettid() system call first appeared on Linux in kernel 2.4.11. Library support was added in glibc 2.30. But there are already two other instances of syscall(SYS_gettid) in KVM selftests, tools/testing/selftests/kvm/lib/assert.c even adds a _gettid() wrapper. So rather than having to remember (or discover) to use syscall(SYS_gettid), I wonder if it's possible to conditionally define gettid()? E.g. check for GLIBC version? Or do #define gettid() syscall(SYS_gettid) so that it's always available and simply overrides the library's gettid() if it's provided?