[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878s82ozth.fsf@mpe.ellerman.id.au>
Date: Sat, 06 Feb 2021 10:32:58 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: Nicholas Piggin <npiggin@...il.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Frederic Weisbecker <frederic@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Jordan Niethe <jniethe5@...il.com>,
Leonardo Bras <leobras.c@...il.com>,
Paul Mackerras <paulus@...abs.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: kvm-ppc@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v2 1/1] powerpc/kvm: Save Timebase Offset to fix
sched_clock() while running guest code.
Nicholas Piggin <npiggin@...il.com> writes:
> Excerpts from Leonardo Bras's message of February 5, 2021 4:06 pm:
>> Before guest entry, TBU40 register is changed to reflect guest timebase.
>> After exitting guest, the register is reverted to it's original value.
>>
>> If one tries to get the timestamp from host between those changes, it
>> will present an incorrect value.
>>
>> An example would be trying to add a tracepoint in
>> kvmppc_guest_entry_inject_int(), which depending on last tracepoint
>> acquired could actually cause the host to crash.
>>
>> Save the Timebase Offset to PACA and use it on sched_clock() to always
>> get the correct timestamp.
>
> Ouch. Not sure how reasonable it is to half switch into guest registers
> and expect to call into the wider kernel, fixing things up as we go.
Yeah it's not.
We need to disable tracing on those routines that are called in that
half-exited state.
cheers
Powered by blists - more mailing lists