Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4285345rwb; Sun, 13 Nov 2022 03:01:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6wAnwQW9b2o35w1IPoWRLNS+UA3iD/e33gCn79GtSqMyPbeHocIKw7PYmy9EUb0vrGDLdC X-Received: by 2002:aa7:d697:0:b0:461:dbcc:5176 with SMTP id d23-20020aa7d697000000b00461dbcc5176mr7782082edr.53.1668337273330; Sun, 13 Nov 2022 03:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668337273; cv=none; d=google.com; s=arc-20160816; b=rIf5oZ4Ah5QYFfXeJcVv0DY4USwFf3OSaK34gXzw7v/y4BALfJp/IZde73YEqQUg+C du3ePZ8eQjmPvOdoEU16bfAe4E8a+CG1YoafODEB9EqeqhegtFdQ6ojF6uacIRYB3Jk7 /PWeDcbejDAJ1PB1CrXguB502/B3R/YSI+9v+gd/S5Kyy4+AFTpadWxUiGHRnumNjNvS 3I1v6eZ0+DWjGWWmgFI8Fjaz+ifWbcw29JCb1tHWhOnI0fJGU8p33U+1vuT0FLUR7D20 CaRSGKSFaOZQB5zCxiXP46PUKwxHaxLEfrxuYpUd6cIVOunxqp7a9ppv+c9X4N5fml4h Nzsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=q4TqLSWP6GWKj5YwSytFV7lzD/9wH9qk82DCLCDjI7Q=; b=JkBNfw0/w3ho4uLm/DxNxI0eat8C8FLlnAoXXiaSX5Pui/noQIKMxl252RQKqM5N2R a1q/dnEB6Xf+3jMNlo2D7mswzyVhLTG0zno1D4dvxnjiXvrLR7gxGZNPVZTtcTsKWLTL oWNTbF2kv5pdm3rSw98ZNAPRU2oj3gCOZxuUcDmfQm3WPL46Nzfhxfn1yAHT/L3mfafe hMMgnjdNqDr0fG6SbFIEQE7woGmjrX239AN4AXhgMhQFhJF1oT+e0GRJK/rkOUd6O2HA k70AEDIm5qdN5Ab/b/80qmWY1UImM1VXBjvE7BvMUzYy+TG5tkSDlsdaF7zHRSamkFV9 8hAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZnXT97iJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Jg9ICAyA; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a1709064c8f00b0078d550c0272si5533545eju.269.2022.11.13.03.00.51; Sun, 13 Nov 2022 03:01:13 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=ZnXT97iJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Jg9ICAyA; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235297AbiKMKdQ (ORCPT + 89 others); Sun, 13 Nov 2022 05:33:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233196AbiKMKdO (ORCPT ); Sun, 13 Nov 2022 05:33:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485F81209B; Sun, 13 Nov 2022 02:33:13 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668335590; 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=q4TqLSWP6GWKj5YwSytFV7lzD/9wH9qk82DCLCDjI7Q=; b=ZnXT97iJfkNsEAAdWyucQS4HWpNkyk+pZRyodnTMIoiABjz3mwOMocaEanITRKUp6C/Oii 5OZVRp50cA9f84obyPGGqe/P21+jj+08WSCem1j2ZUVo7Qvq238VvbpA37ThNy+GHbR5zd DIm+FAw9T3mPAtngkhOnIsh2gltITOu33qFs9WLo1YPhHvTrYbHURKxyNzAmhQK8pUeIJw Hc3j+47noND8f7zqpUwDo0eIuZcpNbzwseT0R99Urap0qPFXFXOqncd6uaBpb9eY5LFID/ f+7sf1jTR/HOKJ4VtVgzZYCpFc0fmwLDywYUuhC6Xw2zGCkYMv3kx2OGThmLxA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668335590; 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=q4TqLSWP6GWKj5YwSytFV7lzD/9wH9qk82DCLCDjI7Q=; b=Jg9ICAyAxld4U1RxmjJXzsfgkRRnn6sFA/bzzHTHGYNCKu4bmegdakXqbLFkBVRGhnXqVR LBGFAakdXwqYtgAg== To: "Michael Kelley (LINUX)" , LKML Cc: "linux-hyperv@vger.kernel.org" , Haiyang Zhang , Wei Liu , Dexuan Cui , Andy Lutomirski , Vincenzo Frascino , Daniel Lezcano Subject: RE: [PATCH] clocksource/drivers/hyper-v: Include asm/hyperv-tlfs.h not asm/mshyperv.h In-Reply-To: <87wn7ztc89.ffs@tglx> References: <87zgcwt2qg.ffs@tglx> <87wn7ztc89.ffs@tglx> Date: Sun, 13 Nov 2022 11:33:09 +0100 Message-ID: <87sfinta8q.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 On Sun, Nov 13 2022 at 10:50, Thomas Gleixner wrote: > On Sat, Nov 12 2022 at 21:55, Michael Kelley wrote: >> But I can see the problem with too much getting dragged into the VDSO >> builds. If hv_get_raw_timer() is added to hyperv_timer.h, it should >> be under #ifdef CONFIG_X86. Adding an #ifdef isn't ideal, and a more >> more proper solution might be to have a separate hyperv_timer.h include >> file under arch/x86/include/asm. But the latter seems like overkill for just >> hv_get_raw_timer(), so I'm OK with the #ifdef. > > We surely can have asm/hyperv_timer.h but TBH: > >>> static inline notrace u64 >>> hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, u64 *cur_tsc) >>> { > > hv_read_tsc_page_tsc() does not look architecture agnostic either. TSC > is pretty x86 specific :) Though the below makes sense on its own because it ensures that msr.h is included, which is required for making clocksource/hyperv_timer.h self contained. Thanks, tglx --- Subject: clocksource/drivers/hyper-v: Include asm/hyperv-tlfs.h not asm/mshyperv.h From: Thomas Gleixner Date: Sat, 12 Nov 2022 19:08:15 +0100 clocksource/hyperv_timer.h is included into the VDSO build. It includes asm/mshyperv.h which in turn includes the world and some more. This worked so far by chance, but any subtle change in the include chain results in a build breakage because VDSO builds are building user space libraries. Include asm/hyperv-tlfs.h instead which contains everything what the VDSO build needs and move the hv_get_raw_timer() define into a separate header file which also includes asm/msr.h to resolve rdtsc_ordered(). Fixup drivers/hv/vmbus_drv.c which relies on the indirect include of asm/mshyperv.h. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/hyperv_timer.h | 9 +++++++++ arch/x86/include/asm/mshyperv.h | 2 -- drivers/hv/vmbus_drv.c | 1 + include/clocksource/hyperv_timer.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) --- /dev/null +++ b/arch/x86/include/asm/hyperv_timer.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_HYPERV_TIMER_H +#define _ASM_X86_HYPERV_TIMER_H + +#include + +#define hv_get_raw_timer() rdtsc_ordered() + +#endif --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -19,8 +19,6 @@ typedef int (*hyperv_fill_flush_list_fun struct hv_guest_mapping_flush_list *flush, void *data); -#define hv_get_raw_timer() rdtsc_ordered() - void hyperv_vector_handler(struct pt_regs *regs); #if IS_ENABLED(CONFIG_HYPERV) --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "hyperv_vmbus.h" struct vmbus_dynid { --- a/include/clocksource/hyperv_timer.h +++ b/include/clocksource/hyperv_timer.h @@ -15,7 +15,7 @@ #include #include -#include +#include #define HV_MAX_MAX_DELTA_TICKS 0xffffffff #define HV_MIN_DELTA_TICKS 1