Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp242722rdb; Thu, 8 Feb 2024 04:59:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVsCti0i2Ot7Tu2g7OBOkk5A3gHKs0qNCmFvNYaSYwirTGU34G7D7lvkknrqWnpRqF/+t6UeYZD5Phk746iE9xa/0gqfghPRxyWF98RwQ== X-Google-Smtp-Source: AGHT+IEP3AMNJl7qLIYSEgrlEVGmxRweGXMJDbgpqVGKpqUe0PEr5UPY+azxDhSac+TFshKlhipQ X-Received: by 2002:a05:6a20:72a7:b0:19e:ab7c:5949 with SMTP id o39-20020a056a2072a700b0019eab7c5949mr4150499pzk.17.1707397161446; Thu, 08 Feb 2024 04:59:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707397161; cv=pass; d=google.com; s=arc-20160816; b=wxBxC5w7d1hOkL7OkIH2Lf1JqFqokZuULYb5eTN5Z7PAbPyuTEMXhZxWwyh4irLfio qSB5ZOBU5Y3xoX6Ujbe6cLw7ajs1IaFMLSlSzteR2kbKIUA7NCJV+HeDP0fBo+Yw6D/n 7Z5N6NnbfyMe2GvXzpNk3brHfK2urrnGGgyligSZ8bJv43Sw18feWvjWn4KHp5UZda3V WqTAfWDoN/z/9ugK7vW76zfPpjQxGnDakXwJmIVnrWgtZFT9kuJX2eNgcFh/giT3nIQ4 6CLMYfoMKsQ4e+Hjy9PWI9rl38ztXNm8jx45tT9zSjnayiqocguDPl+u7IxDt3rJ//NF 0izQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=XHK6kOnSeSKQ2zuKL97UJxePL2wg5A3NCvg/jmIvXcQ=; fh=zk7doKt8uiI8ImONAxyi2jImmmD1AHi5pF7rJJXfTrM=; b=Q19ePF2U8A/pgF4bQu9LYVRyU7kR+pQACTIFnn+DmrZrxj4jfXVkDEs8819V/Pvg0/ yqUxEfpqVuLMLzoWQq2DTRn7nM/lWQduqTyuTk5SS1MoJuzFQYeuSVPHaXtqLeTiX41b BWtqMwKKC6PDwzKtUhgaqmYmwJRemmctVjzUKjFY55jZifxryUnLFng/cFWEuZmjyQkU mxtkUz2uIndnZ7qAz9p4qX0ymYeEvyJpFYJqPkN4WVFfdzNYSrXGXXiRjJrksY60yfM4 kzEK+tAL8hw0edudcN/sVBKQJGbULJhHqYc1HILvEGYSANusAx8WtAFiblsZ74a5LDnl Ki1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=fK2O4Syu; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-58094-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58094-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com X-Forwarded-Encrypted: i=2; AJvYcCU3wYYB3Ut1vbpnov1iK3erqccj0gKsXOWv/bWzN7lPHRe6+UBDLxb/e6JYOMnkgU/J6vJYMTtHoaA2fNtH6BMBZVUyEFz11e0Iysb/Mg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r17-20020a638f51000000b005cde42fcb11si3994958pgn.707.2024.02.08.04.59.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 04:59:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58094-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=fK2O4Syu; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-58094-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58094-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40E982856EA for ; Thu, 8 Feb 2024 12:54:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80329762D9; Thu, 8 Feb 2024 12:54:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="fK2O4Syu" Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C565176036 for ; Thu, 8 Feb 2024 12:54:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707396875; cv=none; b=TIjPitjcWXxEldb5Gl4j3pX0mKmfv+FBjDgDsg7A0rL7M97jqukrRC+EvyDPfMHAzhHx45uGthJfT7BkPbS9xPYySZ67Sjttjchkb6jbxbhkaA077Y4T9W1x+3Z1FtGFpX2DO7I9a79BfL/vkUkO5C6ra8KC6+SeHn/1zmlkXk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707396875; c=relaxed/simple; bh=jFdrAmmiEqaYk7GTCUNGd+77e40anha5SBREow0cYg0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=OfoUMW9/IfJn1r26Zr5eDDYL2y8tQ3X9UuKOg6ydisTMhqAcC9XmKdOj4KaoJuvVsCP9nXfsUoskazyhq245EsAxNEHGF0abcHC1lvhpNRGXLrYgp0XMatv7zDYLb38ThDhXAKLSix9t6epSjZkWQ1DD15Fuxx+QDlCcboO6Jh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=fK2O4Syu; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1707396870; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; bh=XHK6kOnSeSKQ2zuKL97UJxePL2wg5A3NCvg/jmIvXcQ=; b=fK2O4SyuYPKeNFL7eUHi5XIYPQFyax8El1UgAZr8IjCffazOZ/IDW44v8R9g/TcBIRiTyBGEHtsRIR3T5ylzjrW76PxINAHhUThTN7dYZ00DdDk/Hv/sexQ0C+fBEr+LgUKJdMIaENpEOWkeBvsK8OzOL2+MvZM+74h3LurNb/U= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=yaoma@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0W0JHSWK_1707396868; Received: from localhost.localdomain(mailfrom:yaoma@linux.alibaba.com fp:SMTPD_---0W0JHSWK_1707396868) by smtp.aliyun-inc.com; Thu, 08 Feb 2024 20:54:29 +0800 From: Bitao Hu To: dianders@chromium.org, akpm@linux-foundation.org, pmladek@suse.com, kernelfans@gmail.com, liusong@linux.alibaba.com Cc: linux-kernel@vger.kernel.org, yaoma@linux.alibaba.com Subject: [PATCHv6 0/2] *** Detect interrupt storm in softlockup *** Date: Thu, 8 Feb 2024 20:54:24 +0800 Message-Id: <20240208125426.70511-1-yaoma@linux.alibaba.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, guys. I have implemented a low-overhead method for detecting interrupt storm in softlockup. Please review it, all comments are welcome. Changes from v5 to v6: - Use "./scripts/checkpatch.pl --strict" to get a few extra style nits and fix them. - Squash patch #3 into patch #1, and wrapp the help text to 80 columns. - Sort existing headers alphabetically in watchdog.c - Drop "softlockup_hardirq_cpus", just read "hardirq_counts" and see if it's non-NULL. - Store "nr_irqs" in a local variable. - Simplify the calculation of "cpu_diff". Changes from v4 to v5: - Rearranging variable placement to make code look neater. Changes from v3 to v4: - Renaming some variable and function names to make the code logic more readable. - Change the code location to avoid predeclaring. - Just swap rather than a double loop in tabulate_irq_count. - Since nr_irqs has the potential to grow at runtime, bounds-check logic has been implemented. - Add SOFTLOCKUP_DETECTOR_INTR_STORM Kconfig knob. Changes from v2 to v3: - From Liu Song, using enum instead of macro for cpu_stats, shortening the name 'idx_to_stat' to 'stats', adding 'get_16bit_precesion' instead of using right shift operations, and using 'struct irq_counts'. - From kernel robot test, using '__this_cpu_read' and '__this_cpu_write' instead of accessing to an per-cpu array directly, in order to avoid this warning. 'sparse: incorrect type in initializer (different modifiers)' Changes from v1 to v2: - From Douglas, optimize the memory of cpustats. With the maximum number of CPUs, that's now this. 2 * 8192 * 4 + 1 * 8192 * 5 * 4 + 1 * 8192 = 237,568 bytes. - From Liu Song, refactor the code format and add necessary comments. - From Douglas, use interrupt counts instead of interrupt time to determine the cause of softlockup. - Remove the cmdline parameter added in PATCHv1. Bitao Hu (2): watchdog/softlockup: low-overhead detection of interrupt watchdog/softlockup: report the most frequent interrupts kernel/watchdog.c | 244 +++++++++++++++++++++++++++++++++++++++++++++- lib/Kconfig.debug | 13 +++ 2 files changed, 253 insertions(+), 4 deletions(-) -- 2.37.1 (Apple Git-137.1)