From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 415LVw5FkDzDrpC for ; Wed, 13 Jun 2018 19:07:36 +1000 (AEST) Date: Wed, 13 Jun 2018 11:07:20 +0200 From: Peter Zijlstra To: Ricardo Neri Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Ashok Raj , Borislav Petkov , Tony Luck , "Ravi V. Shankar" , x86@kernel.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Jacob Pan , "Rafael J. Wysocki" , Don Zickus , Nicholas Piggin , Michael Ellerman , Frederic Weisbecker , Alexei Starovoitov , Babu Moger , Mathieu Desnoyers , Masami Hiramatsu , Andrew Morton , Philippe Ombredanne , Colin Ian King , Byungchul Park , "Paul E. McKenney" , "Luis R. Rodriguez" , Waiman Long , Josh Poimboeuf , Randy Dunlap , Davidlohr Bueso , Christoffer Dall , Marc Zyngier , Kai-Heng Feng , Konrad Rzeszutek Wilk , David Rientjes , iommu@lists.linux-foundation.org Subject: Re: [RFC PATCH 17/23] watchdog/hardlockup/hpet: Convert the timer's interrupt to NMI Message-ID: <20180613090720.GV12258@hirez.programming.kicks-ass.net> References: <1528851463-21140-1-git-send-email-ricardo.neri-calderon@linux.intel.com> <1528851463-21140-18-git-send-email-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1528851463-21140-18-git-send-email-ricardo.neri-calderon@linux.intel.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, Jun 12, 2018 at 05:57:37PM -0700, Ricardo Neri wrote: +static bool is_hpet_wdt_interrupt(struct hpet_hld_data *hdata) +{ + unsigned long this_isr; + unsigned int lvl_trig; + + this_isr = hpet_readl(HPET_STATUS) & BIT(hdata->num); + + lvl_trig = hpet_readl(HPET_Tn_CFG(hdata->num)) & HPET_TN_LEVEL; + + if (lvl_trig && this_isr) + return true; + + return false; +} > +static int hardlockup_detector_nmi_handler(unsigned int val, > + struct pt_regs *regs) > +{ > + struct hpet_hld_data *hdata = hld_data; > + unsigned int use_fsb; > + > + /* > + * If FSB delivery mode is used, the timer interrupt is programmed as > + * edge-triggered and there is no need to check the ISR register. > + */ > + use_fsb = hdata->flags & HPET_DEV_FSB_CAP; Please do explain.. That FSB thing basically means MSI. But there's only a single NMI vector. How do we know this NMI came from the HPET? > + > + if (!use_fsb && !is_hpet_wdt_interrupt(hdata)) So you add _2_ HPET reads for every single NMI that gets triggered... and IIRC HPET reads are _sllooooowwwwww_. > + return NMI_DONE; > + > + inspect_for_hardlockups(regs); > + > + if (!(hdata->flags & HPET_DEV_PERI_CAP)) > + kick_timer(hdata); > + > + /* Acknowledge interrupt if in level-triggered mode */ > + if (!use_fsb) > + hpet_writel(BIT(hdata->num), HPET_STATUS); > + > + return NMI_HANDLED; So if I read this right, when in FSB/MSI mode, we'll basically _always_ claim every single NMI as handled? That's broken. > +}