Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2906950rwo; Thu, 3 Aug 2023 17:44:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFByGy5oGClukMFziKvD86ZcP8Otk+Yhf5df81nRBUo/6pfLfC136c/SnNCYp/WbqTrYZNu X-Received: by 2002:a05:6512:401b:b0:4fd:f7fa:8017 with SMTP id br27-20020a056512401b00b004fdf7fa8017mr166454lfb.60.1691109873356; Thu, 03 Aug 2023 17:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691109873; cv=none; d=google.com; s=arc-20160816; b=e54jynTQthg6zeU8ztTIznVjENFAl7u2qZQxt/r6gjXxP9ARIEP3cRtegIk3yECcPl G+P0SN6kHLj7bcW1oIy7bfBE61AL+cPKXMzGQrlVtG0c5Fh9blVGzmV6S91hziC2l25C voxOcgcLvq71g7pwcsNGwiFPZOx8F39gOxHNsZJdDxbidPum5YnlecnPTjrhCPbNx9CA owT23FlT/gfXAPfkMJFm0HG8CNUbrhuTFf4FkrqClO50ZeVKksdf1I488LmtnS+oxgMy ND0i+vphLTJM4nueRGMojZtUTBEXWhEded6YvdLK1efKnyhhyVn5PwJPCNkv7A7duyRG fqRg== 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=H7CU+4ogxT9uR42r0NRv5uT6sXzmNe9Dw70+5jbyuXU=; fh=Z60veXSI6+Y6Un9wRVywLb1GgGzP009SfPNFfEifPSw=; b=fk3mNib9j1fHGehY3+HqjtP1624dq8IZMRX2LUTHPpLxS84RaZQyKeHNSVT2d814pX 4VE/cAxvk4aKTmdqmxavzyAOGvNEN0oRdVV8Pj54pBfjTgKhCop81OsOe2R3Tap6oWdU B8mR9mBLSM+optsEi8yvJcM41MVX0o8zrmZYSwxfmojoBymT5iGMPwRk3iyfbxRe07Np /lWlgOHFSY2yZ6akIztoy7WL9X/mfj1fNVtndOgaIq45Asf3xke6p5uWmsZlJqAtsYJi TFhh4dlID0F9lzMw4bysYxPmM5p4gDNnNJ61exhW8yZq2/FKltyu9/FYe/D3vu12NGyw qexg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WuddFivM; 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 e9-20020a056402104900b0052306e00649si671939edu.413.2023.08.03.17.44.09; Thu, 03 Aug 2023 17:44:33 -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=WuddFivM; 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 S230261AbjHCXKq (ORCPT + 99 others); Thu, 3 Aug 2023 19:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbjHCXKo (ORCPT ); Thu, 3 Aug 2023 19:10:44 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C239B2688 for ; Thu, 3 Aug 2023 16:10:41 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4fe463420fbso2530137e87.3 for ; Thu, 03 Aug 2023 16:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691104238; x=1691709038; 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=H7CU+4ogxT9uR42r0NRv5uT6sXzmNe9Dw70+5jbyuXU=; b=WuddFivMd15lSSGjJwJsLpVvJrQoPfaasw4xO+4U0HRuiypFFD6Nr0mRNNLOzX/q62 HZA9A8Jm2exDe5X3nU1kUjq1FcjZFdZjBId/cSGtOvbPA1QNMk3C63Q8AaJ/hBHDkMF4 RVfeJyd4r2R8VsTlb+vg9yrH29Od2W0Q6i7b0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691104238; x=1691709038; 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=H7CU+4ogxT9uR42r0NRv5uT6sXzmNe9Dw70+5jbyuXU=; b=fjcn9ZNDtdId4zjwA73vSqVwV8D6Pe3YcyREDlzJ417E+U2Ru5Vu/vPoWqqdWB2Pqp oSn6yfHsnCJdqt5yfANnaIB444mBLPv5ro3bVVJn8hCDVwPON2mGRKYxOTX+Cbxj/5Rk h8cc8yQvEh3GGcZ9g/gbDpZ5YC6ENcy/tZKIqzaG9c1+bS4MfMFQ+DQG4QinCD6mOOOM WrtZA4fcdOoIOKjcO8iZVzaFWzvRfZGHYGkBCj3KRJ3B6QvGpOdnIzoqyrtAeixlgdjZ BzP9l890vUkdJ9ElFghsU9ZBSaBEXkEcLaPtswYgf4bjU4ziBG1EfJy4G6MAgoufsAD8 wNmw== X-Gm-Message-State: AOJu0YwQtFQqpAnDquMFwMZrrMYZ1nXDbCfGZ51Up9XroXFL9q8B4j8y 7/xh3IcIpW9iioJaDhrOuSdO7TCbca7WkSuv3AvpqA== X-Received: by 2002:a05:6512:5d6:b0:4fd:d1df:9bda with SMTP id o22-20020a05651205d600b004fdd1df9bdamr29944lfo.42.1691104237826; Thu, 03 Aug 2023 16:10:37 -0700 (PDT) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com. [209.85.208.45]) by smtp.gmail.com with ESMTPSA id v12-20020a056402184c00b0051de20c59d7sm412839edy.15.2023.08.03.16.10.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Aug 2023 16:10:36 -0700 (PDT) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-51e24210395so5195a12.0 for ; Thu, 03 Aug 2023 16:10:36 -0700 (PDT) X-Received: by 2002:a50:9ec5:0:b0:522:cc9c:f5a4 with SMTP id a63-20020a509ec5000000b00522cc9cf5a4mr27783edf.4.1691104236616; Thu, 03 Aug 2023 16:10:36 -0700 (PDT) MIME-Version: 1.0 References: <20230731091754.1.I501ab68cb926ee33a7c87e063d207abf09b9943c@changeid> In-Reply-To: From: Doug Anderson Date: Thu, 3 Aug 2023 16:10:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] watchdog/hardlockup: Avoid large stack frames in watchdog_hardlockup_check() To: Michal Hocko Cc: Petr Mladek , Andrew Morton , kernel test robot , Lecopzer Chen , Pingfan Liu , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, Aug 3, 2023 at 1:30=E2=80=AFAM Michal Hocko wrote= : > > On Thu 03-08-23 10:12:12, Petr Mladek wrote: > > On Wed 2023-08-02 07:12:29, Doug Anderson wrote: > > > Hi, > > > > > > On Wed, Aug 2, 2023 at 12:27=E2=80=AFAM Michal Hocko wrote: > > > > > > > > On Tue 01-08-23 08:41:49, Doug Anderson wrote: > > > > [...] > > > > > Ah, I see what you mean. The one issue I have with your solution = is > > > > > that the ordering of the stack crawls is less ideal in the "dump = all" > > > > > case when cpu !=3D this_cpu. We really want to see the stack craw= l of > > > > > the locked up CPU first and _then_ see the stack crawls of other = CPUs. > > > > > With your solution the locked up CPU will be interspersed with al= l the > > > > > others and will be harder to find in the output (you've got to ma= tch > > > > > it up with the "Watchdog detected hard LOCKUP on cpu N" message). > > > > > While that's probably not a huge deal, it's nicer to make the out= put > > > > > easy to understand for someone trying to parse it... > > > > > > > > Is it worth to waste memory for this arguably nicer output? Identif= ying > > > > the stack of the locked up CPU is trivial. > > > > > > I guess it's debatable, but as someone who has spent time staring at > > > trawling through reports generated like this, I'd say "yes", it's > > > super helpful in understanding the problem to have the hung CPU first= . > > > Putting the memory usage in perspective: > > > > nmi_trigger_cpumask_backtrace() has its own copy of the cpu mask. > > What about changing the @exclude_self parameter to @exclude_cpu > > and do: > > > > if (exclude_cpu >=3D 0) > > cpumask_clear_cpu(exclude_cpu, to_cpumask(backtrace_mask)= ); > > > > > > It would require changing also arch_trigger_cpumask_backtrace() to > > > > void arch_trigger_cpumask_backtrace(const struct cpumask *mask, > > int exclude_cpu); > > > > but it looks doable. > > Yes, but sparc is doing its own thing so it would require changing that > as well. But this looks reasonable as well. OK. I've tried a v3 with that: https://lore.kernel.org/r/20230803160649.v3.2.I501ab68cb926ee33a7c87e063d20= 7abf09b9943c@changeid -Doug