Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1915976rdb; Sun, 4 Feb 2024 06:52:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3FyzfB+oJGdoLhafvpmsr/qGSEqePcuh6qEl1Rstu+HvNT5sibz5Y1b7jC7AZmkhCK7ps X-Received: by 2002:a05:6512:ac3:b0:511:3c06:9369 with SMTP id n3-20020a0565120ac300b005113c069369mr4305815lfu.12.1707058339975; Sun, 04 Feb 2024 06:52:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707058339; cv=pass; d=google.com; s=arc-20160816; b=h8RVG/7fLaWzlY+LalbfL2JCSu2YalAGT0oIWMC2c1Ua+2Z79cly4HsJIZD1gNPaLl GNZYynujtFsof64JYdfilpE65m5KFsbGDgu1Vy/Ws/TS0xRGTPw7TnBPsmfSWC4x/Q2f 9HMFvxIjvHkOlCwpWAqgTQR2j4d0+dwJnI1xUkeOOGps0L9D6fkCRZor43Em9nrhK67R a4bBNQGFDUSiU8ukOk52e+ZftMl2ptTq6gkAb2qsDswOcOqeUnaGHSxh7jpn6qrlsjrP 3kscsJpCKTwX6GDQoTTL+Bc3aWusn4rQjGX6RTiixRKDBlta4m1PQojT59NftbsZL8+N MWmw== 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=Qvz8jSNlW0u04VWtHyitrAixmhwD3hvNY7pKyKG/fR0=; fh=EEIOieBl0iltof0v1i7S/eK7SbLCDzCRgBcEUVAPtyw=; b=Qv40ZB0/A2D1mnOSl6yqNKh9CPDHAcbSwRJpxPBfum8ej4BCGhNodgFZvgctkdmWUe Rup2UmOHRlP5/qY8mWyzXtadvwBHgKzrw7lrcjQz4wCpRxy3jKZNnax9OHBtlqthKOej GMoDZUyhivE/WZRCDNFICb2RjXz2Oun8xAeZai9LycFOS7YpUUcRMUIsObKN7ZNdRXEG m3SSNGyX6tzbOOr+GbZXcOnPsgCBsSeyDeRBwVuxjNLpqh6ih2rmAkvtQ/c3820jI4J5 XQ8xPsDEERLM3692aDgrzesnNhT5q8Qv13kX9ZQAWRq9CF8udhTNQCrM1LFba53dp47a h8fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=TXX8Cq8F; 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-51731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51731-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=1; AJvYcCVID7G0y2erwp9KS/spba6RWQvnJHiAH0OS9vy2VDahPZvx7sTWnbY31rvGfzYqfy1M73M0YNAZq0ozgvgNoRKZO+lOSS88g4JgkxZDjA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k16-20020a1709065fd000b00a370412769esi2731232ejv.742.2024.02.04.06.52.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 06:52:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=TXX8Cq8F; 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-51731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51731-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 920EF1F219CD for ; Sun, 4 Feb 2024 14:52:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99619224F2; Sun, 4 Feb 2024 14:52:10 +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="TXX8Cq8F" Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (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 25B2122307 for ; Sun, 4 Feb 2024 14:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707058329; cv=none; b=L6kZW7fKgIi6WUFpFAZomBzatNcHD5Zq1y0YA7tRiNfdjWOYgNilp+FmXGre/RLzvSGBZY/FGP9X7fvVWgKIfi85gsBE2J44vuIvVi8ywTe1a627YS+ndlC/oT57WlX7SF1dRv4We1PPBHYWnfHHQ4j+ZLNru0MAiBpoaOVYliw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707058329; c=relaxed/simple; bh=0JcXOqJwgvaXB3q5MnlBmpdl74RAVdFizWUXVAVwj+4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=BJoccEoZ90fEhXO4qQS/tfeYOwhHB9nm6illtRBucOW7N1vP/aHzVw4oBBug5JDwzNaXjVbqXm5ARE6DLK+YWJBheN9xfe3oz24BmT2fovM+35fAubEabVt2HvnJ2gHqOxkWRp8FSwP+GbldATmWqC3RBfxIh2EZjrf1egJtTVE= 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=TXX8Cq8F; arc=none smtp.client-ip=115.124.30.100 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=1707058319; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; bh=Qvz8jSNlW0u04VWtHyitrAixmhwD3hvNY7pKyKG/fR0=; b=TXX8Cq8F8NkvI5mKGUIA5HisvdVDFtzstalTSNCNFgMl2tEwhdLq8Iehuaatgjckrv3XA31Xuk6VGsvMI1x/RzQsvgqqhf0EXU82ovyD+E90MQjmhdjcaQtaIy2/pcu7c8DhuqfSD9Lz8YNQa/iCwKDMVUMvVcgyxm4cwRpyvr4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;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_---0W00xOyM_1707058317; Received: from localhost.localdomain(mailfrom:yaoma@linux.alibaba.com fp:SMTPD_---0W00xOyM_1707058317) by smtp.aliyun-inc.com; Sun, 04 Feb 2024 22:51:59 +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: [PATCHv4 0/3] *** Detect interrupt storm in softlockup *** Date: Sun, 4 Feb 2024 22:51:51 +0800 Message-Id: <20240204145154.11069-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 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 (3): watchdog/softlockup: low-overhead detection of interrupt watchdog/softlockup: report the most frequent interrupts watchdog/softlockup: add SOFTLOCKUP_DETECTOR_INTR_STORM Kconfig knob kernel/watchdog.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 13 +++ 2 files changed, 260 insertions(+) -- 2.37.1 (Apple Git-137.1)