Message ID | 166732386464.9827.16622091938453285710.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3107857wru; Tue, 1 Nov 2022 10:36:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R4st+XF2uwPQ4UASyyJcjc71C2hT4jyLXPzn/yzj6MGPlVW5M3ny5NygqhttY59JsVUD0 X-Received: by 2002:a17:902:a502:b0:186:aed2:f69d with SMTP id s2-20020a170902a50200b00186aed2f69dmr20811126plq.46.1667324187215; Tue, 01 Nov 2022 10:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667324187; cv=none; d=google.com; s=arc-20160816; b=wl2dfmzkaIxFQDF6lKYQUqpHKP27HJn46MlzOyAMybg7KkIlLioZuBSvPCggrY28Em lBaTtACP9DE/WN2Z4wi81mxQOpA+k0CLEHsc38puCp/MmAoa0XHbn8hcrWnkfvbzZycL wI2idKaLlXi+UdC6crbj8OpxnvhKiLA8xSMN38bNFGlX63bXmXpYqwFb/fXFJuljqRyh MAaRcZmcx1CvR6I8KGPAxghGIxjlEIsotEmRYLfM0aW4uzu28Fn++u3fxjGLns02EMmL VIaTaYQ3kQp95zFePX5W/nPVobLnGymW2jauR+z9P6SLgwR1FNHCrF6jjIcwbuvxv1UU QPbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:from:subject :dkim-signature:dkim-filter; bh=VzS0zv6W20Ej0nTKmhHcYF4peM529wVUYDvHRYTK7Zc=; b=S7DEzKDA4pgTX1+ORrgXeYEJNrrBMCZf8RULcmUhEvWI7d104CPdLdaHN2+EttYelp 6SK+A+J8aRpYCQlcIZ8E6bgPGL9KW/K+L5tanz2jYV8SocfqV5Zk2MTEmo46e3Z9nnOr WcVmRZ0MApza7mUgAN5N29a7qp9xKj/iS85JKiF6g+ft2lTxqRPOGfQPNufYMRp4nrS5 EmU2MZBQZVdYoNSb9FvjfdxiHBNSOMYTBjeYVOr8FvDvxWt98tNKXOHLoOSbporgd7PO MrPhRzZKreuGwWYXwBr1fSBprZs7lkYo3FdKiD3P6yt7m28/Ho7fHkZ4luRK6DCU69kI Ve7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=OyhwJotS; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090322c700b0016dc27fb9fbsi15230243plg.117.2022.11.01.10.36.12; Tue, 01 Nov 2022 10:36:27 -0700 (PDT) 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=@linux.microsoft.com header.s=default header.b=OyhwJotS; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbiKARbI (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 1 Nov 2022 13:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiKARbF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Nov 2022 13:31:05 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F0C1B1C12E; Tue, 1 Nov 2022 10:31:04 -0700 (PDT) Received: from skinsburskii-cloud-desktop.internal.cloudapp.net (unknown [20.120.152.163]) by linux.microsoft.com (Postfix) with ESMTPSA id BA3F720B929F; Tue, 1 Nov 2022 10:31:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BA3F720B929F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1667323864; bh=VzS0zv6W20Ej0nTKmhHcYF4peM529wVUYDvHRYTK7Zc=; h=Subject:From:Cc:Date:In-Reply-To:References:From; b=OyhwJotSpjmdF+Oolz000h3Z0kXNjN6e/hid2wcKbrphgqXY6so+O9uyRXTZvDsHk bz4agA5yLzbTOoB5abTL+ykPmlkTgFOYZRIo+MNGwnatX9ygaMEXpsdltXiTK2IJO+ 7VnnAPds0Vrvx7hWsYI/94joKNq4piiP0uOjusvQ= Subject: [PATCH 1/4] drivers/clocksource/hyper-v: Introduce a pointer to TSC page From: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Cc: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>, "K. Y. Srinivasan" <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 01 Nov 2022 17:31:04 +0000 Message-ID: <166732386464.9827.16622091938453285710.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net> In-Reply-To: <166732356767.9827.4925884794177179249.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net> References: <166732356767.9827.4925884794177179249.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,MISSING_HEADERS, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748316127108871044?= X-GMAIL-MSGID: =?utf-8?q?1748316127108871044?= |
Series |
hyper-v: Introduce TSC page for root partition
|
|
Commit Message
Stanislav Kinsburskii
Nov. 1, 2022, 5:31 p.m. UTC
From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com> Will be used later keep the address of the remapped page for the root partition. Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com> CC: "K. Y. Srinivasan" <kys@microsoft.com> CC: Haiyang Zhang <haiyangz@microsoft.com> CC: Wei Liu <wei.liu@kernel.org> CC: Dexuan Cui <decui@microsoft.com> CC: Daniel Lezcano <daniel.lezcano@linaro.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: linux-hyperv@vger.kernel.org CC: linux-kernel@vger.kernel.org --- drivers/clocksource/hyperv_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Comments
From: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Sent: Tuesday, November 1, 2022 10:31 AM > > Will be used later keep the address of the remapped page for the root > partition. s/later keep/later to keep/ I'd like to see a more robust commit message, and not a partial sentence that is a continuation of the commit title. Something along the lines of: When Linux is running in the root partition of the Microsoft Hypervisor, the memory for the TSC page is provided by the hypervisor, so the TSC page address can't be the address of a Linux global variable. Introduce a global variable to contain the TSC page address. For a guest VM, it defaults to the address of the Linux global variable. If running in the root partition, a later patch overrides to be the address of the page provided by the hypervisor. > > Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com> > CC: "K. Y. Srinivasan" <kys@microsoft.com> > CC: Haiyang Zhang <haiyangz@microsoft.com> > CC: Wei Liu <wei.liu@kernel.org> > CC: Dexuan Cui <decui@microsoft.com> > CC: Daniel Lezcano <daniel.lezcano@linaro.org> > CC: Thomas Gleixner <tglx@linutronix.de> > CC: linux-hyperv@vger.kernel.org > CC: linux-kernel@vger.kernel.org > --- > drivers/clocksource/hyperv_timer.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index 11332c82d1af..c4dbf40a3d3e 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -366,9 +366,11 @@ static union { > u8 reserved[PAGE_SIZE]; > } tsc_pg __aligned(PAGE_SIZE); > > +static struct ms_hyperv_tsc_page *tsc_page = &tsc_pg.page; > + > struct ms_hyperv_tsc_page *hv_get_tsc_page(void) > { > - return &tsc_pg.page; > + return tsc_page; > } > EXPORT_SYMBOL_GPL(hv_get_tsc_page); > > @@ -406,7 +408,7 @@ static void suspend_hv_clock_tsc(struct clocksource *arg) > > static void resume_hv_clock_tsc(struct clocksource *arg) > { > - phys_addr_t phys_addr = virt_to_phys(&tsc_pg); > + phys_addr_t phys_addr = virt_to_phys(tsc_page); > union hv_reference_tsc_msr tsc_msr; > > /* Re-enable the TSC page */ >
From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com> Sent: Wednesday, November 2, 2022 12:19 PM > ср, 2 нояб. 2022 г. в 11:56, Michael Kelley (LINUX) <mailto:mikelley@microsoft.com>: > From: Stanislav Kinsburskii <mailto:skinsburskii@linux.microsoft.com> Sent: Tuesday, November 1, 2022 10:31 AM > > > > > > Will be used later keep the address of the remapped page for the root > > > partition. > > > > s/later keep/later to keep/ > > I'll fix it, thanks. > > > I'd like to see a more robust commit message, and not a partial > > sentence that is a continuation of the commit title. Something along the lines of: > > > > When Linux is running in the root partition of the Microsoft Hypervisor, > > the memory for the TSC page is provided by the hypervisor, so the TSC > > page address can't be the address of a Linux global variable. > > > > Introduce a global variable to contain the TSC page address. For a guest VM, > > it defaults to the address of the Linux global variable. If running in the root > > partition, a later patch overrides to be the address of the page provided by > > the hypervisor. > > This is a cleanup patch whose goal is to provide a clear separation between the > actual feature (which comes in the last patch of the series) and other precursor > changes, making the feature introduction more laconic and clean. > > I doubt it needs any additional text to expose the details of the resulting goal. > Why do you think otherwise? To me, the additional text clearly answers the "why" question for the patch. Here's the quote from Documentation/process/submitting-patches.rst: The explanation body will be committed to the permanent source changelog, so should make sense to a competent reader who has long since forgotten the immediate details of the discussion that might have led to this patch. Including symptoms of the failure which the patch addresses (kernel log messages, oops messages, etc.) are especially useful for people who might be searching the commit logs looking for the applicable patch. The text should be written in such detail so that when read weeks, months or even years later, it can give the reader the needed details to grasp the reasoning for **why** the patch was created. Certainly, it's somewhat a matter of personal style, and I tend to lean toward the "more explanation is better" approach. But if no one else cares to weigh in on the topic, it's not a blocker for me. Michael
diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 11332c82d1af..c4dbf40a3d3e 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -366,9 +366,11 @@ static union { u8 reserved[PAGE_SIZE]; } tsc_pg __aligned(PAGE_SIZE); +static struct ms_hyperv_tsc_page *tsc_page = &tsc_pg.page; + struct ms_hyperv_tsc_page *hv_get_tsc_page(void) { - return &tsc_pg.page; + return tsc_page; } EXPORT_SYMBOL_GPL(hv_get_tsc_page); @@ -406,7 +408,7 @@ static void suspend_hv_clock_tsc(struct clocksource *arg) static void resume_hv_clock_tsc(struct clocksource *arg) { - phys_addr_t phys_addr = virt_to_phys(&tsc_pg); + phys_addr_t phys_addr = virt_to_phys(tsc_page); union hv_reference_tsc_msr tsc_msr; /* Re-enable the TSC page */