Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7165343rwr; Tue, 25 Apr 2023 08:59:27 -0700 (PDT) X-Google-Smtp-Source: AKy350YcmPIxqqx0cAL1qbFXnazuSfC1K1Ebxvu0JfYx/3qDAwZ8qwPd0kdjnAscGWqIJfQFqiGa X-Received: by 2002:a17:902:eb87:b0:19c:f096:bbef with SMTP id q7-20020a170902eb8700b0019cf096bbefmr17534182plg.49.1682438366784; Tue, 25 Apr 2023 08:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682438366; cv=none; d=google.com; s=arc-20160816; b=b1vFJOZ77rvitDvzX0M61ZZZ2eoQUmUpXGb5iRSiSjPChBUKNTL5V2a241Y0zHD0q3 G3qEO48EWbPQqmm4WdGvG7eSP600TEDInMx2XEmLpOUDkYGsnmZQDytH/BmaBA9TNpSS S4bEiCpQs8aAUZV85Briu9ULwjDNbzNxiUYUtWsTY17ktVb4CHgV+a5B/ryQacyj0V1M +kOfufKTVclBeVTED9ChMIdwx2lYLKm4LWPWnaqKQmEMipLSfaynX3J3u+CFjzxfskNO WDB3+gBfO59ckiDxW099JRUlGsmYK8xSBXzaTCyFYEnoEYxOFgZUivUKlGY02tYZStaW gkWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Cyqk2sw07jP79tLlZQcGC2Yi7zdVZiomYulq2SQLWdw=; b=rNi1DY5DJTZlURFjrpsRsuQz4Xfr9Vd38wXfMHtzjz68pO6sLhmjkuOmBOc48rtgCG SkE3muBWUHP0Z7/YNUSOtRaf7hhSdAScZZ8MS2RoVRsgu3eckcpoEKJbPGlfYTd+mk1c Sx3ZKa9vvXa6qBr2RtLwch4NT9z8p2c83yWvbHSfzn+h+qybqHmkMsRsbfJP91s5P6zV /RtZ7otc7WcPWENM4i74CFDt4kzMqR4ShQrMnUAwi9VfusMFyENJycPypCSuSk5q2lqn C7+rculkFrflS0O88X4DcaV4c682NzLkMddCiQsgSh0ozAPJrE3cyXHlztU4DL7hsjCw 5WcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gQnpYrFs; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170902f68d00b001a288c5d34bsi14782354plg.85.2023.04.25.08.59.13; Tue, 25 Apr 2023 08:59:26 -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; dkim=pass header.i=@chromium.org header.s=google header.b=gQnpYrFs; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234304AbjDYPd1 (ORCPT + 99 others); Tue, 25 Apr 2023 11:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234279AbjDYPdZ (ORCPT ); Tue, 25 Apr 2023 11:33:25 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322B7AF22 for ; Tue, 25 Apr 2023 08:33:21 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-3ef112cac17so26585791cf.0 for ; Tue, 25 Apr 2023 08:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682436800; x=1685028800; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Cyqk2sw07jP79tLlZQcGC2Yi7zdVZiomYulq2SQLWdw=; b=gQnpYrFszwDue88sda4HvWUwNapVsbnV/8FByT6CuU6QhknbyKrI/InURqYbReMR0q th2pNU8WoSzAMmeDnGNorCcRrE9lo1F00ck43h5n4yM7I/UezwWl7q5CFUN7RttsuqoM aHa+ShEFy4w5e2BmnphxYbAOVPErPCkQmUzB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682436800; x=1685028800; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cyqk2sw07jP79tLlZQcGC2Yi7zdVZiomYulq2SQLWdw=; b=Kz4874D+HeOArfyM2JzufCEotq1wL0S6JhnJd1gAKua/tRDuXPKJt72Ov+kp0jupyv 1AbbAcPmSlQS58FDToDA+EL0F9FIw6Nn93Ui6guKgoQycWLYzYtgLdokcwxDwU06k3Fk /XyHg0ZVfNvMJQPhyOkWsNEe/SZzEW++cjQx2xrJ3uR2hXhCakW0O/JYaGcGdubgHQ9i 53cd/DfTagcRvkq/3dmmWZNxIWJpmufKcr7WgGSMZDv6Y+ZMiPbMR2Ozg1gwrkPG3IPR reqjVpykiZl5lE0QVcz3LoKfmGGiogbPDMaSE8vRYpbm1YLY6C65Z63ERusLJaJsPVSB KHAg== X-Gm-Message-State: AAQBX9e4J43ykSFpSb4ja+q0/qx5sXnCoPRYy1WSverNisgUCoDH8+jo 4LMymkTYCMg1yWDEV/eseMdkmpq9btHypjTE80o= X-Received: by 2002:a05:622a:148e:b0:3ef:7d5d:9c3e with SMTP id t14-20020a05622a148e00b003ef7d5d9c3emr14992999qtx.34.1682436799757; Tue, 25 Apr 2023 08:33:19 -0700 (PDT) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com. [209.85.160.182]) by smtp.gmail.com with ESMTPSA id gd21-20020a05622a5c1500b003f0af201a2dsm520955qtb.81.2023.04.25.08.33.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Apr 2023 08:33:19 -0700 (PDT) Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-3ef31924c64so134511cf.1 for ; Tue, 25 Apr 2023 08:33:19 -0700 (PDT) X-Received: by 2002:a92:cd8b:0:b0:32b:3dd3:4c9a with SMTP id r11-20020a92cd8b000000b0032b3dd34c9amr264823ilb.15.1682436387051; Tue, 25 Apr 2023 08:26:27 -0700 (PDT) MIME-Version: 1.0 References: <20230421155255.1.I6bf789d21d0c3d75d382e7e51a804a7a51315f2c@changeid> <20230424125355.GA4054@aspen.lan> In-Reply-To: From: Doug Anderson Date: Tue, 25 Apr 2023 08:26:14 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] hardlockup: detect hard lockups using secondary (buddy) cpus To: Chen-Yu Tsai Cc: Daniel Thompson , Petr Mladek , Andrew Morton , Lecopzer Chen , Stephen Boyd , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Marc Zyngier , linux-perf-users@vger.kernel.org, Mark Rutland , Masayoshi Mizuma , Will Deacon , ito-yuichi@fujitsu.com, Sumit Garg , Catalin Marinas , Colin Cross , Matthias Kaehlcke , Guenter Roeck , Tzung-Bi Shih , Alexander Potapenko , AngeloGioacchino Del Regno , Dan Williams , Geert Uytterhoeven , Ingo Molnar , John Ogness , Josh Poimboeuf , Juergen Gross , Kees Cook , Laurent Dufour , Liam Howlett , Marco Elver , Matthias Brugger , Michael Ellerman , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , "Paul E. McKenney" , Peter Zijlstra , Randy Dunlap , Rasmus Villemoes , Sami Tolvanen , Stefano Stabellini , Vlastimil Babka , Zhaoyang Huang , Zhen Lei , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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, On Mon, Apr 24, 2023 at 9:58=E2=80=AFPM Chen-Yu Tsai w= rote: > > On Mon, Apr 24, 2023 at 11:42=E2=80=AFPM Doug Anderson wrote: > > > > Hi, > > > > On Mon, Apr 24, 2023 at 5:54=E2=80=AFAM Daniel Thompson > > wrote: > > > > > > On Fri, Apr 21, 2023 at 03:53:30PM -0700, Douglas Anderson wrote: > > > > From: Colin Cross > > > > > > > > Implement a hardlockup detector that can be enabled on SMP systems > > > > that don't have an arch provided one or one implemented atop perf b= y > > > > using interrupts on other cpus. Each cpu will use its softlockup > > > > hrtimer to check that the next cpu is processing hrtimer interrupts= by > > > > verifying that a counter is increasing. > > > > > > > > NOTE: unlike the other hard lockup detectors, the buddy one can't > > > > easily provide a backtrace on the CPU that locked up. It relies on > > > > some other mechanism in the system to get information about the loc= ked > > > > up CPUs. This could be support for NMI backtraces like [1], it coul= d > > > > be a mechanism for printing the PC of locked CPUs like [2], or it > > > > could be something else. > > > > > > > > This style of hardlockup detector originated in some downstream > > > > Android trees and has been rebased on / carried in ChromeOS trees f= or > > > > quite a long time for use on arm and arm64 boards. Historically on > > > > these boards we've leveraged mechanism [2] to get information about > > > > hung CPUs, but we could move to [1]. > > > > > > On the Arm platforms is this code able to leverage the existing > > > infrastructure to extract status from stuck CPUs: > > > https://docs.kernel.org/trace/coresight/coresight-cpu-debug.html > > > > Yup! I wasn't explicit about this, but that's where you end up if you > > follow the whole bug tracker item that was linked as [2]. > > Specifically, we used to have downstream patches in the ChromeOS that > > just reached into the coresight range from a SoC specific driver and > > printed out the CPU_DBGPCSR. When Brian was uprevving rk3399 > > Chromebooks he found that the equivalent functionality had made it > > upstream in a generic way through the coresight framework. Brian > > confirmed it was working on rk3399 and made all of the device tree > > changes needed to get it all hooked up, so (at least for that SoC) it > > should work on that SoC. > > > > [2] https://issuetracker.google.com/172213129 > > IIRC with the coresight CPU debug driver enabled and the proper DT nodes > added, the panic handler does dump out information from the hardware. > I don't think it's wired up for hung tasks though. Yes, that's correct. The coresight CPU debug driver doesn't work for hung tasks because it can't get a real stack crawl. All it can get is the PC of the last branch that the CPU took. This is why combining ${SUBJECT} patch with the ability to get stack traces via pseudo-NMI is superior. That being said, even with just the coresight CPU debug driver ${SUBJECT} patch is still helpful because (assuming "hardlockup_panic" is set) we'll do a panic which will then trigger the coresight CPU debug driver. :-) -Doug