Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2654000pxb; Mon, 18 Apr 2022 05:39:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCZEnHkIS4jllIp30BGT27AZtPu3MPUnbKPXoEz18O2wBIMGZ4Wh8+82GqNdfKtV6XQUrL X-Received: by 2002:a17:902:a3c9:b0:158:d83f:c436 with SMTP id q9-20020a170902a3c900b00158d83fc436mr10924039plb.162.1650285542045; Mon, 18 Apr 2022 05:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650285542; cv=none; d=google.com; s=arc-20160816; b=YlENb70Y8VZiYzuq6Ron4d/MK1GT+8ShfxnhoWVURX6ZQoVC0ClnAYCc4hsbhOOMdF 6P1wtDdNL2y7awAefwboR6VC3Ws5endL3n09bZ+D/4hmDfgC40rc7ewkFselhy65BTgF p/dL9EAqcYe2bEa0N7jL/1RXaYk0RGEZFSDxKqGymilxnUlwej2BjneUMcwrNv/L+W4H bLGck0a51e+aEIGw3D+lQNOsk2l3HE0W7B/l7C9r31w8IALLM8hjycti+yB8hTvBQoXG nqmlFPmubbuGmcIbIHECtUJJdC8ei1yu1HeZHlDQWU3a8EcOB4MdFSwBHTunh9gDeYJR s1Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=CW3A/aitUHfF5G3ViJWNE+t6LZ1tgXv7FWh03lEBllU=; b=bDpWl4LMyi5gN6eNlglwTaTDby+Woh4hkrBoEJ5yDwIXuy3sGNTS1r+rgHSiqf1+sa mpVEUoNpcbMtpqWrIJQq+PJ1pCv5c1QzQuk+rQ/bagPtZsquOdGL4zZsifqcQSgb85PM oVSlyQIcYBN18NaVdxoLwKLC7v71d3ObF8yPiuZByNNvHhuFbIFUt2GOKopN56GZqzSw V/M9WkvI7OArYFD4B8TIRcxZIAR3L1n5oih8CfVjhGu6vuE7m6+Imll+5X+Gnu5f8Y/f OOuAl4Uao0D4KcogSacuuT9S1Cjw2+BtjngaQC0NQY90jCs1EP9qgIhHWV6IF+vQMk3d QmKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a63e009000000b0039cc448271dsi9310240pgh.571.2022.04.18.05.38.47; Mon, 18 Apr 2022 05:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233397AbiDQETg (ORCPT + 99 others); Sun, 17 Apr 2022 00:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231489AbiDQETd (ORCPT ); Sun, 17 Apr 2022 00:19:33 -0400 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9489E186ED; Sat, 16 Apr 2022 21:16:59 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id b21so19758727lfb.5; Sat, 16 Apr 2022 21:16:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CW3A/aitUHfF5G3ViJWNE+t6LZ1tgXv7FWh03lEBllU=; b=EQXcsvxXAG4iJs6iTM60JTinlujWtHTw+eqvF4hVZrtz4Z62YMPkVoNOfuHy7YjJIq f00emz4csdwohzpEeEnQIQHmNHrauE1GkIgZh90dNf/EnCLgEbkMuevM+vNOVnatGoOD 9dDLnOia36yWrc1UzFEZDelO2gocfp1NXrxD2QYEfeErLkURsMljYAtlTN5buKsDNEUa adbFk8vZxaT4MdxZE8DZ90U7YdDQK98Vd6F/eXxcT07ZTagPgpm1HEfEsXyvEGQz19Jb Mygf1UJFDO3d+3v8mo/jhEsnXsYZIw2RrAnec6yZI36LMeXOHxsXsQZeYWaJqejynm2v QAgA== X-Gm-Message-State: AOAM530rt40W6grZnCnCwLsL9GB2k2Q2CL5PTj2+nNtVT7Aew5089wdl Q4nqc/yb+4ES4ptW/WDZmMJ6WCsI51dZO2ZG25iHiRJr X-Received: by 2002:a05:6512:1688:b0:464:f53f:850f with SMTP id bu8-20020a056512168800b00464f53f850fmr4121402lfb.637.1650169017848; Sat, 16 Apr 2022 21:16:57 -0700 (PDT) MIME-Version: 1.0 References: <20190701134255.25959-1-stephend@silicom-usa.com> In-Reply-To: <20190701134255.25959-1-stephend@silicom-usa.com> From: Len Brown Date: Sun, 17 Apr 2022 00:16:46 -0400 Message-ID: Subject: Re: [PATCH] intel_idle: prevent SKX boot failure when C6 & SERIRQ enabled To: Stephen Douthit Cc: Jacob Pan , Bjorn Helgaas , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephen, I noticed this patch languishing in patchwork. I don't see any discussion on it, and it never went upstream. Was this problem addressed in another way? If no, and somebody is using this patch, I'm curious if it is really CC6 that you want to disable, or perhaps disabling PC6 is sufficient? thanks, -Len On Mon, Jul 1, 2019 at 9:43 AM Stephen Douthit wrote: > > Interrupts are getting misrouted and/or dropped on SKLYLAKE_X based D-2100s > when C6 and SERIRQ are enabled. I've only seen this issue on systems > using SERIRQs (in my case for a LPC based UART providing the serial > console for a headless server). > > One failure mode is "do_IRQ: 8.33 No irq handler for vector" getting > printed in the kernel logs. The core getting the unhandled irq is typically > the one handling the UART SERIRQ. I've seen it on other cores, but I > haven't confirmed if that's because the UART irq handler was moved to > another core at some point. The vector varies from 33-36, but it's most > often 33. > > The other failure mode is the system hanging. Sometimes forcing some non > SERIRQ interrupt to fire (by plugging/unplugging a network/USB cable) can > get the system out of this state. Generating more SERIRQs via the UART > will not unstick the system. > > Both failures seemed to occur when transition to a low load state, which > is why I started playing around with power management options and found > that booting with "intel_idle.max_cstate=2" fixed the issue. > > This patch only disables C6 if it's able to determine that SERIRQs are > enabled by checking the enable bit in the LPC controllers PCI config space. > > Signed-off-by: Stephen Douthit > --- > drivers/idle/intel_idle.c | 35 ++++++++++++++++++++++++++++++++++- > include/linux/pci_ids.h | 1 + > 2 files changed, 35 insertions(+), 1 deletion(-) > > diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c > index b8647b5c3d4d..353f6a9b1818 100644 > --- a/drivers/idle/intel_idle.c > +++ b/drivers/idle/intel_idle.c > @@ -61,12 +61,13 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > > -#define INTEL_IDLE_VERSION "0.4.1" > +#define INTEL_IDLE_VERSION "0.4.2" > > static struct cpuidle_driver intel_idle_driver = { > .name = "intel_idle", > @@ -1306,6 +1307,35 @@ static void sklh_idle_state_table_update(void) > skl_cstates[5].disabled = 1; /* C8-SKL */ > skl_cstates[6].disabled = 1; /* C9-SKL */ > } > +/* > + * skx_idle_state_table_update() > + * > + * On SKX (model 0x55) SoCs disable C6 if SERIRQ is enabled > + */ > +static void skx_idle_state_table_update(void) > +{ > +#define SCNT_OFF 0x64 > +#define SCNT_EN (1 << 7) > + struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_INTEL, > + PCI_DEVICE_ID_INTEL_SKX_LPC, > + NULL); > + u8 reg; > + > + /* > + * Check bit 7 of the Serial IRQ Control (SCNT) register (0x64) in the > + * LPC controller. If it's set serial IRQs are enabled, and we need to > + * disable C6 to prevent hangs. > + */ > + if (!pdev) > + return; > + if (pci_read_config_byte(pdev, SCNT_OFF, ®)) > + return; > + if (!(reg & SCNT_EN)) > + return; > + > + pr_debug("SERIRQ enabled on SKX, disabling C6 to avoid hangs\n"); > + skx_cstates[2].disabled = 1; /* C6-SKX */ > +} > /* > * intel_idle_state_table_update() > * > @@ -1326,6 +1356,9 @@ static void intel_idle_state_table_update(void) > case INTEL_FAM6_SKYLAKE_DESKTOP: > sklh_idle_state_table_update(); > break; > + case INTEL_FAM6_SKYLAKE_X: > + skx_idle_state_table_update(); > + break; > } > } > > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h > index 70e86148cb1e..02bac8de03fd 100644 > --- a/include/linux/pci_ids.h > +++ b/include/linux/pci_ids.h > @@ -2997,6 +2997,7 @@ > #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea > #define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 > #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 > +#define PCI_DEVICE_ID_INTEL_SKX_LPC 0xa1c8 > #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 > > #define PCI_VENDOR_ID_SCALEMP 0x8686 > -- > 2.21.0 > -- Len Brown, Intel Open Source Technology Center