Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5611177rwb; Tue, 9 Aug 2022 00:32:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR7AzAboIRP1DB6yzxzTuUKCSM3YK61VMGstSHcF6xMpeyD/b9pTIBcA0ONin+dw2tTma2Gk X-Received: by 2002:a17:902:ce05:b0:16b:e725:6f6c with SMTP id k5-20020a170902ce0500b0016be7256f6cmr22514288plg.110.1660030351289; Tue, 09 Aug 2022 00:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660030351; cv=none; d=google.com; s=arc-20160816; b=mA5JXOfczJiPwhdy6dqtoLVAI1G8tut3/WuX8/0CxY0cbA5vQODbwZZK2/5oRqMdwu U/66E50JwQqThFehL38yGWwelw4sL8gotHQrtQQh22s0XU56GrbxuaTX9d2UtWhIPTzH l8RpwABjP9Vgdl0P2+sov1eBC8oeAyQ9roamCXBAuhZnhKRSSlg4DXbergrPqVpQ5/lV PtATc5B1Y7ZN1uT3Cs04fkP9k59zBZKm2qmLdI+pPRcTufLiJs+ltEKHzS2/lkRz97U3 M2xcCJZZ3kNfRYFSt+ZSC93Jgp4hdedqADk8PwfDBg3xAETrO2C+mnfZan1DgLmabysh bidg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=guDnNs6GIE6VYYfJC3LF3y7xxWcKYPW4yEpvV6OunCc=; b=bjfIidq+YENiGoKXWMM9QwHLVT4uozhYehoYER0FaGYZPxTQnLKpAWnZsrrvCbOHuc qsboFWlS34BsGsJA8LvtsEMdpAQkrfpnvqOh1ABWJkQQDvGl2cWyjKkKrmHmUmSzBwGD xTaP2h4yZ/9Ot8I8YMiQHi6rVAe3/CdPumW7PAfFjZCWa8bqws+qs0Ahu+UgeGXvtbrd HX2r0VqYI9Y7FWQZx8TIOv5Min/V9FtVBTKmfQW/BftycfTTS5ArSnY2mHAi+cWydwkt me9CGKU4CvzABtw678AD0dYJ9c90SL3fyc+nfcVnXLlUIzCZ0YhSUlWqp93X6c8Lrqxm BNLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Uzge/ge+"; 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 s22-20020a639256000000b00419b27d0a83si13004569pgn.476.2022.08.09.00.32.16; Tue, 09 Aug 2022 00:32:31 -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="Uzge/ge+"; 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 S238932AbiHIHRe (ORCPT + 99 others); Tue, 9 Aug 2022 03:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239160AbiHIHRX (ORCPT ); Tue, 9 Aug 2022 03:17:23 -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 BC2F520F40 for ; Tue, 9 Aug 2022 00:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660029429; 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: in-reply-to:in-reply-to:references:references; bh=guDnNs6GIE6VYYfJC3LF3y7xxWcKYPW4yEpvV6OunCc=; b=Uzge/ge+X0ejmtO2lCx2cXDzyYvS6yDyRoS2otdWKsQ6J9gi6ypMnD2ukpD8IU/cOFAgS5 JliaVV+OMn7TO9ALpq8QDYiQVH0UhOyu3IAvoAOL42X36CgR3LrPqwYSQSz3H0ra2Gb39U DCsLUpQc3fseFjwCWWG+z/HNlSGbmNM= 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-135-I1YrsPXbNI-JfbNgRuspjg-1; Tue, 09 Aug 2022 03:17:06 -0400 X-MC-Unique: I1YrsPXbNI-JfbNgRuspjg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE1AA1019C8E; Tue, 9 Aug 2022 07:17:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D89D9945D0; Tue, 9 Aug 2022 07:17:02 +0000 (UTC) From: Florian Weimer To: Gavin Shan 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 Subject: Re: [PATCH 2/2] KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test References: <20220809060627.115847-1-gshan@redhat.com> <20220809060627.115847-3-gshan@redhat.com> <87y1vxncv1.fsf@oldenburg.str.redhat.com> Date: Tue, 09 Aug 2022 09:17:01 +0200 In-Reply-To: <87y1vxncv1.fsf@oldenburg.str.redhat.com> (Florian Weimer's message of "Tue, 09 Aug 2022 08:35:14 +0200") Message-ID: <87mtcdnaxe.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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,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 * 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