[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f8f9062-3e89-7a09-02c4-ab1b2dc07356@redhat.com>
Date: Wed, 10 Aug 2022 10:45:50 +1000
From: Gavin Shan <gshan@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Florian Weimer <fweimer@...hat.com>, kvmarm@...ts.cs.columbia.edu,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, pbonzini@...hat.com, maz@...nel.org,
oliver.upton@...ux.dev, andrew.jones@...ux.dev,
mathieu.desnoyers@...icios.com, yihyu@...hat.com,
shan.gavin@...il.com
Subject: Re: [PATCH 2/2] KVM: selftests: Use getcpu() instead of
sched_getcpu() in rseq_test
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
Powered by blists - more mailing lists