All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milind Arun Choudhary <milindchoudhary@gmail.com>
To: Roland Dreier <rdreier@cisco.com>
Cc: Kernel Janitors <kernel-janitors@lists.osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrw Morton <akpm@linux-foundation.org>
Subject: Re: [KJ] [PATCH]Rocket port:use mutex instead of binary  semaphore
Date: Mon, 16 Apr 2007 18:53:57 +0000	[thread overview]
Message-ID: <20070416184157.GC9314@arun.site> (raw)
In-Reply-To: <adabqho8b65.fsf@cisco.com>

On 10:46 Mon 16 Apr     , Roland Dreier wrote:
>  > -	down_interruptible(&info->write_sem);
>  > +	if(mutex_lock_interruptible(&info->write_lock)){
>  > +		return -ERESTARTSYS;
>  > +	}
> 
> 1) This is a semantic change.  Of course using down_interruptible()
> without checking the return value is almost certainly a bug, but have
> you thought about whether returning ERESTARTSYS is correct here?  If
> you have, then please include the reasoning in your patch description.
> (Another possibility would be to just use an uninterruptible mutex_lock())
no,frankly not much..
and something which i didn't understand is
why a down  in one control path & an down_interruptible in other?

but i had in mind,which you rightly pointed out 
handling the return from _interruptible.

i have some bits and pieces of information regarding thie,
searching for more, and correction to my current understanding,
  so that i can make something meaningfull out of it.

earlier kernels used to return in EINTR & it was up to the use space to 
handle the interrupted system call. ..reissue..


then ERESTARTSYS mechanism was added and the kernel could restart the 
syscall on its own

so its up to us whether we want the interruption to be taken care by 
the userspace or kernel.
i.e return EINTR or ERESTARTSYS respectively.
CMIIW.


also i read somewhere that
ERESTARTSYS should never be seen by user space code.  The kernel should
either restart the current syscall or convert the code to EINTR before
returning to user space.  If you are seeing ERESTARTSYS in user space
then it is a kernel bug.


> 2) The coding style for the if statement is not quite right.  The
> correct way is to do
> 
> 	if (condition)
> 		one_liner;
> 
> (note the space between the 'if' and the '(', and no braces used)
> 
ok.. got it..

-- 
Milind Arun Choudhary
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

WARNING: multiple messages have this Message-ID (diff)
From: Milind Arun Choudhary <milindchoudhary@gmail.com>
To: Roland Dreier <rdreier@cisco.com>
Cc: Kernel Janitors <kernel-janitors@lists.osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrw Morton <akpm@linux-foundation.org>
Subject: Re: [KJ][PATCH]Rocket port:use mutex instead of binary  semaphore
Date: Tue, 17 Apr 2007 00:11:57 +0530	[thread overview]
Message-ID: <20070416184157.GC9314@arun.site> (raw)
In-Reply-To: <adabqho8b65.fsf@cisco.com>

On 10:46 Mon 16 Apr     , Roland Dreier wrote:
>  > -	down_interruptible(&info->write_sem);
>  > +	if(mutex_lock_interruptible(&info->write_lock)){
>  > +		return -ERESTARTSYS;
>  > +	}
> 
> 1) This is a semantic change.  Of course using down_interruptible()
> without checking the return value is almost certainly a bug, but have
> you thought about whether returning ERESTARTSYS is correct here?  If
> you have, then please include the reasoning in your patch description.
> (Another possibility would be to just use an uninterruptible mutex_lock())
no,frankly not much..
and something which i didn't understand is
why a down  in one control path & an down_interruptible in other?

but i had in mind,which you rightly pointed out 
handling the return from _interruptible.

i have some bits and pieces of information regarding thie,
searching for more, and correction to my current understanding,
  so that i can make something meaningfull out of it.

earlier kernels used to return in EINTR & it was up to the use space to 
handle the interrupted system call. ..reissue..


then ERESTARTSYS mechanism was added and the kernel could restart the 
syscall on its own

so its up to us whether we want the interruption to be taken care by 
the userspace or kernel.
i.e return EINTR or ERESTARTSYS respectively.
CMIIW.


also i read somewhere that
ERESTARTSYS should never be seen by user space code.  The kernel should
either restart the current syscall or convert the code to EINTR before
returning to user space.  If you are seeing ERESTARTSYS in user space
then it is a kernel bug.


> 2) The coding style for the if statement is not quite right.  The
> correct way is to do
> 
> 	if (condition)
> 		one_liner;
> 
> (note the space between the 'if' and the '(', and no braces used)
> 
ok.. got it..

-- 
Milind Arun Choudhary

  reply	other threads:[~2007-04-16 18:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16 17:41 [KJ][PATCH]Rocket port:use mutex instead of binary semaphore Milind Arun Choudhary
2007-04-16 17:53 ` [KJ] [PATCH]Rocket " Milind Arun Choudhary
2007-04-16 17:46 ` Roland Dreier
2007-04-16 17:46   ` [KJ][PATCH]Rocket " Roland Dreier
2007-04-16 18:41   ` Milind Arun Choudhary [this message]
2007-04-16 18:53     ` [KJ] [PATCH]Rocket " Milind Arun Choudhary

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=20070416184157.GC9314@arun.site \
    --to=milindchoudhary@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.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 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.