All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKIYAMA Nobuyuki <akiyama.nobuyuk@jp.fujitsu.com>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NMI trigger switch support for debugging
Date: Wed, 26 May 2004 22:42:47 +0900	[thread overview]
Message-ID: <40B49ED7.6030200@jp.fujitsu.com> (raw)
In-Reply-To: <16564.26285.431229.665902@alkaid.it.uu.se>

Hi Mikael,

Thank you for reviewing.

Mikael Pettersson wrote:

>AKIYAMA Nobuyuki writes:
> > +int unknown_nmi_panic = 0;
>
>It's a kernel coding standard to _not_ explicitly initialise
>static-extent data to zero.
>
>  
>
OK, thanks.

> > +/*
> > + * proc handler for /proc/sys/kernel/unknown_nmi_panic
> > + */
> > +int proc_unknown_nmi_panic(ctl_table *table, int write,
> > +                struct file *file, void __user *buffer, size_t *length)
> > +{
> > +	int old_state;
> > +
> > +	old_state = unknown_nmi_panic;
> > +	proc_dointvec(table, write, file, buffer, length);
> > +	if (!old_state == !unknown_nmi_panic)
> > +		return 0;
>
>This conditional looks terribly obscure.
>Can you simplify it or explain your intention here?
>
>  
>
This code checks whether unknown_nmi_panic is changed to another state.
Only when state is changed, I'd like to go next step.

old_state  unknown_nmi_panic   condition
0          0                 : TRUE(no change, return)
none zero  none zero         : TRUE(no change, return)
0          none zero         : FALSE(changed, go next step)
none zero  0                 : FALSE(changed, go next step)


> > +	if (unknown_nmi_panic) {
> > +		if (reserve_lapic_nmi() < 0) {
> > +			unknown_nmi_panic = 0;
> > +			return -EBUSY;
> > +		} else {
> > +			set_nmi_callback(unknown_nmi_panic_callback);
> > +		}
> > +	} else {
> > +		release_lapic_nmi();
>
>You're invoking release_lapic_nmi() in response to user
>input, without having verified that _you_ had done a
>reserve_lapic_nmi() before.
>  
>

The only one user can obtain NMI callback.
If unknown_nmi_panic is 0 at this step, it says that I have obtained
NMI callback before.
So, I think invoking release_lapic_nmi() has no problem.


Regards,
Nobuyuki Akiyama



  reply	other threads:[~2004-05-26 13:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-24  9:21 [PATCH] NMI trigger switch support for debugging AKIYAMA Nobuyuki
2004-05-24  9:34 ` Andrew Morton
2004-05-26  1:36   ` AKIYAMA Nobuyuki
2004-05-26  1:41     ` Andrew Morton
2004-05-26  2:28       ` AKIYAMA Nobuyuki
2004-05-26  2:37         ` Andrew Morton
2004-05-26 12:17           ` AKIYAMA Nobuyuki
2004-05-26 12:52           ` Maciej W. Rozycki
2004-05-27  8:43           ` AKIYAMA Nobuyuki
2004-05-26  9:43         ` Mikael Pettersson
2004-05-26 13:42           ` AKIYAMA Nobuyuki [this message]
2004-05-26 20:34           ` Paul Jackson
2004-05-26 21:04             ` Mikael Pettersson
2004-05-24 10:01 ` [PATCH] typo in drivers/usb/class/usblp.c Benoît Dejean
     [not found] <1ZjWz-sq-11@gated-at.bofh.it>
     [not found] ` <1Zk6a-z2-3@gated-at.bofh.it>
     [not found]   ` <1ZVyO-63D-25@gated-at.bofh.it>
     [not found]     ` <1ZVIq-69O-3@gated-at.bofh.it>
     [not found]       ` <1ZWuM-6Nz-1@gated-at.bofh.it>
     [not found]         ` <1ZWEt-6Uw-1@gated-at.bofh.it>
2004-05-26 11:23           ` [PATCH] NMI trigger switch support for debugging Andi Kleen

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=40B49ED7.6030200@jp.fujitsu.com \
    --to=akiyama.nobuyuk@jp.fujitsu.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.