From: Nicolai Stange <nstange@suse.de>
To: speck@linutronix.de
Subject: [MODERATED] Re: [RFC PATCH 4/6] kvm: handle host mode irqs 4
Date: Wed, 25 Jul 2018 13:45:32 +0200 [thread overview]
Message-ID: <87r2jrv8rn.fsf_-_@suse.de> (raw)
In-Reply-To: <20180724152150.GQ2494@hirez.programming.kicks-ass.net> (speck for Peter Zijlstra's message of "Tue, 24 Jul 2018 17:21:50 +0200")
speck for Peter Zijlstra <speck@linutronix.de> writes:
> On Sun, Jul 22, 2018 at 11:35:38AM +0200, speck for Nicolai Stange wrote:
>
>> Implement "kernel mode irq tracking" to address this.
>>
>> Introduce a per-cpu generation count, kernel_mode_irq_gen. Its semantics
>> are defined as follows: if its values as read at two points in time compare
>> equal, then an interrupt has not happened inbetween while in kernel mode
>> on that CPU.
>>
>> Let the 32 and 64 bit interrupt specific entry code increment this
>> generation counter. Note that the increment is done unconditionally to
>> safe a branch. This doesn't matter though because nobody is watching
>> anyway when interrupts are taken from userspace.
>>
>> NMIs are not tracked -- non-racy usage of kernel_mode_irq_gen requires
>> interrupts to be off.
>
> Should this not be part of irq_cpustat_t ? And have you looked at how
> much is already covered by kstat_incr_irqs_this_cpu() ? Also note that
> struct kernel_stat already includes a count vector for all softirqs.
kstat_incr_irqs_this_cpu() covers anything coming through do_IRQ(),
provided that irq_domain implementations call it from their associated
struct irq_desc ->handle_irq(). Those I checked do, but there's no
guarantee AFAICT.
Anyway, if we were to reuse the existing stats you suggested above, then
- either softirqs only or
- softirqs + do_IRQ()
could get made to trigger L1d flushes.
I'd still opt for also including the non-do_IRQ() irqs though, because
- The number of additional L1d flushes would be limited: Paolo
mentioned somewhere that the expected time between vmexit -> vmenter
where ->l1tf_flush_l1d would not have been set already is ~2500 clock
cycles.
- The non-do_IRQ() irqs wouldn't have to get audited for potentially
pulling in any sensitive data.
So if nobody objects, I'll go with what Paolo proposed at [1]: replace
the 'kernel_mode_irq_gen' counter with a latch flag and set that for any
irq (but NMIs for a start).
Thanks,
Nicolai
[1] 25bdef0a-d65a-a8f8-020c-f9a2056be76f@redhat.com
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton,
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2018-07-25 11:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 9:54 [MODERATED] [RFC PATCH 0/6] kvm: handle host mode irqs 0 Nicolai Stange
2018-07-21 20:16 ` [MODERATED] [RFC PATCH 1/6] kvm: handle host mode irqs 1 Nicolai Stange
2018-07-21 20:25 ` [MODERATED] [RFC PATCH 2/6] kvm: handle host mode irqs 2 Nicolai Stange
2018-07-21 20:35 ` [MODERATED] [RFC PATCH 3/6] kvm: handle host mode irqs 3 Nicolai Stange
2018-07-22 9:35 ` [MODERATED] [RFC PATCH 4/6] kvm: handle host mode irqs 4 Nicolai Stange
2018-07-23 15:40 ` [MODERATED] " Andi Kleen
2018-07-24 5:58 ` Nicolai Stange
2018-07-24 14:12 ` Andi Kleen
2018-07-24 14:39 ` Paolo Bonzini
2018-07-24 15:21 ` Peter Zijlstra
2018-07-25 11:45 ` Nicolai Stange [this message]
2018-07-27 7:45 ` Peter Zijlstra
2018-07-27 9:17 ` Nicolai Stange
2018-07-27 9:55 ` Paolo Bonzini
2018-07-29 20:00 ` Nicolai Stange
2018-07-22 11:06 ` [MODERATED] [RFC PATCH 5/6] kvm: handle host mode irqs 5 Nicolai Stange
2018-07-22 11:38 ` [MODERATED] [RFC PATCH 6/6] kvm: handle host mode irqs 6 Nicolai Stange
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=87r2jrv8rn.fsf_-_@suse.de \
--to=nstange@suse.de \
--cc=speck@linutronix.de \
/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