From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A6F6C433FE for ; Fri, 13 May 2022 22:13:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbiEMWNT (ORCPT ); Fri, 13 May 2022 18:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbiEMWNS (ORCPT ); Fri, 13 May 2022 18:13:18 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E2B719DB for ; Fri, 13 May 2022 15:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652479996; x=1684015996; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cxef9S28Y+ZsR9yxpw47GL3tVgcHUSJqzLfqt+5PNSo=; b=Q04s0Y9VtUDQRM4mG92f3MMBXfQDBkqGdEsZ5j/+TPA+YetCe2HoTezj dpwcplWrID1tY897TIoEynRXM9J1r3FoLjtucFULc7YdfcXlwpqIYZI9O TUnta5b22dKHX/BYW2M8+u+l+bcr85RvGTtFSaJC60iXsSFrzbybWY9L9 dWuqvpPN5PeRb+UfK3WwWYLgS1XxEmzxVji8oNtyCU4JWtSBS3lzBO6UM 47ukV5tF9WKnxqga4DyNC4gT8zXhjnhutRev+KtpIPh1X6DmpCMWpXNnG PVk2eDh/Rl9ke6LPIOY/vSeEXYvdiLXuh5SRaUV4ra6S3tQ3Jnj4CUlhJ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="270357920" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="270357920" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 15:13:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="543454884" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga006.jf.intel.com with ESMTP; 13 May 2022 15:13:15 -0700 Date: Fri, 13 May 2022 15:16:50 -0700 From: Ricardo Neri To: Thomas Gleixner Cc: x86@kernel.org, Tony Luck , Andi Kleen , Stephane Eranian , Andrew Morton , Joerg Roedel , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Nicholas Piggin , "Ravi V. Shankar" , Ricardo Neri , iommu@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 22/29] x86/watchdog/hardlockup: Add an HPET-based hardlockup detector Message-ID: <20220513221650.GA8691@ranerica-svr.sc.intel.com> References: <20220506000008.30892-1-ricardo.neri-calderon@linux.intel.com> <20220506000008.30892-23-ricardo.neri-calderon@linux.intel.com> <877d6uref8.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877d6uref8.ffs@tglx> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2022 at 04:03:39PM +0200, Thomas Gleixner wrote: > On Thu, May 05 2022 at 17:00, Ricardo Neri wrote: > > + if (is_hpet_hld_interrupt(hdata)) { > > + /* > > + * Kick the timer first. If the HPET channel is periodic, it > > + * helps to reduce the delta between the expected TSC value and > > + * its actual value the next time the HPET channel fires. > > + */ > > + kick_timer(hdata, !(hdata->has_periodic)); > > + > > + if (cpumask_weight(hld_data->monitored_cpumask) > 1) { > > + /* > > + * Since we cannot know the source of an NMI, the best > > + * we can do is to use a flag to indicate to all online > > + * CPUs that they will get an NMI and that the source of > > + * that NMI is the hardlockup detector. Offline CPUs > > + * also receive the NMI but they ignore it. > > + * > > + * Even though we are in NMI context, we have concluded > > + * that the NMI came from the HPET channel assigned to > > + * the detector, an event that is infrequent and only > > + * occurs in the handling CPU. There should not be races > > + * with other NMIs. > > + */ > > + cpumask_copy(hld_data->inspect_cpumask, > > + cpu_online_mask); > > + > > + /* If we are here, IPI shorthands are enabled. */ > > + apic->send_IPI_allbutself(NMI_VECTOR); > > So if the monitored cpumask is a subset of online CPUs, which is the > case when isolation features are enabled, then you still send NMIs to > those isolated CPUs. I'm sure the isolation folks will be enthused. Yes, I acknowledged this limitation in the cover letter. I should also update Documentation/admin-guide/lockup-watchdogs.rst. This patchset proposes the HPET NMI watchdog as an opt-in feature. Perhaps the limitation might be mitigated by adding a check for non-housekeeping and non-monitored CPUs in exc_nmi(). However, that will not eliminate the problem of isolated CPUs also getting the NMI. Thanks and BR, Ricardo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F12C4C433EF for ; Fri, 13 May 2022 22:13:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A41B34015A; Fri, 13 May 2022 22:13:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bldEUCndl99l; Fri, 13 May 2022 22:13:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 92EE840207; Fri, 13 May 2022 22:13:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 68536C0039; Fri, 13 May 2022 22:13:19 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4ABFCC002D for ; Fri, 13 May 2022 22:13:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3C421410DC for ; Fri, 13 May 2022 22:13:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iXW12Le3tAKl for ; Fri, 13 May 2022 22:13:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by smtp4.osuosl.org (Postfix) with ESMTPS id 30C4640988 for ; Fri, 13 May 2022 22:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652479997; x=1684015997; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cxef9S28Y+ZsR9yxpw47GL3tVgcHUSJqzLfqt+5PNSo=; b=F4LQdEuNvQZHZXbbAxUDbmPaMfSCUfgdmVmb9EHgatssfaulY9QRdzdC 5mh74yj6TA/lAvvxhMzCw/JqSLJyatnhPGD9LRb4AEcKl6AwyJNc34B/G fYPSc7R+IUfCgkL7T99Bd+yNz1oLLxpAMPSrwzU4OzO030lJHctDn1cE1 NbUFWu7jCsKF+u+AoMi7vJ+C6wlDqjdqgZ3YYwkL6cxy7Sigt12NiM99M C9scF6WD7z8yQaSWbqBXzF9o+/et6ki+l5nsRzy1RlMyvDSpGTWXWzcUe vNv3mCxFQZMjBsg9uXCGL/EFVhULf817hmTfopLiuKXqO9+x8eYEjDllA A==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="250330937" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="250330937" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 15:13:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="543454884" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga006.jf.intel.com with ESMTP; 13 May 2022 15:13:15 -0700 Date: Fri, 13 May 2022 15:16:50 -0700 From: Ricardo Neri To: Thomas Gleixner Subject: Re: [PATCH v6 22/29] x86/watchdog/hardlockup: Add an HPET-based hardlockup detector Message-ID: <20220513221650.GA8691@ranerica-svr.sc.intel.com> References: <20220506000008.30892-1-ricardo.neri-calderon@linux.intel.com> <20220506000008.30892-23-ricardo.neri-calderon@linux.intel.com> <877d6uref8.ffs@tglx> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <877d6uref8.ffs@tglx> User-Agent: Mutt/1.9.4 (2018-02-28) Cc: "Ravi V. Shankar" , Andi Kleen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org, Ricardo Neri , Stephane Eranian , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Tony Luck , Nicholas Piggin , Andrew Morton , David Woodhouse X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Mon, May 09, 2022 at 04:03:39PM +0200, Thomas Gleixner wrote: > On Thu, May 05 2022 at 17:00, Ricardo Neri wrote: > > + if (is_hpet_hld_interrupt(hdata)) { > > + /* > > + * Kick the timer first. If the HPET channel is periodic, it > > + * helps to reduce the delta between the expected TSC value and > > + * its actual value the next time the HPET channel fires. > > + */ > > + kick_timer(hdata, !(hdata->has_periodic)); > > + > > + if (cpumask_weight(hld_data->monitored_cpumask) > 1) { > > + /* > > + * Since we cannot know the source of an NMI, the best > > + * we can do is to use a flag to indicate to all online > > + * CPUs that they will get an NMI and that the source of > > + * that NMI is the hardlockup detector. Offline CPUs > > + * also receive the NMI but they ignore it. > > + * > > + * Even though we are in NMI context, we have concluded > > + * that the NMI came from the HPET channel assigned to > > + * the detector, an event that is infrequent and only > > + * occurs in the handling CPU. There should not be races > > + * with other NMIs. > > + */ > > + cpumask_copy(hld_data->inspect_cpumask, > > + cpu_online_mask); > > + > > + /* If we are here, IPI shorthands are enabled. */ > > + apic->send_IPI_allbutself(NMI_VECTOR); > > So if the monitored cpumask is a subset of online CPUs, which is the > case when isolation features are enabled, then you still send NMIs to > those isolated CPUs. I'm sure the isolation folks will be enthused. Yes, I acknowledged this limitation in the cover letter. I should also update Documentation/admin-guide/lockup-watchdogs.rst. This patchset proposes the HPET NMI watchdog as an opt-in feature. Perhaps the limitation might be mitigated by adding a check for non-housekeeping and non-monitored CPUs in exc_nmi(). However, that will not eliminate the problem of isolated CPUs also getting the NMI. Thanks and BR, Ricardo _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D081C433EF for ; Fri, 13 May 2022 22:15:08 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4L0NHZ2psYz3cLc for ; Sat, 14 May 2022 08:15:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KwxDDGDh; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.intel.com (client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ricardo.neri-calderon@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KwxDDGDh; dkim-atps=neutral Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (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 4L0NGq2tWWz309l for ; Sat, 14 May 2022 08:14:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652480067; x=1684016067; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cxef9S28Y+ZsR9yxpw47GL3tVgcHUSJqzLfqt+5PNSo=; b=KwxDDGDho01tCETTbUZOSdKONnNOcXoWoF+wx93bmGD9kOSpAdRwaCYy f3APdxvIO8VHhtw1QaUJs1wVz+Ppe9eLAR2G6Xkj6tfEvVckxyctv1jkP fdLQu4FHO6oXEhICd1ywKU0bqpOEFnHziObsYQrHEx+Bf9Wd2Zu32aNvJ UDP/ulhrSNg56Xee4BlrmEeX8tvUaXyYlBrtrGZq1SkE5WePd58f6qyFL wKacdJ8N7w1PMGc7oZPgtU6jnSkUZINq8gZsPmBGcAOEqPNxWybd9SSCY jtZ0H4BJlCUNZKl0IBd59JsxMHFCsv+W8JUGqRlQGXt5yT2mdeeLqoCXY A==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="331028444" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="331028444" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 15:13:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="543454884" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga006.jf.intel.com with ESMTP; 13 May 2022 15:13:15 -0700 Date: Fri, 13 May 2022 15:16:50 -0700 From: Ricardo Neri To: Thomas Gleixner Subject: Re: [PATCH v6 22/29] x86/watchdog/hardlockup: Add an HPET-based hardlockup detector Message-ID: <20220513221650.GA8691@ranerica-svr.sc.intel.com> References: <20220506000008.30892-1-ricardo.neri-calderon@linux.intel.com> <20220506000008.30892-23-ricardo.neri-calderon@linux.intel.com> <877d6uref8.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877d6uref8.ffs@tglx> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Ravi V. Shankar" , Andi Kleen , linuxppc-dev@lists.ozlabs.org, Joerg Roedel , x86@kernel.org, Ricardo Neri , Stephane Eranian , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Tony Luck , Nicholas Piggin , Suravee Suthikulpanit , Andrew Morton , David Woodhouse , Lu Baolu Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, May 09, 2022 at 04:03:39PM +0200, Thomas Gleixner wrote: > On Thu, May 05 2022 at 17:00, Ricardo Neri wrote: > > + if (is_hpet_hld_interrupt(hdata)) { > > + /* > > + * Kick the timer first. If the HPET channel is periodic, it > > + * helps to reduce the delta between the expected TSC value and > > + * its actual value the next time the HPET channel fires. > > + */ > > + kick_timer(hdata, !(hdata->has_periodic)); > > + > > + if (cpumask_weight(hld_data->monitored_cpumask) > 1) { > > + /* > > + * Since we cannot know the source of an NMI, the best > > + * we can do is to use a flag to indicate to all online > > + * CPUs that they will get an NMI and that the source of > > + * that NMI is the hardlockup detector. Offline CPUs > > + * also receive the NMI but they ignore it. > > + * > > + * Even though we are in NMI context, we have concluded > > + * that the NMI came from the HPET channel assigned to > > + * the detector, an event that is infrequent and only > > + * occurs in the handling CPU. There should not be races > > + * with other NMIs. > > + */ > > + cpumask_copy(hld_data->inspect_cpumask, > > + cpu_online_mask); > > + > > + /* If we are here, IPI shorthands are enabled. */ > > + apic->send_IPI_allbutself(NMI_VECTOR); > > So if the monitored cpumask is a subset of online CPUs, which is the > case when isolation features are enabled, then you still send NMIs to > those isolated CPUs. I'm sure the isolation folks will be enthused. Yes, I acknowledged this limitation in the cover letter. I should also update Documentation/admin-guide/lockup-watchdogs.rst. This patchset proposes the HPET NMI watchdog as an opt-in feature. Perhaps the limitation might be mitigated by adding a check for non-housekeeping and non-monitored CPUs in exc_nmi(). However, that will not eliminate the problem of isolated CPUs also getting the NMI. Thanks and BR, Ricardo