Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5664412rwb; Tue, 9 Aug 2022 01:48:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WoFaavYdMoQDGG8ttVM7XG6KxnwF/VjZH+6LHJqVjU2upx04/rqbuvE9kHMN7V/bhTPlJ X-Received: by 2002:a05:6402:1211:b0:441:f8bd:dc92 with SMTP id c17-20020a056402121100b00441f8bddc92mr332900edw.100.1660034928342; Tue, 09 Aug 2022 01:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660034928; cv=none; d=google.com; s=arc-20160816; b=K1gVm5nBfJy3Ub5VkngaPOdE553TI6xiCS++GQykFjmiJzP3mknfFJm4RE7h2CAdO7 uvyCkKcT+P59CiEWERJNDsPkffMp/MfZvz+kEd11GIIBvZCPgZ120DKf2+EYTP0qmaWS xFJRqbo5DbXiNt7ZlyTRi3ojqqXkHNU4HdTqeTckvHAhRkinu9PK9ZOv0u8gY7K2PFkr OqRPj4P7ZKxFhpCBzg9fq6h+t1fgmIhdTdD+gqWK2e1duazM9bHqcVrjfVYlNu4dtNgF Jjeaf2VhvsHZVzZYSjP1gIbI+1IbyyOxnawU2MMkjlHXatYUzfDS0F81BR2LzJF5a3TU wyCw== 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=nAOgZSsnJxT5Shsx+uHCFUsu3HJRwfqepSFOiTyCokk=; b=E87hXSL7p/Xa5YvlUuX6192GHSYZTcvEfMLwXFNm8hzVgwQxJEoxS/grIlh7pJZ8AQ SClOzjGVc5RAiYGPzOhMmFgNj0Hiw1p5n8fKLp7meHW+dEJ6k5hs7Z3XpsLNfOHcV82R SZKPBPf0+DGfa+cw16qpp/m+zYhuxiaukQ+WFOV1YGJpn+rHmWZKFq5iSAw/0O1V24hZ qmV5ULH+qL03yPcMr4x0Znv4IPJPn1nghNLKPWkWywkDWBLAz5tZzJPrFn6JMaE3uGQ2 hZSs17XV9Z3pbv/olfXjuqc42EMZOjHzt/s5uv0xMx2JPVitsKl8Wf7RFghZ7DMs09Wj mJ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JUXidU99; 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 nc42-20020a1709071c2a00b0072af2bb7c91si1758805ejc.139.2022.08.09.01.48.13; Tue, 09 Aug 2022 01:48:48 -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=JUXidU99; 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 S236937AbiHIIqx (ORCPT + 99 others); Tue, 9 Aug 2022 04:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiHIIqw (ORCPT ); Tue, 9 Aug 2022 04:46:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC75760D2 for ; Tue, 9 Aug 2022 01:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660034810; 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=nAOgZSsnJxT5Shsx+uHCFUsu3HJRwfqepSFOiTyCokk=; b=JUXidU99wJ9iSCxOXnRTi8KDTF+v8U+B3baVVWQaFWiCzJPm2A9c8ZSm5RplIKb2g73wpx FunSfwh0H2tv5oeuH57XSk8iFHHpTmogfEzU4L00ABgoAuxAZn2sC5akBKZNPBgcYnbV9S k9YpHnXpf9ASAMTUeRTf8kCrMpGRU50= 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-140-nNTpUUHVOM2aBTwNReifeQ-1; Tue, 09 Aug 2022 04:46:47 -0400 X-MC-Unique: nNTpUUHVOM2aBTwNReifeQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C61E1824605; Tue, 9 Aug 2022 08:46:47 +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 E34F9145BA44; Tue, 9 Aug 2022 08:46:42 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH 2/2] KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test To: Florian Weimer Cc: 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, seanjc@google.com, 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: Date: Tue, 9 Aug 2022 18:46:39 +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: <87mtcdnaxe.fsf@oldenburg.str.redhat.com> 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.7 X-Spam-Status: No, score=-2.7 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_NONE,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/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 :) I would hold for one or two days to post v2, to see if others have more comments. Thanks, Gavin