Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 24 Jul 2018 15:21:55 -0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fhz8L-0003xi-Rh for speck@linutronix.de; Tue, 24 Jul 2018 17:21:54 +0200 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhz8K-0004u8-58 for speck@linutronix.de; Tue, 24 Jul 2018 15:21:52 +0000 Date: Tue, 24 Jul 2018 17:21:50 +0200 From: Peter Zijlstra Subject: [MODERATED] Re: [RFC PATCH 4/6] kvm: handle host mode irqs 4 Message-ID: <20180724152150.GQ2494@hirez.programming.kicks-ass.net> References: <6815cf025aa41954f911a1e76c2415035307b00f.1532339695.git.nstange@suse.de> MIME-Version: 1.0 In-Reply-To: <6815cf025aa41954f911a1e76c2415035307b00f.1532339695.git.nstange@suse.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: 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.