Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1867126ybh; Fri, 13 Mar 2020 08:46:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsVL/beKdu7FZtDnzBCdC9qyx5z+mETwH7fiEHSZMVMEoJRauDMuST/Ep6lXbD+DKacY7aP X-Received: by 2002:a9d:5a8a:: with SMTP id w10mr11600732oth.200.1584114380110; Fri, 13 Mar 2020 08:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584114380; cv=none; d=google.com; s=arc-20160816; b=jHInaoOHw0tbQIGyHAT092rIAZOkndCXPvKQykAaybdPVSAhhQF0YRTFQKPkSNPLPn 5scxwGkCSEit6znxrN4HD/euuobU0ZEdrHdbHEbQ8U9/xWgEcPDYh0GoPO4ysY5r2Xzd H7gwarZnOznpWCDea7hUsRvnfc4vvDKwVB2A2yVE0qDbUpVNnygz4YqbSaywKWL9eu5W 8PhDECxc0pd+jfJRsIbSEz6XX5G5SXiIcWgnSiv4ZhPyrV9FwDdNV/U4NeZhYGRPSb0h taHoNYL8ELVTQUB6FdpWLrLkj1880o8cElRykg5k3G910S3HqFp3aauV99voFv9AvMeL t1SA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=71NAkNuIu1yTvrgCRPIIOYYKdkGiGzpa/QYfQ9kxf4g=; b=rloYJCvIk1MU66NKLaqV+9N1NkdHEeqUw+VSGPA9ljwsDlyl6xO2/p3Nv8siF59dYn bLem0nAfRcqYa8FtRef+sxzYlagXiKU1W+4rxP1dS44wy0NRRCTP4rk4zX5nAJlJQRHO xLUXgzBOZgi7cAbiOm/Wjh+LCm3ZFtyEQz7OnDMLGwCLS1KR84mKsKJ0tTTaZ8bhtZv9 HrWCCs6BT5Qzpmyc9KApawvdqehIcxmadu/30WO2a+2PObyru+DIZbSjseUOuGFAYRLd K/MIx+wAcNw70wHP5L6bhpEzJ9/XPX7iPTRsLjx+NSC7WX3tq3hWEBzG80g0KNHQ8DaH XVAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si4651754otp.222.2020.03.13.08.46.08; Fri, 13 Mar 2020 08:46:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727470AbgCMPp1 (ORCPT + 99 others); Fri, 13 Mar 2020 11:45:27 -0400 Received: from foss.arm.com ([217.140.110.172]:59118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727448AbgCMPp0 (ORCPT ); Fri, 13 Mar 2020 11:45:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A9E31045; Fri, 13 Mar 2020 08:45:26 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 554213F67D; Fri, 13 Mar 2020 08:45:23 -0700 (PDT) From: Vincenzo Frascino To: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, clang-built-linux@googlegroups.com, x86@kernel.org Cc: Vincenzo Frascino , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Paul Burton , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Stephen Boyd , Mark Salyzyn , Kees Cook , Peter Collingbourne , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nick Desaulniers , Marc Zyngier , Mark Rutland Subject: [PATCH v3 25/26] lib: vdso: Enable common headers Date: Fri, 13 Mar 2020 15:43:44 +0000 Message-Id: <20200313154345.56760-26-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200313154345.56760-1-vincenzo.frascino@arm.com> References: <20200313154345.56760-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vDSO library should only include the necessary headers required for a userspace library (UAPI and a minimal set of kernel headers). To make this possible it is necessary to isolate from the kernel headers the common parts that are strictly necessary to build the library. Refactor the unified vdso code to use the common headers. Cc: Andy Lutomirski Cc: Thomas Gleixner Signed-off-by: Vincenzo Frascino --- include/vdso/datapage.h | 33 ++++++++++++++++++++++++++++++--- lib/vdso/gettimeofday.c | 22 ---------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index 30c4cb0428d1..5cbc9fcbfd45 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -4,9 +4,20 @@ #ifndef __ASSEMBLY__ -#include -#include -#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #define VDSO_BASES (CLOCK_TAI + 1) #define VDSO_HRES (BIT(CLOCK_REALTIME) | \ @@ -99,6 +110,22 @@ struct vdso_data { */ extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden"))); +/* + * The generic vDSO implementation requires that gettimeofday.h + * provides: + * - __arch_get_vdso_data(): to get the vdso datapage. + * - __arch_get_hw_counter(): to get the hw counter based on the + * clock_mode. + * - gettimeofday_fallback(): fallback for gettimeofday. + * - clock_gettime_fallback(): fallback for clock_gettime. + * - clock_getres_fallback(): fallback for clock_getres. + */ +#ifdef ENABLE_COMPAT_VDSO +#include +#else +#include +#endif /* ENABLE_COMPAT_VDSO */ + #endif /* !__ASSEMBLY__ */ #endif /* __VDSO_DATAPAGE_H */ diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 72d282ffd156..a2909af4b924 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -2,31 +2,9 @@ /* * Generic userspace implementations of gettimeofday() and similar. */ -#include -#include -#include -#include -#include -#include #include #include -/* - * The generic vDSO implementation requires that gettimeofday.h - * provides: - * - __arch_get_vdso_data(): to get the vdso datapage. - * - __arch_get_hw_counter(): to get the hw counter based on the - * clock_mode. - * - gettimeofday_fallback(): fallback for gettimeofday. - * - clock_gettime_fallback(): fallback for clock_gettime. - * - clock_getres_fallback(): fallback for clock_getres. - */ -#ifdef ENABLE_COMPAT_VDSO -#include -#else -#include -#endif /* ENABLE_COMPAT_VDSO */ - #ifndef vdso_calc_delta /* * Default implementation which works for all sane clocksources. That -- 2.25.1