All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Darren Hart <dvhart@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	ccross@android.com, Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/futex.c: notice the return value after rt_mutex_finish_proxy_lock() fails
Date: Tue, 03 Sep 2013 13:10:25 +0800	[thread overview]
Message-ID: <52256F41.6010208@asianux.com> (raw)
In-Reply-To: <5214387A.6050702@asianux.com>

Hello Maintainers:

Please help check this patch, when you have time.


Thanks.

On 08/21/2013 11:48 AM, Chen Gang wrote:
> On 08/21/2013 12:19 AM, Darren Hart wrote:
>> HopingOn Tue, 2013-08-20 at 11:07 +0800, Chen Gang wrote:
>>
>>
>> Hi Chen,
>>
>>> rt_mutex_finish_proxy_lock() can return failure code (e.g. -EINTR,
>>> -ETIMEDOUT).
>>>
>>> Original implementation has already noticed about it, but not check it
>>> before next work.
>>>
>>> Also let coments within 80 columns to pass "./scripts/checkpatch.pl".
>>>
>>>
>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>> ---
>>>  kernel/futex.c |   30 ++++++++++++++++--------------
>>>  1 files changed, 16 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/kernel/futex.c b/kernel/futex.c
>>> index c3a1a55..1a94e7d 100644
>>> --- a/kernel/futex.c
>>> +++ b/kernel/futex.c
>>> @@ -2373,21 +2373,23 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
>>>  		ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1);
>>>  		debug_rt_mutex_free_waiter(&rt_waiter);
>>>  
>>> -		spin_lock(q.lock_ptr);
>>> -		/*
>>> -		 * Fixup the pi_state owner and possibly acquire the lock if we
>>> -		 * haven't already.
>>> -		 */
>>> -		res = fixup_owner(uaddr2, &q, !ret);
>>
>>
>> This call catches a corner case which appears to be skipped now. Or am I
>> missing how you accounted for that?
>>
>>
> 
> Pardon ?
> 
> Hmm... this patch lets related code block in "if(!ret) {...}", should
> not remove any code.
> 
> Please help check again for whether what I have done is correct or not.
> 
> Thanks.
> 
>>> -		/*
>>> -		 * If fixup_owner() returned an error, proprogate that.  If it
>>> -		 * acquired the lock, clear -ETIMEDOUT or -EINTR.
>>> -		 */
>>> -		if (res)
>>> -			ret = (res < 0) ? res : 0;
>>> +		if (!ret) {
>>> +			spin_lock(q.lock_ptr);
>>> +			/*
>>> +			 * Fixup the pi_state owner and possibly acquire the
>>> +			 * lock if we haven't already.
>>> +			 */
>>> +			res = fixup_owner(uaddr2, &q, !ret);
>>> +			/*
>>> +			 * If fixup_owner() returned an error, proprogate that.
>>> +			 * If it acquired the lock, clear -ETIMEDOUT or -EINTR.
>>> +			 */
>>> +			if (res)
>>> +				ret = (res < 0) ? res : 0;
>>>  
>>> -		/* Unqueue and drop the lock. */
>>> -		unqueue_me_pi(&q);
>>> +			/* Unqueue and drop the lock. */
>>> +			unqueue_me_pi(&q);
>>> +		}
>>>  	}
>>>  
>>>  	/*
>>
>> Thanks,
>>
> 
> 


-- 
Chen Gang

  reply	other threads:[~2013-09-03  5:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  3:07 [PATCH] kernel/futex.c: notice the return value after rt_mutex_finish_proxy_lock() fails Chen Gang
2013-08-20 16:19 ` Darren Hart
2013-08-21  3:48   ` Chen Gang
2013-09-03  5:10     ` Chen Gang [this message]
2013-09-12 14:32 ` Thomas Gleixner
2013-09-12 22:37   ` Darren Hart
2013-09-12 23:36     ` Thomas Gleixner
2013-09-13  1:52       ` Chen Gang
2013-10-07  5:14         ` Chen Gang
2013-10-07 22:05           ` Chen Gang
2013-09-13  1:27     ` Chen Gang

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=52256F41.6010208@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=akpm@linux-foundation.org \
    --cc=ccross@android.com \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=tglx@linutronix.de \
    /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.