From patchwork Wed Jan 8 07:57:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bijie Xu X-Patchwork-Id: 13930267 X-Patchwork-Delegate: bhelgaas@google.com Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2117.outbound.protection.outlook.com [40.107.237.117]) (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 75CAA1A9B48; Wed, 8 Jan 2025 07:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736323046; cv=fail; b=D9rbtlgG3m3vGOGf8IwJKlNvWagP8txTTeE2Gx4R53Hx1WNE8ANh0qy873lRxZA5iMJ6CuogJTi7xdzTcRCJLVSIKddx5/r9t6Nuy1hJVKuCX2mCXGVkeWF7YtXeXgG0juBAyESYo6WSKZjoopOkZ0DlA2t4K2srr8WcOgFgrUc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736323046; c=relaxed/simple; bh=x6aUds+imnqkdL+UsskxJpdGXrxMkpXs88wxEwhpLuA=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=qKcPbSt+ubQ5QIEDrh1W3noQewYMgAEzUB4+g7v+tsI1tORUhT8zq/Klp2l87H1EcAXqJ69IRAIcDydnhWIbp26BwtPlEdif8w2W1ctTJNDFDm3gaBcHbqY4cGd+przpbi4dCTpVFxcJm2x/DEC67v7JYlUQmicSZ3DESnyZ8f0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=corigine.com; spf=pass smtp.mailfrom=nephogine.com; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b=ZSxlgXT3; arc=fail smtp.client-ip=40.107.237.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=corigine.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nephogine.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b="ZSxlgXT3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TrbxKEXeLou1sh0nwv/e2I2xqMABvaBs41v35tTvuASJzdNtobaFIafg7UAZXxxGfV5/IuELxOO/NZh+Jci/rIxKViYcGYkiGmROyRArde9JyvpqIym3NhbzLhzqI28E/DpqjvITvE5n5C1CPap96HAat+RwsAP++c6dzcDmvCDt4qlV4LOf6kKkS+Ud+ilkIGhEIsRMPKNVX8oQ9SmsV/YN9zdbXLFmeSpopQZv/MZSdAhpnfibG3Jj7LyQsXzlKiwk3a/gDOxw8k9Vzyg5A9yNdBJEBfo1fxunJpHJRMcfGKvZP+VzeQ22uCDT2wH2uajmYdKDnXJru5DQviMfMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CFCqgyY68b17w7CNKXux6FJp1PUHbra2FysB8lRBS8g=; b=SChSI6Uhw+fA15zGzuYxlfwzclqYmqYNCl4PDhdYt02eGdy355ZwSZTWfmK3+lS82X81yoUP/LRyYWxwR3h06a9/mKv/a+7cptajbIX3772KFwXGr3Apw/Ks5IN4sjwwTCWApbdYsOgDaj2Zm0THauJw9kM/xQRQUL2UZ6z6mh3qNVUd9M9Wj7JTFbD+H18BLEtHnEPL+7we+u8Qu8akmAxIoh03mJ1l5W3E8DNwJPnk8eyBpHhmHxnMx+GCwj/8cqJTPFPtQa1hDCbaFWUrsUkixFUyYtSSg9bqLa3qlEPrJZh4AJt3CHy2EtwAyu8cxpgaLoefPYpHdm21NQ++iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nephogine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CFCqgyY68b17w7CNKXux6FJp1PUHbra2FysB8lRBS8g=; b=ZSxlgXT3KmsVyI5xgECVbQsyVfLMtrRgdETL7tUiDmfYNqh/Et0YgGyns9tqI4XP7q8cgVrWTiFAhv2pOi1YsQlKcpOuz1nt0xErnU58G+aXkfmEkboD7UuvvE2EfNwLafYzbaPBiiHjUzvv4Ks8efVUBFF13Cnsir9MtQt0E64= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ2PR13MB6402.namprd13.prod.outlook.com (2603:10b6:a03:556::19) by LV8PR13MB6448.namprd13.prod.outlook.com (2603:10b6:408:181::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Wed, 8 Jan 2025 07:57:16 +0000 Received: from SJ2PR13MB6402.namprd13.prod.outlook.com ([fe80::b60f:7bf:db6b:5bba]) by SJ2PR13MB6402.namprd13.prod.outlook.com ([fe80::b60f:7bf:db6b:5bba%3]) with mapi id 15.20.8335.010; Wed, 8 Jan 2025 07:57:16 +0000 From: Bijie Xu To: oohall@gmail.com Cc: bijie.xu@corigine.com, mahesh@linux.ibm.com, bhelgaas@google.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI/AER: Add kernel.aer_print_skip_mask to control aer log Date: Wed, 8 Jan 2025 15:57:03 +0800 Message-Id: <20250108075703.410961-1-bijie.xu@corigine.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To SJ2PR13MB6402.namprd13.prod.outlook.com (2603:10b6:a03:556::19) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR13MB6402:EE_|LV8PR13MB6448:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c3cbbb1-4c93-4c14-4d41-08dd2fba119f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: G9ZZrhkU+4mRqlV6F25kr3R7Xbvr7W1rjXuqotNLczx7MPzqUq0F9aZO4XbPSHq2TEakcfihiSeuH+9ceV29D5A+sXPbdPAK7lgva0mQD12RGW6j9QU9JJv9wKk984AqgSuDvKc9UvIx1e3ghG8bgCk/6notkJzHNrwPkXqFOj5QDwQH48vSer4i+pxnuQRBR2NoDghkkG03XaR9Pa+QkqORf8BKs4hqSHgdiXAtUtXRW5wp4rcpFMZkQRZcHoBuJmr40DgETQY/ybEUDUUiVZpTdrR7/jEnPlb4abxuCEwsc90O3NdRZbEexP1y1kNPIR93AMJOa8m+Y8WVxAzVLFesqmlhPddweP1oJUumQIPwtUpExBjr2AMVbx41C89OlDeKHuzI05Rv5taVoHwl3ZsqKYX5hJrqh+lloe81mFGfRva1aysCq2zKdnYw4E0Ek1yQnMoSwNf6UJY8iyOtKa4gn5ngVUDcpuxRrDqqtVser+QoYJ1Kpjqg9sOhZE+S3atG19g/+OvUKMiWl0B5giq/hOMDV7T6YN7K6wRNvVQjgHN7RyAj7kdkiQpTs7W71ZrEDuCQK6cuiDhjrK4cg/8XDeUT0KGoXw4Tbj2RbgAJrJ/xcuASBA5MbtvCVCMThskAeZC9ujXfnnZBJxkZIsuuiX/9a9WZA6+nNe3kY/BY7VZ7RaXXcglna4zkGnBqbb2OM0DI4hGI8/pzRmvyWPQR3OOaigncVNy6DZiAaA2saIRDW0YQeyJAFjkfIr08hpe2EjcdauLT4BF/5EJiY1yG0Qplj0u65PYYHoHyGyfH9vJSbd9LYey66E08jR8sgFtYHVyh06iZTt+zGJwHXKBRpJEZGghH4r8ljbJaeDwnHmYW5kTM1Oas33FpHP8TpGWq4AirG/VNBryE+0hSKowWzhqm1l1hl1ihEgb/LndjeE1XQCDd6jq8/4YOh1cY2WzZzARlj4PSkeDPpXyUolVOskhj5gHCJUJ/EVj7FYehzOppgFJ9gmMbltZUEwENtQO5UHDbPltidcahDzuht50mhVi+7vsBJCnuLYJUtnnQZBwt2j9oFr8mjr20cXzJlIXrmvn1QKG9qPQJV/2qqIvn/BN0a0vg4RTbh1UkPzFukqeoqU1cx3K5x04MZ45DcpqvYEinAaBcRow8hjIhKu9661g7IGVBE/A0OBVwXtg8/A1SmAor3K6a4IiN4ydaxcqgvdnZqxjZJfD9EfOA6JKZSgJP5Mrjw32BwLKSvTr2sWLPFwFgAIbuoJrRpW6jWV6pkz08qWHxduuneS72oZVlg8O0cV9cRbUuHEo2izjp/g+ixMx+yHDrvNxbVzTHzg1Kps8OZLcVzN1iWPBAEO82QxeKtpu5JdaFkSYBDiqSe7HykxM9AEnD0EJRaje5iGzXmA0gsRzudijB8Cb0wwWwI+I/bf+5fl4u4XHU3sQhcNye8Z/aAyI56LjCfuz1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR13MB6402.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS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SzN6Jy3CU6OECpI0rCfhmXAbWcxIoBYmKzqjpYo1eX/P5t2EIa1j2Vp4j6aUzMa/cmRIIDqiTKN5UPVfR06S4SvYly9f5w06gnOrj4ozkTSEb2s0zv88AClZUqi2ryd6qhKuDXiaQAf4DbuKHUJ4XChkoTItjKrAGtKNUUbJ3+QB6ScMOM1XCNO1K8SICDGhw75I3t6A7aSFmVOrkH7NZgjKM4QSKeP6FFf37wS6Ghbz5HqFeYP7+vPr/O9h/1m8cR3U/oWPrN7V8hoXyKEecNk9+lHskGFITbPItUv7DmzW5RWzrx+IgTSJEy2X4gmuk9fu6CdmfFBLqkgyOvt1VIDPg9pWX4e9VkugS+g79ng+BpegmIGoPw49ChRe/W+dAdHNLMSheCwfUE/Cx9TPYVhtLWPm1hlYlH/q/w4kqd6oqT1jKmA6iRXEsHA07Rqe/lyoUS1Jx6BGNRtLj9Mez4p5YyqT1FI/4EnBCa3kEpt13DYmkl2y6ndP3T0PIPR1tS9+MTfU921eGv5PN7G2nSzR4zO7XTSADEBp/c3wC2Vjqe3IR1hpEDtFCrLlg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c3cbbb1-4c93-4c14-4d41-08dd2fba119f X-MS-Exchange-CrossTenant-AuthSource: SJ2PR13MB6402.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2025 07:57:16.4211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6Y14LaNg5g+46dfZ2gbewWyv8/r71nQ9KSHznHrLcVHQWWHyWAEHv2SYZWe8On3w/dCiOYZC1K5DPpFagAjpug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR13MB6448 Sometimes certain PCIE devices installed on some servers occasionally produce large number of AER correctable error logs, which is quite annoying. Add this sysctl parameter kernel.aer_print_skip_mask to skip printing AER errors of certain severity. The AER severity can be 0(NONFATAL), 1(FATAL), 2(CORRECTABLE). The 3 low bits of the mask are used to skip these 3 severities. Set bit 0 can skip printing NONFATAL AER errors, and set bit 1 can skip printing FATAL AER errors, set bit 2 can skip printing CORRECTABLE AER errors. And multiple bits can be set to skip multiple severities. Signed-off-by: Bijie Xu --- drivers/pci/pcie/aer.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 80c5ba8d8296..b46973526bcf 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -698,6 +698,7 @@ static void __aer_print_error(struct pci_dev *dev, pci_dev_aer_stats_incr(dev, info); } +unsigned int aer_print_skip_mask __read_mostly; void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { int layer, agent; @@ -710,6 +711,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) goto out; } + if ((1 << info->severity) & aer_print_skip_mask) + goto out; + layer = AER_GET_LAYER_ERROR(info->severity, info->status); agent = AER_GET_AGENT(info->severity, info->status); @@ -1596,3 +1600,22 @@ int __init pcie_aer_init(void) return -ENXIO; return pcie_port_service_register(&aerdriver); } + +static const struct ctl_table aer_print_skip_mask_sysctls[] = { + { + .procname = "aer_print_skip_mask", + .data = &aer_print_skip_mask, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = &proc_douintvec, + }, + {} +}; + +static int __init aer_print_skip_mask_sysctl_init(void) +{ + register_sysctl_init("kernel", aer_print_skip_mask_sysctls); + return 0; +} + +late_initcall(aer_print_skip_mask_sysctl_init);