xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Borislav Petkov <bp@alien8.de>
Cc: xen-devel@lists.xenproject.org, x86@kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	kvm@vger.kernel.org, Deep Shah <sdeep@vmware.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v6 02/12] x86/paravirt: switch time pvops functions to use static_call()
Date: Wed, 10 Mar 2021 08:51:22 +0100	[thread overview]
Message-ID: <e06cc359-6300-a26b-c307-9ef8d963b0c1@suse.com> (raw)
In-Reply-To: <20210309185737.GE699@zn.tnic>


[-- Attachment #1.1.1: Type: text/plain, Size: 1571 bytes --]

On 09.03.21 19:57, Borislav Petkov wrote:
> On Tue, Mar 09, 2021 at 02:48:03PM +0100, Juergen Gross wrote:
>> @@ -167,6 +168,17 @@ static u64 native_steal_clock(int cpu)
>>   	return 0;
>>   }
>>   
>> +DEFINE_STATIC_CALL(pv_steal_clock, native_steal_clock);
>> +DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock);
>> +
>> +bool paravirt_using_native_sched_clock = true;
>> +
>> +void paravirt_set_sched_clock(u64 (*func)(void))
>> +{
>> +	static_call_update(pv_sched_clock, func);
>> +	paravirt_using_native_sched_clock = (func == native_sched_clock);
>> +}
> 
> What's the point of this function if there's a global
> paravirt_using_native_sched_clock variable now?

It is combining the two needed actions: update the static call and
set the paravirt_using_native_sched_clock boolean.

> Looking how the bit of information whether native_sched_clock is used,
> is needed in tsc.c, it probably would be cleaner if you add a
> 
> set_sched_clock_native(void);
> 
> or so, to tsc.c instead and call that here and make that long var name a
> a shorter and static one in tsc.c instead.

I need to transfer a boolean value, so it would need to be

set_sched_clock_native(bool state);

In the end the difference is only marginal IMO.

Just had another idea: I could add a function to static_call.h for
querying the current function. This would avoid the double book keeping
and could probably be used later when switching other pv_ops calls to
static_call, too (e.g. pv_is_native_spin_unlock()).

What do you think?


Juergen

[-- Attachment #1.1.2: OpenPGP_0xB0DE9DD628BF132F.asc --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2021-03-10  7:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 13:48 [PATCH v6 00/12] x86: major paravirt cleanup Juergen Gross
2021-03-09 13:48 ` [PATCH v6 01/12] static_call: move struct static_call_key definition to static_call_types.h Juergen Gross
2021-03-09 13:48 ` [PATCH v6 02/12] x86/paravirt: switch time pvops functions to use static_call() Juergen Gross
2021-03-09 18:57   ` Borislav Petkov
2021-03-10  7:51     ` Jürgen Groß [this message]
2021-03-10 14:13       ` Borislav Petkov
2021-03-09 13:48 ` [PATCH v6 03/12] x86/alternative: drop feature parameter from ALTINSTR_REPLACEMENT() Juergen Gross
2021-03-09 13:48 ` [PATCH v6 04/12] x86/alternative: support not-feature Juergen Gross
2021-03-10  6:07   ` Borislav Petkov
2021-03-10  7:52     ` Jürgen Groß
2021-03-10 14:15       ` Borislav Petkov
2021-03-10 14:41         ` Jürgen Groß
2021-03-09 13:48 ` [PATCH v6 05/12] x86/alternative: support ALTERNATIVE_TERNARY Juergen Gross
2021-03-10 14:27   ` Borislav Petkov
2021-03-10 14:42     ` Jürgen Groß
2021-03-09 13:48 ` [PATCH v6 06/12] x86: add new features for paravirt patching Juergen Gross
2021-03-09 13:48 ` [PATCH v6 07/12] x86/paravirt: remove no longer needed 32-bit pvops cruft Juergen Gross
2021-03-09 13:48 ` [PATCH v6 08/12] x86/paravirt: simplify paravirt macros Juergen Gross
2021-03-09 13:48 ` [PATCH v6 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE Juergen Gross
2021-03-09 13:48 ` [PATCH v6 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs Juergen Gross
2021-03-09 13:48 ` [PATCH v6 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE Juergen Gross
2021-03-09 13:48 ` [PATCH v6 12/12] x86/paravirt: have only one paravirt patch function Juergen Gross
2021-03-09 16:06 ` [PATCH v6 13/12] x86/alternative: merge include files Juergen Gross
2021-03-09 16:06   ` [PATCH v6 14/12] x86/alternative: don't open code ALTERNATIVE_TERNARY() in _static_cpu_has() Juergen Gross
2021-03-11 12:50 ` [PATCH v6 00/12] x86: major paravirt cleanup Borislav Petkov
2021-03-11 12:51   ` Borislav Petkov
2021-03-11 13:09     ` Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e06cc359-6300-a26b-c307-9ef8d963b0c1@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pv-drivers@vmware.com \
    --cc=sdeep@vmware.com \
    --cc=seanjc@google.com \
    --cc=sstabellini@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).