Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp382241ybr; Fri, 22 May 2020 08:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpXeUrFfL/kopnm8cQgZwacBMTpjV3Yq7y6WZzmvEGPrSs8Nu4KdQojBiRR8CfsFn+3eFC X-Received: by 2002:a17:907:217b:: with SMTP id rl27mr9104252ejb.291.1590162602240; Fri, 22 May 2020 08:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590162602; cv=none; d=google.com; s=arc-20160816; b=H7UZ7Pq0wyYjw9obnZg8QDBiIq2yi7JJDziI0qKi+lETIzipLtarGuXbTvie7RLISS eWKshxxcbJN4Rvg5T2m+JdIzQqi6Vj2B88UXovs4B3mrP3qU1LOMcIdsgbo/K88dtYLf YlI1Ck4f8A8ay3D7vb3c1NRH2bWXBx9SCRQpKA62E7y7L2FYyDGVTHUGtYZ41N6pETTp AoQF40Fz7tYW9EJyxjHVS2TyLnS3TbPi/S2jSlHGjSSl9f6x0n4EW8UuBv8NZe0DAewA EPn6ZeTZdlpa8AkSaovnJsRvqb179zhnCNCwoCfTtifbX7nQIA8ww3f8+kilxt+bwJMN bUyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=MXQFxy606OgBuB3i8SfQI+Jf/LH1AnPpk41ejsc20xs=; b=ufbdxLfYx4FR/1h4RrXHaMCS34qK1ZweMUs8zOjysJCnnoaOUAjUaLWo2taXhbAZjh K9/QW0vACoZvQ8vywQR5BbhZAW53c2Y7tuTpAlM3/eikwWU2jjWVCQDxO1pEHKS8O+5v uECv38CIgZSyfu27FaPm6PDpcdKP6Ac2hId27ja89I5HMOGHEz+40gUgumz6v1okG3ie kUqzlgdgFzc7ILKoFJTByA3gELkx1/DlJNhZcrsWggLSnFnXtPiGNlfbF/XvdEaYWngD xgNByya0zak26N+Qrvr2S9UcFZiFgGQT9f2QY+BC7uHKEvzSdF+HhnFQppZwpJ69QmGN y/nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eOC5H7vV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si4781568edt.104.2020.05.22.08.49.39; Fri, 22 May 2020 08:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eOC5H7vV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730362AbgEVPsQ (ORCPT + 99 others); Fri, 22 May 2020 11:48:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:59268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbgEVPsP (ORCPT ); Fri, 22 May 2020 11:48:15 -0400 Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91E1C206F6; Fri, 22 May 2020 15:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590162494; bh=hAQh+NskLuVas6SAuRdAcPjU7GA2DWYYhA+A9VY0zBU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=eOC5H7vVEa2M+vp6cbRe2Pb+9Dv953vdlFrSwjihC5x9/IT/+QJQeDtz2AiIAolcQ jwxd03pdoctenKXXmEN9pucdQfBzAx6ipQOFoDJDxZ8w7UP+trNvSBI9xZidcGb4/6 Rc+nVj76Y3vVE799v3t7KwW9n6hKFVYUeR4a/FwM= Subject: Re: [PATCH v2 2/3] selftests: vdso: Use a header file to prototype parse_vdso API To: Mark Brown Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah , Shuah Khan References: <20200521203707.37304-1-broonie@kernel.org> <20200521203707.37304-3-broonie@kernel.org> From: shuah Message-ID: <3948bdcc-0d6a-836c-f935-65ce1e914537@kernel.org> Date: Fri, 22 May 2020 09:48:13 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200521203707.37304-3-broonie@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/21/20 2:37 PM, Mark Brown wrote: > Both vdso_test_gettimeofday and vdso_standalone_test_x86 use the library in > parse_vdso.c but each separately declares the API it offers which is not > ideal. Create a header file with prototypes of the functions and use it in > both the library and the tests to ensure that the same prototypes are used > throughout. > > Signed-off-by: Mark Brown > --- > tools/testing/selftests/vDSO/parse_vdso.c | 24 +------------- > tools/testing/selftests/vDSO/parse_vdso.h | 31 +++++++++++++++++++ > .../selftests/vDSO/vdso_standalone_test_x86.c | 4 +-- > .../selftests/vDSO/vdso_test_gettimeofday.c | 5 +-- > 4 files changed, 34 insertions(+), 30 deletions(-) > create mode 100644 tools/testing/selftests/vDSO/parse_vdso.h > > diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c > index 1dbb4b87268f..413f75620a35 100644 > --- a/tools/testing/selftests/vDSO/parse_vdso.c > +++ b/tools/testing/selftests/vDSO/parse_vdso.c > @@ -21,29 +21,7 @@ > #include > #include > > -/* > - * To use this vDSO parser, first call one of the vdso_init_* functions. > - * If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR > - * to vdso_init_from_sysinfo_ehdr. Otherwise pass auxv to vdso_init_from_auxv. > - * Then call vdso_sym for each symbol you want. For example, to look up > - * gettimeofday on x86_64, use: > - * > - * = vdso_sym("LINUX_2.6", "gettimeofday"); > - * or > - * = vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); > - * > - * vdso_sym will return 0 if the symbol doesn't exist or if the init function > - * failed or was not called. vdso_sym is a little slow, so its return value > - * should be cached. > - * > - * vdso_sym is threadsafe; the init functions are not. > - * > - * These are the prototypes: > - */ > -extern void vdso_init_from_auxv(void *auxv); > -extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); > -extern void *vdso_sym(const char *version, const char *name); > - > +#include "parse_vdso.h" > > /* And here's the code. */ > #ifndef ELF_BITS > diff --git a/tools/testing/selftests/vDSO/parse_vdso.h b/tools/testing/selftests/vDSO/parse_vdso.h > new file mode 100644 > index 000000000000..ea4b8635bb0b > --- /dev/null > +++ b/tools/testing/selftests/vDSO/parse_vdso.h > @@ -0,0 +1,31 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > + > +#ifndef PARSE_VDSO_H > +#define PARSE_VDSO_H > + > +#include > + > +/* > + * To use this vDSO parser, first call one of the vdso_init_* functions. > + * If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR > + * to vdso_init_from_sysinfo_ehdr. Otherwise pass auxv to vdso_init_from_auxv. > + * Then call vdso_sym for each symbol you want. For example, to look up > + * gettimeofday on x86_64, use: > + * > + * = vdso_sym("LINUX_2.6", "gettimeofday"); > + * or > + * = vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); > + * > + * vdso_sym will return 0 if the symbol doesn't exist or if the init function > + * failed or was not called. vdso_sym is a little slow, so its return value > + * should be cached. > + * > + * vdso_sym is threadsafe; the init functions are not. > + * > + * These are the prototypes: > + */ > +extern void *vdso_sym(const char *version, const char *name); > +extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); > +extern void vdso_init_from_auxv(void *auxv); > + Please remove these externs. I understand it is must a move. Might as well clean this up. Send me v3 for just this one. thanks, -- Shuah