Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6532175rwb; Tue, 9 Aug 2022 17:54:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5v2SXIRN9AARW5k/yDXl3VsDYfJ1vppqiOE87FVDKWjJnw9xPnK52Wk9LPRnwfCGETm69z X-Received: by 2002:a05:6402:50c9:b0:43e:42b0:f84a with SMTP id h9-20020a05640250c900b0043e42b0f84amr23601827edb.72.1660092848491; Tue, 09 Aug 2022 17:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660092848; cv=none; d=google.com; s=arc-20160816; b=JJgy6LmJQ3Ei6IuhXwsbJavJV/2nF0AbPGTjkYjB996xFwO9rV3dbGs3JVhkPE5J9w wqvaR4f/jHVr4lFNn+pj5nbrBujTN0zDwqSC8obyPChjCjlzRwMoUkPGIPHPjeMJHPto Mppw6lUZTfb/6GUrYhCQ8UPq32KKMzRZl4i+EHazlSHZKQRCMXcnrWYsiiFXTim7w25J 60A4vHhFVlbBW1OC5f0P3dwm5GYixFn5ImM+Y4w8cIM1EItRiHS5mVTWM3AEljj91/7F SfaBbG+ZmHVaOktL9VB5l92uXiREOGuWbO6GqWVvwMyVTFbDggX862gLLs4LQyoLzBz0 gOfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:reply-to:dkim-signature; bh=S/MAn6qAg/Jsbs3sbj308t0Whag8V+DOtIapBcO490g=; b=t1B8F0aIemS9dbVu3QwTq+tIYyyrDkFWiyG7vjUIAC2RDIy2o2LP84kmaRWYiLFfT+ 3C2NNxj+L5GZxhYU5bmLSO4eVQ8+FI0BCPt/NPPYjgHddcKsdrlG+eEaqrBUsJ+ftK5a fNFwzQ6QunFh2vrbplNpHM4IMhA/V8umfmKWcOHjDnlFLANUKQLSgSS+RmEUFzBMzPUG 8/0juAHW3o16IpG/wlyzOt8/xVoAK+ZlsadzfLiznNcoL4ffjK3guD62Tm03g11akHOE SEj2izt48y3F+A0x+rCnPPSnh+/pumm2hfPBZkMmpWgSnskIdHpoGaRti/CfbFsqJwLE lSAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cQT5/15c"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a50d54e000000b0043c2ae58872si9927600edj.460.2022.08.09.17.53.43; Tue, 09 Aug 2022 17:54:08 -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=@redhat.com header.s=mimecast20190719 header.b="cQT5/15c"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229605AbiHJAqK (ORCPT + 99 others); Tue, 9 Aug 2022 20:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiHJAqE (ORCPT ); Tue, 9 Aug 2022 20:46:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB0744B4A1 for ; Tue, 9 Aug 2022 17:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660092362; h=from:from:reply-to: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=S/MAn6qAg/Jsbs3sbj308t0Whag8V+DOtIapBcO490g=; b=cQT5/15cBRTpOXh1mAcAaGFp0rqhbVzfa/MWJnIReUgMTL5xT35SFdJ7bn8qCg3ecoVY/j 0kgBVAui1hFMKiC1C9apJE+2rEQ8i5HxrT5hD2zT1k9SvgKYlYK6rzboWSXvQTMXaHXnb4 rCuuxBJjla33riJv+W0WUBlj8GQgJOI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-XoWcY8H1PiqgLZYkjOgRSg-1; Tue, 09 Aug 2022 20:45:58 -0400 X-MC-Unique: XoWcY8H1PiqgLZYkjOgRSg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2ADD8039A1; Wed, 10 Aug 2022 00:45:57 +0000 (UTC) Received: from [10.64.54.189] (vpn2-54-189.bne.redhat.com [10.64.54.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B797492C3B; Wed, 10 Aug 2022 00:45:53 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH 2/2] KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test To: Sean Christopherson Cc: Florian Weimer , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, maz@kernel.org, oliver.upton@linux.dev, andrew.jones@linux.dev, mathieu.desnoyers@efficios.com, yihyu@redhat.com, shan.gavin@gmail.com References: <20220809060627.115847-1-gshan@redhat.com> <20220809060627.115847-3-gshan@redhat.com> <87y1vxncv1.fsf@oldenburg.str.redhat.com> <87mtcdnaxe.fsf@oldenburg.str.redhat.com> From: Gavin Shan Message-ID: <2f8f9062-3e89-7a09-02c4-ab1b2dc07356@redhat.com> Date: Wed, 10 Aug 2022 10:45:50 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 8/10/22 6:53 AM, Sean Christopherson wrote: > On Tue, Aug 09, 2022, Gavin Shan wrote: >> On 8/9/22 5:17 PM, Florian Weimer wrote: >>> * Florian Weimer: >>> >>>> * Gavin Shan: >>>> >>>>> sched_getcpu() is glibc dependent and it can simply return the CPU >>>>> ID from the registered rseq information, as Florian Weimer pointed. >>>>> In this case, it's pointless to compare the return value from >>>>> sched_getcpu() and that fetched from the registered rseq information. >>>>> >>>>> Fix the issue by replacing sched_getcpu() with getcpu(), as Florian >>>>> suggested. The comments are modified accordingly. >>>> >>>> Note that getcpu was added in glibc 2.29, so perhaps you need to perform >>>> a direct system call? >>> >>> One more thing: syscall(__NR_getcpu) also has the advantage that it >>> wouldn't have to be changed again if node IDs become available via rseq >>> and getcpu is implemented using that. >>> >>> Thanks, >>> Florian >>> >> >> Thanks, Florian. It makes sense to me to use syscall(__NR_getcpu) in >> next revision. Thanks for your quick review :) > > +1, and definitely add a comment to prevent future "cleanup". > Yep, I will have something like below in next revision: /* * We have to perform direct system call for getcpu() because it's not * available until glic 2.29. */ Thanks, Gavin