From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933836AbdKAVZN (ORCPT ); Wed, 1 Nov 2017 17:25:13 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:60015 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933503AbdKAVYk (ORCPT ); Wed, 1 Nov 2017 17:24:40 -0400 Reply-To: shuah@kernel.org Subject: Re: [PATCH] selftests: vdso_test: support ARM64 targets To: Greg Hackmann Cc: Steve Muckle , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Shuah Khan References: <20171031212846.17301-1-ghackmann@google.com> From: Shuah Khan Message-ID: Date: Wed, 1 Nov 2017 15:24:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171031212846.17301-1-ghackmann@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On 10/31/2017 03:28 PM, Greg Hackmann wrote: > ARM64's vDSO exports its gettimeofday() implementation with a different > name (__kernel_gettimeofday) and version (LINUX_2.6.39) from other > architectures. Add a corresponding special-case to vdso_test. > > Signed-off-by: Greg Hackmann Thanks for the patch. > --- > tools/testing/selftests/vDSO/vdso_test.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c > index 8daeb7d7032c..f0f8cc59c195 100644 > --- a/tools/testing/selftests/vDSO/vdso_test.c > +++ b/tools/testing/selftests/vDSO/vdso_test.c > @@ -21,6 +21,17 @@ extern void vdso_init_from_auxv(void *auxv); > > int main(int argc, char **argv) > { > + const char *version; > + const char *name; > + > +#if defined(__aarch64__) > + version = "LINUX_2.6.39"; > + name = "__kernel_gettimeofday"; > +#else > + version = "LINUX_2.6"; > + name = "__vdso_gettimeofday"; > +#endif > + Could you move these defines up and add them before the main. It will be easier to follow the code that way. Please capture the change log description as a comment block for these defines. thanks, -- Shuah > unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); > if (!sysinfo_ehdr) { > printf("AT_SYSINFO_EHDR is not present!\n"); > @@ -31,10 +42,10 @@ int main(int argc, char **argv) > > /* Find gettimeofday. */ > typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); > - gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); > + gtod_t gtod = (gtod_t)vdso_sym(version, name); > > if (!gtod) { > - printf("Could not find __vdso_gettimeofday\n"); > + printf("Could not find %s\n", name); > return 1; > } > > @@ -45,7 +56,7 @@ int main(int argc, char **argv) > printf("The time is %lld.%06lld\n", > (long long)tv.tv_sec, (long long)tv.tv_usec); > } else { > - printf("__vdso_gettimeofday failed\n"); > + printf("%s failed\n", name); > } > > return 0; >