Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp355167imm; Fri, 1 Jun 2018 02:01:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJtEYPbVoC4ZGDyXGqgqBux1YqirBSnXXJH/aJpAi3u3dW4ksQHG9NuA0MgRNjtwnnOKtD7 X-Received: by 2002:a63:8f4f:: with SMTP id r15-v6mr8275248pgn.210.1527843677597; Fri, 01 Jun 2018 02:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527843677; cv=none; d=google.com; s=arc-20160816; b=wWfFi466j34RhpvAx6txIk34kaSWTlzczXVoNUgJW43BrD0i3Zh8XdoaB648Xe/H4l kHi9qOZyg0y//q5uw/zqNunFha7arQObW0Ld5y2fNB9VgIBztKqnnv13hbv6JJfZZ3pN Y+cKhquafZboLzfy2v/CQTu3chBKC7RzsnrcdZCewGZPr51khvCpziE2brb+06YU/CRQ R0BWwojgDSqrL8olnqK+9jsEqXkU0bC1UWjfj4je9psdE7rNGxSCVC1B8VmdUwZImW++ j/AejHe+1DhjvzKP5Ogf1qBWVwpMOeX7TsCAjVIalI92YJxb8PI9xd8shQ4fWCvqmJCT 9tQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=KT5gF6iQmzajR4cy5yPkIGeIaL3mb2OnUDGHA3e7oGo=; b=CPmsFe+EF1d08625NM082TYI4f5dmNxiU18yZwgMjv/ealXOvFiaAJOrjJpRLKOvJD TLuPQ+0Jp2QBisdi9Dfo3e+q+3oeemK0RlFPKHYodl1lFKjisEP4/G6BLk3DgiojTM+p q8clKRytKLVaWL4xBOhh1UoLzlJxlcBhKKOpCjtF4POsl+noXTYw9YqaaUkkiFeDJx6S yWjxptSCMbafFrbdvT5qAS12WVpVsecwMSnKWtsaIE4UggQbf7pBsh3tC+qXZvUw6AKS HuGUAqUkE+EEnu47V1jjDxl/sOn5cJabAWe0crHYE09qMPBo9GzRQLPjECskTrgsoL8v FKsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TeGCniyw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12-v6si17241886pgc.619.2018.06.01.02.01.02; Fri, 01 Jun 2018 02:01:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TeGCniyw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751085AbeFAJAh (ORCPT + 99 others); Fri, 1 Jun 2018 05:00:37 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:16381 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbeFAJAc (ORCPT ); Fri, 1 Jun 2018 05:00:32 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180601090030epoutp01527694586da788e0f2557268a89863f8~z-a-2cILf2066620666epoutp01_ for ; Fri, 1 Jun 2018 09:00:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180601090030epoutp01527694586da788e0f2557268a89863f8~z-a-2cILf2066620666epoutp01_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1527843630; bh=KT5gF6iQmzajR4cy5yPkIGeIaL3mb2OnUDGHA3e7oGo=; h=From:To:Cc:Subject:Date:References:From; b=TeGCniywGr70igCUWJ9/0UYwOxUk5XX8myiwRAapitXFmul2pEYVouaDJ6hjAYVNK YRsTyir9SNlKl9MeGvwu/MZwEv46j4+MfrHOmj+PsBhzBggwyByFNl+6m3ZnD3lJUC oUGUP+W/z2TGXtiG1YlU7ly1NsqGLIlNBd5KbDMo= Received: from epsmges5p2new.samsung.com (unknown [182.195.40.197]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20180601090030epcas5p23de55daabe06b9a8e3289eab09068206~z-a-IIulR1227412274epcas5p2R; Fri, 1 Jun 2018 09:00:30 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 46.A3.04409.D2B011B5; Fri, 1 Jun 2018 18:00:29 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20180601090029epcas5p3cc93d4bfbebb3199f0a2684058da7e26~z-a_jkmrI2993329933epcas5p3q; Fri, 1 Jun 2018 09:00:29 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180601090029epsmtrp2862a94dec593788bc6cd94770f7aef17~z-a_iJh-Z0785907859epsmtrp2b; Fri, 1 Jun 2018 09:00:29 +0000 (GMT) X-AuditID: b6c32a4a-aa5ff70000001139-35-5b110b2d9aa8 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id DE.65.03631.D2B011B5; Fri, 1 Jun 2018 18:00:29 +0900 (KST) Received: from localhost.localdomain (unknown [107.108.92.210]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180601090019epsmtip1c3aaf17a1fb1b054ae8fc0c8eab55a04~z-a1ezbgU2898028980epsmtip1F; Fri, 1 Jun 2018 09:00:18 +0000 (GMT) From: Maninder Singh To: pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, pankaj.m@samsung.com, v.narang@samsung.com, Maninder Singh Subject: [PATCH v2] printk: make sure to print log on console. Date: Fri, 1 Jun 2018 14:26:42 +0530 X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIKsWRmVeSWpSXmKPExsWy7bCmlq4ut2C0wYE9FhYXd6daXN41h83i 8Pw2Fot7b7YyWfx//JXVYl/HAyaLtZ8fs1scOjmX0YHDY+esu+weLftusXv0bVnF6LF+y1UW j8+b5AJYo1JtMlITU1KLFFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0y c4BOUVIoS8wpBQoFJBYXK+nb2RTll5akKmTkF5fYKkUbGhrpGRqY6xkZAWnTWCsjU6CShNSM 5rVGBeeEK17fX8/SwLibv4uRk0NCwESi7fZ55i5GLg4hgd2MEmcPzmOBcD4xSnTuOc4EUiUk 8I1R4mF7OUzH7g3/2SHiexklTv/zg2j4wijRs2gRWIJNQE9i1a49LCC2iIC7xKfvH9hAipgF JjFKfL+/BiwhLGAnMXPiJDCbRUBVYt3ayywQG+QkTh6bzArSICHQwSZxf8oCNpAEr0CZxI2e X0wQRS4Sv/b9YIawhSVeHd/CDmFLSXx+t5cNwi6W6HrfyAgxqIVR4u2XR1AN9hIPbhwFauAA OklTYv0ufZAwswCfRO/vJ0wgYQkBXomONiGIalWJlpsbWCFsaYnPHz9C3ekhcfb7SxZISMRK 7N5/lmUCo8wshKELGBlXMUqmFhTnpqcWmxYY5aWW6xUn5haX5qXrJefnbmIEJyctrx2My875 HGIU4GBU4uHV+MIfLcSaWFZcmXuIUYKDWUmEd0oZUIg3J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684058da7e26~z-a_jkmrI2993329933epcas5p3q@epcas5p3.samsung.com> X-CMS-MailID: 20180601090029epcas5p3cc93d4bfbebb3199f0a2684058da7e26 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180601090029epcas5p3cc93d4bfbebb3199f0a2684058da7e26 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch make sure printing of log on console if loglevel at time of storing log is less than current console loglevel. @why In SMP printk can work asynchronously, logs can be missed on console because it checks current log level at time of console_unlock, not at time of storing logs. func() { .... .... console_verbose(); // user wants to have all the logs on console. pr_alert(); dump_backtrace(); //prints with default loglevel. ... console_silent(); // stop all logs from printing on console. } Now if console_lock was owned by another process, the messages might be handled after the consoles were silenced. reused flag LOG_NOCONS as its usage is gone long back. (5c2992ee7fd8a29d04125dc0aa3522784c5fa5eb) Signed-off-by: Vaneet Narang Signed-off-by: Maninder Singh --- v1 -> v2: make changes simpler as suggested by Petr Mladek. use flag rather than changing structure of printk. kernel/printk/printk.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 2f4af21..4b059fe 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -349,7 +349,7 @@ enum con_msg_format_flags { */ enum log_flags { - LOG_NOCONS = 1, /* already flushed, do not print to console */ + LOG_NOCONS = 1, /* suppress print, do not print to console */ LOG_NEWLINE = 2, /* text ended with a newline */ LOG_PREFIX = 4, /* text started with a prefix */ LOG_CONT = 8, /* text is a fragment of a continuation line */ @@ -1886,6 +1886,9 @@ asmlinkage int vprintk_emit(int facility, int level, if (dict) lflags |= LOG_PREFIX|LOG_NEWLINE; + if (suppress_message_printing(level)) + lflags |= LOG_NOCONS; + printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len); logbuf_unlock_irqrestore(flags); @@ -2355,11 +2358,10 @@ void console_unlock(void) break; msg = log_from_idx(console_idx); - if (suppress_message_printing(msg->level)) { + if (msg->flags & LOG_NOCONS) { /* - * Skip record we have buffered and already printed - * directly to the console when we received it, and - * record that has level above the console loglevel. + * Skip record if !ignore_loglevel, and + * record has level above the console loglevel. */ console_idx = log_next(console_idx); console_seq++; -- 1.9.1