public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [Bug report] dead lock is occur in mutex_trylock
@ 2008-12-08  7:17 morimoto.kuninori
  2008-12-08  7:30 ` Paul Mundt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: morimoto.kuninori @ 2008-12-08  7:17 UTC (permalink / raw)
  To: linux-sh


Dear Paul

I noticed dead lock occur on latest linux-sh.git

It works well if I use old ${LINUX}/arch/sh/include/asm/mutex-llsc.h,
But, latest mutex-llsc.h seems cause dead lock on __mutex_fastpath_trylock.

It confirmed on AP325 board.

Best regards
--
Kuninori Morimoto
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug report] dead lock is occur in mutex_trylock
  2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
@ 2008-12-08  7:30 ` Paul Mundt
  2008-12-08  7:53 ` morimoto.kuninori
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2008-12-08  7:30 UTC (permalink / raw)
  To: linux-sh

On Mon, Dec 08, 2008 at 04:17:17PM +0900, morimoto.kuninori@renesas.com wrote:
> 
> Dear Paul
> 
> I noticed dead lock occur on latest linux-sh.git
> 
> It works well if I use old ${LINUX}/arch/sh/include/asm/mutex-llsc.h,
> But, latest mutex-llsc.h seems cause dead lock on __mutex_fastpath_trylock.
> 
> It confirmed on AP325 board.
> 
Do you have a test case that can reproduce this?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug report] dead lock is occur in mutex_trylock
  2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
  2008-12-08  7:30 ` Paul Mundt
@ 2008-12-08  7:53 ` morimoto.kuninori
  2008-12-08  7:56 ` Nobuhiro Iwamatsu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: morimoto.kuninori @ 2008-12-08  7:53 UTC (permalink / raw)
  To: linux-sh


Dear Paul

> > It works well if I use old ${LINUX}/arch/sh/include/asm/mutex-llsc.h,
> > But, latest mutex-llsc.h seems cause dead lock on __mutex_fastpath_trylock.
> > 
> > It confirmed on AP325 board.
> > 
> Do you have a test case that can reproduce this?

I'm using latest linux-sh git and normal AP325 defconfig.
you can get dead lock when kernel starts MTD setting.

like this
----------------
(snip)
Driver 'sd' needs updating - please use bus_type methods                        
physmap platform flash device: 01000000 at 00000000                             
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank                      
NOR chip too large to fit in mapping. Attempting to cope...                     
 Amd/Fujitsu Extended Query Table at 0x0040                                     
physmap-flash.0: CFI does not contain boot bank location. Assuming top.         
number of CFI chips: 1                                                          
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.        
Reducing visibility of 32768KiB chip to 16384KiB                                
RedBoot partition parsing not available                                         
Using physmap partition information                                             
Creating 5 MTD partitions on "physmap-flash.0":                                 
0x00000000-0x00100000 : "uboot"                                                 
0x00100000-0x00300000 : "kernel"                                                
                                         <= *** dead lock ***
----------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug report] dead lock is occur in mutex_trylock
  2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
  2008-12-08  7:30 ` Paul Mundt
  2008-12-08  7:53 ` morimoto.kuninori
@ 2008-12-08  7:56 ` Nobuhiro Iwamatsu
  2008-12-08  7:59 ` Paul Mundt
  2008-12-08  8:14 ` morimoto.kuninori
  4 siblings, 0 replies; 6+ messages in thread
From: Nobuhiro Iwamatsu @ 2008-12-08  7:56 UTC (permalink / raw)
  To: linux-sh

2008/12/8 Paul Mundt <lethal@linux-sh.org>:
> On Mon, Dec 08, 2008 at 04:17:17PM +0900, morimoto.kuninori@renesas.com wrote:
>>
>> Dear Paul
>>
>> I noticed dead lock occur on latest linux-sh.git
>>
>> It works well if I use old ${LINUX}/arch/sh/include/asm/mutex-llsc.h,
>> But, latest mutex-llsc.h seems cause dead lock on __mutex_fastpath_trylock.
>>
>> It confirmed on AP325 board.
>>
> Do you have a test case that can reproduce this?

Sorry,I don't have time to make a patch to solve this problem.
I send report only.

----
I do bisect your git repository.

iwamatsu@xps-iwamatsu:~/work/git/kernel/sh-2.6-devel (no branch)$ git bisect bad
782af8b25c1ce97b01b30c3b36bff02ccfd1b1c8 is first bad commit
commit 782af8b25c1ce97b01b30c3b36bff02ccfd1b1c8
Author: Paul Mundt <lethal@linux-sh.org>
Date:   Mon Dec 8 11:25:50 2008 +0900

    sh: Fix up the SH-4A mutex fastpath semantics.

    This fixes up the __mutex_fastpath_xxx() routines to match the semantics
    noted in the comment. Previously these were looping rather than doing a
    single-pass, which is counter-intuitive, as the slow path takes care of
    the looping for us in the event of contention.

    Signed-off-by: Paul Mundt <lethal@linux-sh.org>

:040000 040000 4fd2b63c9b887d77e8362bdf50b5cf8c78a05806
7b4b20b85fb7c400dffb784f3f3162af303d8c8f M	arch

Best regards,
 Nobuhiro


-- 
Nobuhiro Iwamatsu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug report] dead lock is occur in mutex_trylock
  2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
                   ` (2 preceding siblings ...)
  2008-12-08  7:56 ` Nobuhiro Iwamatsu
@ 2008-12-08  7:59 ` Paul Mundt
  2008-12-08  8:14 ` morimoto.kuninori
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2008-12-08  7:59 UTC (permalink / raw)
  To: linux-sh

On Mon, Dec 08, 2008 at 04:53:53PM +0900, morimoto.kuninori@renesas.com wrote:
> 
> Dear Paul
> 
> > > It works well if I use old ${LINUX}/arch/sh/include/asm/mutex-llsc.h,
> > > But, latest mutex-llsc.h seems cause dead lock on __mutex_fastpath_trylock.
> > > 
> > > It confirmed on AP325 board.
> > > 
> > Do you have a test case that can reproduce this?
> 
> I'm using latest linux-sh git and normal AP325 defconfig.
> you can get dead lock when kernel starts MTD setting.
> 
It helps if I'm using the right configuration, whoops.

This ought to do it..

---

diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h
index a91990c..ee839ee 100644
--- a/arch/sh/include/asm/mutex-llsc.h
+++ b/arch/sh/include/asm/mutex-llsc.h
@@ -73,7 +73,7 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
 		: "t");
 
 	__res |= !__ex_flag;
-	if (unlikely(__res != 0))
+	if (unlikely(__res <= 0))
 		fail_fn(count);
 }
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Bug report] dead lock is occur in mutex_trylock
  2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
                   ` (3 preceding siblings ...)
  2008-12-08  7:59 ` Paul Mundt
@ 2008-12-08  8:14 ` morimoto.kuninori
  4 siblings, 0 replies; 6+ messages in thread
From: morimoto.kuninori @ 2008-12-08  8:14 UTC (permalink / raw)
  To: linux-sh


Dear Paul

Thank you for new patch

> > I'm using latest linux-sh git and normal AP325 defconfig.
> > you can get dead lock when kernel starts MTD setting.
> > 
> It helps if I'm using the right configuration, whoops.
> 
> This ought to do it..
> 
> ---
> 
> diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h
> index a91990c..ee839ee 100644
> --- a/arch/sh/include/asm/mutex-llsc.h
> +++ b/arch/sh/include/asm/mutex-llsc.h
> @@ -73,7 +73,7 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
>  		: "t");
>  
>  	__res |= !__ex_flag;
> -	if (unlikely(__res != 0))
> +	if (unlikely(__res <= 0))
>  		fail_fn(count);
>  }

wow !!
It works well on my environment
Thanks

Acked-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>

Best regards
--
Kuninori Morimoto
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-12-08  8:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08  7:17 [Bug report] dead lock is occur in mutex_trylock morimoto.kuninori
2008-12-08  7:30 ` Paul Mundt
2008-12-08  7:53 ` morimoto.kuninori
2008-12-08  7:56 ` Nobuhiro Iwamatsu
2008-12-08  7:59 ` Paul Mundt
2008-12-08  8:14 ` morimoto.kuninori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox