Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262541AbVCSOwn (ORCPT ); Sat, 19 Mar 2005 09:52:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262555AbVCSOwn (ORCPT ); Sat, 19 Mar 2005 09:52:43 -0500 Received: from mail-in-07.arcor-online.net ([151.189.21.47]:2192 "EHLO mail-in-07.arcor-online.net") by vger.kernel.org with ESMTP id S262541AbVCSOwS (ORCPT ); Sat, 19 Mar 2005 09:52:18 -0500 Date: Sat, 19 Mar 2005 15:56:32 +0100 (CET) From: Bodo Eggert <7eggert@gmx.de> To: linux-kernel@vger.kernel.org Subject: [PATCH 2.6.11.2][RFC] printk with antisp am-feature Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/Mixed; BOUNDARY="-1463760639-1199172649-1111188901=:4541" Content-ID: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7959 Lines: 237 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463760639-1199172649-1111188901=:4541 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: Issue: On some conditions, the dmesg is spammed with repeated warnings about the same issue which is neither critical nor going to be fixed. This may result in losing the boot messages or missing other important messages. Examples are: nfs warning: mount version older than kernel (my mount is newer than documented to be required) atkbd.c: Keyboard on isa0060/serio0 reports too many keys pressed. (I'm using a keyboard switch and a IBM PS/2 keyboard) program smartd is using a deprecated SCSI ioctl, please convert it to SG_IO (I'll use the latest version as soon as I need to) Rate-limiting these messages is won't help, since it would still allow these messages to (slowly or in a burst) spam the log. Printing these messages only once after booting might result in missing important messages, especially on long-running systems (e.g. if my keyboard really breaks after I have used the keyboard switch). Suggested solution: Instead, I decided to use a global flag with a semi-random magic number, which will indicate the last printk being supposed to be limited, and to reset this flag on each normal printk. By doing this, dmesg will not be spammed, but the latest issue is displayed last. (I suggest using the first value from "cksum file.c" as the magic number unless there are thousands of printks to convert.) The magic number depends on the CPU being able to read and write a complete int at once *or* being lucky not to have a magic value that can be constructed by combining some other magic numbers and printking with exactly that magic number while the update happens. I can convert the variable to an atomic type if it is a concern, but that would increase the chances of a clash due to the 24 bit limit. The patch increases the size of vmlinux by 141 bytes. -- The programmer's National Anthem is 'AAAAAAAAHHHHHHHH' ---1463760639-1199172649-1111188901=:4541 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="printk_nospam.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: ATTACHMENT; FILENAME="printk_nospam.patch" ZGlmZiAtdXByTiBsaW51eC0yLjYuMTEvZHJpdmVycy9ibG9jay9zY3NpX2lv Y3RsLmMgbGludXgtMi42LjExLm5ldy9kcml2ZXJzL2Jsb2NrL3Njc2lfaW9j dGwuYw0KLS0tIGxpbnV4LTIuNi4xMS9kcml2ZXJzL2Jsb2NrL3Njc2lfaW9j dGwuYwkyMDA1LTAzLTAzIDE1OjQxOjI4LjAwMDAwMDAwMCArMDEwMA0KKysr IGxpbnV4LTIuNi4xMS5uZXcvZHJpdmVycy9ibG9jay9zY3NpX2lvY3RsLmMJ MjAwNS0wMy0xOCAyMjowODozNS4wMDAwMDAwMDAgKzAxMDANCkBAIC01NDcs NyArNTQ3LDcgQEAgaW50IHNjc2lfY21kX2lvY3RsKHN0cnVjdCBmaWxlICpm aWxlLCBzdA0KIAkJICogb2xkIGp1bmsgc2NzaSBzZW5kIGNvbW1hbmQgaW9j dGwNCiAJCSAqLw0KIAkJY2FzZSBTQ1NJX0lPQ1RMX1NFTkRfQ09NTUFORDoN Ci0JCQlwcmludGsoS0VSTl9XQVJOSU5HICJwcm9ncmFtICVzIGlzIHVzaW5n IGEgZGVwcmVjYXRlZCBTQ1NJIGlvY3RsLCBwbGVhc2UgY29udmVydCBpdCB0 byBTR19JT1xuIiwgY3VycmVudC0+Y29tbSk7DQorCQkJcHJpbnRrX25vc3Bh bSgyMjk2MTU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SAtMTsN CiAvKiBGbGFnOiBjb25zb2xlIGNvZGUgbWF5IGNhbGwgc2NoZWR1bGUoKSAq Lw0KIHN0YXRpYyBpbnQgY29uc29sZV9tYXlfc2NoZWR1bGU7DQogDQorc3Rh dGljIGludCBhbnRpc3BhbV9tYWdpYzsNCisNCiAvKg0KICAqCVNldHVwIGEg bGlzdCBvZiBjb25zb2xlcy4gQ2FsbGVkIGZyb20gaW5pdC9tYWluLmMNCiAg Ki8NCkBAIC01MTcsNiArNTE5LDI0IEBAIGFzbWxpbmthZ2UgaW50IHByaW50 ayhjb25zdCBjaGFyICpmbXQsIC4NCiAJdmFfbGlzdCBhcmdzOw0KIAlpbnQg cjsNCiANCisJYW50aXNwYW1fbWFnaWMgPSAwOw0KKw0KKwl2YV9zdGFydChh cmdzLCBmbXQpOw0KKwlyID0gdnByaW50ayhmbXQsIGFyZ3MpOw0KKwl2YV9l bmQoYXJncyk7DQorDQorCXJldHVybiByOw0KK30NCisNCithc21saW5rYWdl IGludCBwcmludGtfbm9zcGFtKGludCBtYWdpYywgY29uc3QgY2hhciAqZm10 LCAuLi4pDQorew0KKwl2YV9saXN0IGFyZ3M7DQorCWludCByOw0KKwkNCisJ aWYgKG1hZ2ljID09IGFudGlzcGFtX21hZ2ljKQ0KKwkJcmV0dXJuIDA7DQor CWFudGlzcGFtX21hZ2ljID0gbWFnaWM7DQorDQogCXZhX3N0YXJ0KGFyZ3Ms IGZtdCk7DQogCXIgPSB2cHJpbnRrKGZtdCwgYXJncyk7DQogCXZhX2VuZChh cmdzKTsNCkBAIC01OTEsNiArNjExLDcgQEAgb3V0Og0KIAlyZXR1cm4gcHJp bnRlZF9sZW47DQogfQ0KIEVYUE9SVF9TWU1CT0wocHJpbnRrKTsNCitFWFBP UlRfU1lNQk9MKHByaW50a19ub3NwYW0pOw0KIEVYUE9SVF9TWU1CT0wodnBy aW50ayk7DQogDQogLyoqDQo= ---1463760639-1199172649-1111188901=:4541-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/