From: bing deng <deng8bing@gmail.com>
To: shuox.liu@intel.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Borislav Petkov <bp@alien8.de>,
Yanmin Zhang <yanmin_zhang@linux.intel.com>,
"Luck, Tony" <tony.luck@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
"andi@firstfloor.org" <andi@firstfloor.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH v7 1/2] printk: add interface for disabling recursion check
Date: Thu, 7 Jun 2012 13:19:16 +0000 [thread overview]
Message-ID: <CAO6yerJVKgjHe9LBL1ZfcMUzqHA5iZwSf2La+hf19QBDEQ-L0w@mail.gmail.com> (raw)
In-Reply-To: <4FD01896.1010506@intel.com>
On Thu, Jun 7, 2012 at 2:57 AM, ShuoX Liu <shuox.liu@intel.com> wrote:
> From: ShuoX Liu <shuox.liu@intel.com>
>
> With some special scenario, such as Machine Check Exception happened
> in printk, we want to bypass printk recursion check to printk some
> important information. So we add these interfaces of printk.
>
> 1) printk_recursion_check_disable() for disabling recursion check
> 2) printk_recursion_check_enable() for enabling recursion check
>
> Signed-off-by: Yanmin Zhang <yanmin_zhang@linux.intel.com>
> Signed-off-by: ShuoX Liu <shuox.liu@intel.com>
> ---
> include/linux/printk.h | 3 +++
> kernel/printk.c | 17 ++++++++++++++++-
> 2 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 1bec2f7..da48ec7 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -42,6 +42,9 @@ static inline void console_verbose(void)
> console_loglevel = 15;
> }
>
> +void printk_recursion_check_disable(void);
> +void printk_recursion_check_enable(void);
> +
> struct va_format {
> const char *fmt;
> va_list *va;
> diff --git a/kernel/printk.c b/kernel/printk.c
> index 32462d2..0580f67 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -78,6 +78,19 @@ int console_printk[4] = {
> int oops_in_progress;
> EXPORT_SYMBOL(oops_in_progress);
>
> +static atomic_t recursion_check_disabled = ATOMIC_INIT(0);
> +
> +void printk_recursion_check_disable(void)
> +{
> + atomic_inc(&recursion_check_disabled);
> +}
> +
> +void printk_recursion_check_enable(void)
> +{
> + WARN_ON(atomic_read(&recursion_check_disabled) < 1);
> + atomic_dec(&recursion_check_disabled);
> +}
> +
> /*
> * console_sem protects the console_drivers list, and also
> * provides serialisation for access to the entire console
> @@ -1295,7 +1308,9 @@ asmlinkage int vprintk_emit(int facility, int level,
> * recursion and return - but flag the recursion so that
> * it can be printed at the next appropriate moment:
> */
> - if (!oops_in_progress && !lockdep_recursing(current)) {
> + if (!atomic_read(&recursion_check_disabled)
> + && !oops_in_progress
> + && !lockdep_recursing(current)) {
> recursion_bug = 1;
> goto out_restore_irqs;
> }
> --
> 1.7.1
>
> --
> 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/
Hi Shuo,
Should the two function be export by EXPORT_SYMBOL? The the other
module can use it.
--
Best Regards,
Bing
next prev parent reply other threads:[~2012-06-07 13:19 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 1:58 [PATCH] printk: ignore recursion_bug flag when MCE in progress ShuoX Liu
2012-05-23 10:01 ` Borislav Petkov
2012-05-24 0:38 ` Yanmin Zhang
2012-05-24 5:59 ` [PATCH v2] printk: ignore recursion_bug flag in HW error handle process ShuoX Liu
2012-05-24 6:11 ` Borislav Petkov
2012-05-24 22:56 ` Andrew Morton
2012-05-25 0:30 ` Yanmin Zhang
2012-05-25 7:19 ` [PATCH 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-05-25 7:21 ` [PATCH 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-05-25 7:41 ` Borislav Petkov
2012-05-25 8:00 ` ShuoX Liu
2012-05-28 2:07 ` ShuoX Liu
2012-05-30 9:08 ` Borislav Petkov
2012-05-31 0:30 ` Yanmin Zhang
2012-06-04 3:04 ` [PATCH v4 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-04 3:07 ` [PATCH v4 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-22 23:41 ` Andrew Morton
2012-06-26 20:45 ` Borislav Petkov
2012-05-25 16:09 ` [PATCH 1/2] printk: add interface for disabling recursion check Luck, Tony
2012-05-28 0:30 ` Yanmin Zhang
2012-05-28 2:54 ` [PATCH v3 " ShuoX Liu
2012-05-28 2:56 ` [PATCH v3 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-04 17:12 ` Borislav Petkov
2012-06-05 0:32 ` Yanmin Zhang
2012-06-05 8:14 ` Borislav Petkov
2012-06-05 9:53 ` [PATCH v5 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-05 9:55 ` [PATCH v5 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-05 15:15 ` Borislav Petkov
2012-06-06 0:36 ` Yanmin Zhang
2012-06-06 8:31 ` [PATCH v6 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-06 8:34 ` [PATCH v6 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-06 15:22 ` Borislav Petkov
2012-06-07 2:13 ` Yanmin Zhang
2012-06-07 2:57 ` [PATCH v7 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-07 3:00 ` [PATCH v7 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-08 12:34 ` Borislav Petkov
2012-06-25 9:17 ` Ingo Molnar
2012-06-25 13:14 ` Peter Zijlstra
2012-06-26 20:43 ` Borislav Petkov
2012-06-07 13:19 ` bing deng [this message]
2012-06-07 13:38 ` [PATCH v7 1/2] printk: add interface for disabling recursion check Borislav Petkov
2012-06-08 12:30 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAO6yerJVKgjHe9LBL1ZfcMUzqHA5iZwSf2La+hf19QBDEQ-L0w@mail.gmail.com \
--to=deng8bing@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=shuox.liu@intel.com \
--cc=tony.luck@intel.com \
--cc=yanmin_zhang@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).