lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 10 Mar 2021 08:51:22 +0100
From:   Jürgen Groß <jgross@...e.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     xen-devel@...ts.xenproject.org, x86@...nel.org,
        virtualization@...ts.linux-foundation.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-hyperv@...r.kernel.org, kvm@...r.kernel.org,
        Deep Shah <sdeep@...are.com>,
        "VMware, Inc." <pv-drivers@...are.com>,
        Russell King <linux@...linux.org.uk>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v6 02/12] x86/paravirt: switch time pvops functions to use
 static_call()

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

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3092 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ