Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2578500imn; Tue, 2 Aug 2022 08:13:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uBpD0TrcJ/zdORZjOKxco+mZ8b7yM0u80+QpCbBjmKb2Ed4AiMuOe14xSWxWMKz6webRGd X-Received: by 2002:a05:6871:93:b0:fe:23b6:6efb with SMTP id u19-20020a056871009300b000fe23b66efbmr9416543oaa.201.1659453223555; Tue, 02 Aug 2022 08:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659453223; cv=none; d=google.com; s=arc-20160816; b=nn/gRDKN+fEap8RcnUSkEHPlNn68ABuCHFBpCnNJJe4PJxI+zUBSIeQC122LaIuTAw 8hUSYCCPDQKPcBAt5YfKFqnZcoT+7gsl9SBlY3VhiZ+i9kRsTPrJnI3mxk4Qkuq69AB/ MUcHeinGQf9KKarjTQiX6+IC28P2YAc4efJLqXGK6WgEgoJ1glFzhj5I3YQl9K7Lp99v u1v7FwIWg/NHoZd3XpvjTFiPNAD3EGY3Nu/j8IpyZagA47CMry8/IzO37lLpGf2vTtPE 69M8dmIDUPoarmD7C7HBjmn8brwSJU6/a7VNAFK7TCisEt0ywnDF69nQHD1LPmqzIAdx EMfw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=HOmzx5X/2eLrjxlYnOrFg9UpgbpOI38C9+XdzR+VyrQ=; b=LRQpJpq3xf2m+PGxYFVXRyX9nOc/G4bLD1q42Cinw6GeLYPnwj5L7baAp8I9Q2ZhE5 w0JMWq2eCG30i4I8ooeSxCAbHamT5N1JkJ1x2aRFhqWPDk/Ek2hYSoMoy2oJNuY20Ou4 4Xd75h93c+e6njZM5LDB68zz7vkMdviT+1zC1s9cyEbtHMvXH1iR+M+EDxui+dAnvrM1 M2yVekGcbxM33O4OrttO3SXbh0r/MKJnr2CHp14d3JQ//5L5BmFic0oIqLYjlhENdyzY qf+OdKD7auRHV3Hpjo14XDHdzhonfIRxwfR01GEOK2+tONlqVAeE3JtNMSP3F4XTIemD YLoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="DMW0vs/3"; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 103-20020a9d02f0000000b0061cae4bf9bbsi8731482otl.58.2022.08.02.08.13.30; Tue, 02 Aug 2022 08:13:43 -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=@linux.dev header.s=key1 header.b="DMW0vs/3"; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236476AbiHBPIh (ORCPT + 99 others); Tue, 2 Aug 2022 11:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236092AbiHBPIf (ORCPT ); Tue, 2 Aug 2022 11:08:35 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1FA27FCE; Tue, 2 Aug 2022 08:08:34 -0700 (PDT) Date: Tue, 2 Aug 2022 17:08:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1659452912; 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=HOmzx5X/2eLrjxlYnOrFg9UpgbpOI38C9+XdzR+VyrQ=; b=DMW0vs/3nwTLly38qcUsKHzMAw4HMl+cqxh6QYRpfHDrPHtmBhW5XzovQCnU4JnErUEIS7 e4EszGZ4jyfQDUcONWvb+3FCd1cHpIrFpvD05hejtZ0m/QCvYjVVRVTQ9dAJcjCpMEYJTk Dsy2jjTJcJkABPk5vNuGe20xKPputeA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: Jinrong Liang Cc: Paolo Bonzini , Wanpeng Li , Sean Christopherson , 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: <20220802150830.rgzeg47enbpsucbr@kamzik> References: <20220802071240.84626-1-cloudliang@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220802071240.84626-1-cloudliang@tencent.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS 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 Tue, Aug 02, 2022 at 03:12:40PM +0800, Jinrong Liang wrote: > From: Jinrong Liang > > The following warning appears when executing: > make -C tools/testing/selftests/kvm > > rseq_test.c: In function ‘main’: > rseq_test.c:237:33: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration] > (void *)(unsigned long)gettid()); > ^~~~~~ > getgid > /usr/bin/ld: /tmp/ccr5mMko.o: in function `main': > ../kvm/tools/testing/selftests/kvm/rseq_test.c:237: undefined reference to `gettid' > collect2: error: ld returned 1 exit status > make: *** [../lib.mk:173: ../kvm/tools/testing/selftests/kvm/rseq_test] Error 1 The man page says we need #define _GNU_SOURCE #include which rseq_test.c doesn't have. We have _GNU_SOURCE, but not unistd.h. IOW, I think this patch can be diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c index a54d4d05a058..8d3d5eab5e19 100644 --- a/tools/testing/selftests/kvm/rseq_test.c +++ b/tools/testing/selftests/kvm/rseq_test.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include Thanks, drew > > Use the more compatible syscall(SYS_gettid) instead of gettid() to fix it. > More subsequent reuse may cause it to be wrapped in a lib file. > > Signed-off-by: Jinrong Liang > --- > tools/testing/selftests/kvm/rseq_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c > index a54d4d05a058..299d316cc759 100644 > --- a/tools/testing/selftests/kvm/rseq_test.c > +++ b/tools/testing/selftests/kvm/rseq_test.c > @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) > ucall_init(vm, NULL); > > pthread_create(&migration_thread, NULL, migration_worker, > - (void *)(unsigned long)gettid()); > + (void *)(unsigned long)syscall(SYS_gettid)); > > for (i = 0; !done; i++) { > vcpu_run(vcpu); > -- > 2.37.1 >