* [PATCH 1/3] ps3: vuart: fix error path locking [not found] <20071213003023.117964080@mvista.com> @ 2007-12-12 8:00 ` Daniel Walker 2007-12-13 2:00 ` Geoff Levand 0 siblings, 1 reply; 8+ messages in thread From: Daniel Walker @ 2007-12-12 8:00 UTC (permalink / raw) To: akpm Cc: matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester This stray down would cause a permanent sleep which doesn't seem correct. The other uses of this semaphore appear fairly mutex like it's even initialized with init_MUTEX() .. So here a patch for removing this one down(). Signed-off-by: Daniel Walker <dwalker@mvista.com> --- drivers/ps3/ps3-vuart.c | 1 - 1 file changed, 1 deletion(-) Index: linux-2.6.23/drivers/ps3/ps3-vuart.c =================================================================== --- linux-2.6.23.orig/drivers/ps3/ps3-vuart.c +++ linux-2.6.23/drivers/ps3/ps3-vuart.c @@ -1072,7 +1072,6 @@ static int ps3_vuart_probe(struct ps3_sy if (result) { dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", __func__, __LINE__); - down(&vuart_bus_priv.probe_mutex); goto fail_probe; } -- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-12 8:00 ` [PATCH 1/3] ps3: vuart: fix error path locking Daniel Walker @ 2007-12-13 2:00 ` Geoff Levand 2007-12-19 1:10 ` Andrew Morton 0 siblings, 1 reply; 8+ messages in thread From: Geoff Levand @ 2007-12-13 2:00 UTC (permalink / raw) To: akpm Cc: Daniel Walker, matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester > This stray down would cause a permanent sleep which doesn't seem correct. > The other uses of this semaphore appear fairly mutex like it's even initialized > with init_MUTEX() .. So here a patch for removing this one down(). > > Signed-off-by: Daniel Walker <dwalker@mvista.com> > > --- > drivers/ps3/ps3-vuart.c | 1 - > 1 file changed, 1 deletion(-) Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Looks, good. Andrew, Please apply. -Geoff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-13 2:00 ` Geoff Levand @ 2007-12-19 1:10 ` Andrew Morton 2007-12-19 1:54 ` Daniel Walker 2007-12-19 3:04 ` Geoff Levand 0 siblings, 2 replies; 8+ messages in thread From: Andrew Morton @ 2007-12-19 1:10 UTC (permalink / raw) To: Geoff Levand Cc: dwalker, matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester On Wed, 12 Dec 2007 18:00:12 -0800 Geoff Levand <geoffrey.levand@am.sony.com> wrote: > > This stray down would cause a permanent sleep which doesn't seem correct. > > The other uses of this semaphore appear fairly mutex like it's even initialized > > with init_MUTEX() .. So here a patch for removing this one down(). > > > > Signed-off-by: Daniel Walker <dwalker@mvista.com> > > > > --- > > drivers/ps3/ps3-vuart.c | 1 - > > 1 file changed, 1 deletion(-) > > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > > Looks, good. Looks bad to me. > Andrew, Please apply. The current code: if (result) { dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", __func__, __LINE__); down(&vuart_bus_priv.probe_mutex); goto fail_probe; } up(&vuart_bus_priv.probe_mutex); return result; fail_probe: ps3_vuart_set_interrupt_mask(dev, 0); kfree(dev->driver_priv); dev->driver_priv = NULL; fail_dev_malloc: vuart_bus_priv.devices[dev->port_number] = NULL; fail_busy: ps3_vuart_bus_interrupt_put(); fail_setup_interrupt: up(&vuart_bus_priv.probe_mutex); dev_dbg(&dev->core, "%s:%d: failed\n", __func__, __LINE__); return result; } is correct. Although not exactly a thing of beauty. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-19 1:10 ` Andrew Morton @ 2007-12-19 1:54 ` Daniel Walker 2007-12-19 3:04 ` Geoff Levand 1 sibling, 0 replies; 8+ messages in thread From: Daniel Walker @ 2007-12-19 1:54 UTC (permalink / raw) To: Andrew Morton Cc: matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester On Tue, 2007-12-18 at 17:10 -0800, Andrew Morton wrote: > is correct. Although not exactly a thing of beauty. This isn't the worst I've seen ;( .. Do you think the ending should fall through instead of having two returns? Daniel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-19 1:10 ` Andrew Morton 2007-12-19 1:54 ` Daniel Walker @ 2007-12-19 3:04 ` Geoff Levand 2007-12-20 19:32 ` Daniel Walker 1 sibling, 1 reply; 8+ messages in thread From: Geoff Levand @ 2007-12-19 3:04 UTC (permalink / raw) To: Andrew Morton Cc: dwalker, matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester On 12/18/2007 05:10 PM, Andrew Morton wrote: > On Wed, 12 Dec 2007 18:00:12 -0800 > Geoff Levand <geoffrey.levand@am.sony.com> wrote: > >> > This stray down would cause a permanent sleep which doesn't seem correct. >> > The other uses of this semaphore appear fairly mutex like it's even initialized >> > with init_MUTEX() .. So here a patch for removing this one down(). >> > >> > Signed-off-by: Daniel Walker <dwalker@mvista.com> >> > >> > --- >> > drivers/ps3/ps3-vuart.c | 1 - >> > 1 file changed, 1 deletion(-) >> >> >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> >> >> >> Looks, good. > > Looks bad to me. Hi Andrew, Unfortunately there wasn't enough context in the patch to see that there is a down() earlier in the routine, and that the patch does indeed remove an incorrectly placed down(). Here is the entire routine, marked with what the patch removes. static int ps3_vuart_probe(struct ps3_system_bus_device *dev) { int result; struct ps3_vuart_port_driver *drv; struct ps3_vuart_port_priv *priv = NULL; dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); drv = ps3_system_bus_dev_to_vuart_drv(dev); dev_dbg(&dev->core, "%s:%d: (%s)\n", __func__, __LINE__, drv->core.core.name); BUG_ON(!drv); if (dev->port_number >= PORT_COUNT) { BUG(); return -EINVAL; } down(&vuart_bus_priv.probe_mutex); result = ps3_vuart_bus_interrupt_get(); if (result) goto fail_setup_interrupt; if (vuart_bus_priv.devices[dev->port_number]) { dev_dbg(&dev->core, "%s:%d: port busy (%d)\n", __func__, __LINE__, dev->port_number); result = -EBUSY; goto fail_busy; } vuart_bus_priv.devices[dev->port_number] = dev; /* Setup dev->driver_priv. */ dev->driver_priv = kzalloc(sizeof(struct ps3_vuart_port_priv), GFP_KERNEL); if (!dev->driver_priv) { result = -ENOMEM; goto fail_dev_malloc; } priv = to_port_priv(dev); INIT_LIST_HEAD(&priv->tx_list.head); spin_lock_init(&priv->tx_list.lock); INIT_LIST_HEAD(&priv->rx_list.head); spin_lock_init(&priv->rx_list.lock); INIT_WORK(&priv->rx_list.work.work, NULL); priv->rx_list.work.trigger = 0; priv->rx_list.work.dev = dev; /* clear stale pending interrupts */ ps3_vuart_clear_rx_bytes(dev, 0); ps3_vuart_set_interrupt_mask(dev, INTERRUPT_MASK_RX); ps3_vuart_set_triggers(dev, 1, 1); if (drv->probe) result = drv->probe(dev); else { result = 0; dev_info(&dev->core, "%s:%d: no probe method\n", __func__, __LINE__); } if (result) { dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", __func__, __LINE__); removed >>>>>> down(&vuart_bus_priv.probe_mutex); <<<<<<<<<<< goto fail_probe; } up(&vuart_bus_priv.probe_mutex); return result; fail_probe: ps3_vuart_set_interrupt_mask(dev, 0); kfree(dev->driver_priv); dev->driver_priv = NULL; fail_dev_malloc: vuart_bus_priv.devices[dev->port_number] = NULL; fail_busy: ps3_vuart_bus_interrupt_put(); fail_setup_interrupt: up(&vuart_bus_priv.probe_mutex); dev_dbg(&dev->core, "%s:%d: failed\n", __func__, __LINE__); return result; } Thanks for taking the time to scrutinize. -Geoff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-19 3:04 ` Geoff Levand @ 2007-12-20 19:32 ` Daniel Walker 2007-12-20 20:06 ` Andrew Morton 0 siblings, 1 reply; 8+ messages in thread From: Daniel Walker @ 2007-12-20 19:32 UTC (permalink / raw) To: Geoff Levand Cc: matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, kjwinchester, Andrew Morton, mingo On Tue, 2007-12-18 at 19:04 -0800, Geoff Levand wrote: > Unfortunately there wasn't enough context in the patch to see > that there is a down() earlier in the routine, and that the patch > does indeed remove an incorrectly placed down(). Here is the > entire routine, marked with what the patch removes. > Andrew have you had a chance to review this? Daniel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-20 19:32 ` Daniel Walker @ 2007-12-20 20:06 ` Andrew Morton 2007-12-20 20:13 ` Daniel Walker 0 siblings, 1 reply; 8+ messages in thread From: Andrew Morton @ 2007-12-20 20:06 UTC (permalink / raw) To: Daniel Walker Cc: matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester On Thu, 20 Dec 2007 11:32:25 -0800 Daniel Walker <dwalker@mvista.com> wrote: > On Tue, 2007-12-18 at 19:04 -0800, Geoff Levand wrote: > > > Unfortunately there wasn't enough context in the patch to see > > that there is a down() earlier in the routine, and that the patch > > does indeed remove an incorrectly placed down(). Here is the > > entire routine, marked with what the patch removes. > > > > Andrew have you had a chance to review this? > Confused. I did review it: http://lkml.org/lkml/2007/12/18/384 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ps3: vuart: fix error path locking 2007-12-20 20:06 ` Andrew Morton @ 2007-12-20 20:13 ` Daniel Walker 0 siblings, 0 replies; 8+ messages in thread From: Daniel Walker @ 2007-12-20 20:13 UTC (permalink / raw) To: Andrew Morton Cc: matthias.kaehlcke, linux-kernel, linux, linuxppc-dev, mingo, kjwinchester On Thu, 2007-12-20 at 12:06 -0800, Andrew Morton wrote: > On Thu, 20 Dec 2007 11:32:25 -0800 Daniel Walker <dwalker@mvista.com> wrote: > > > On Tue, 2007-12-18 at 19:04 -0800, Geoff Levand wrote: > > > > > Unfortunately there wasn't enough context in the patch to see > > > that there is a down() earlier in the routine, and that the patch > > > does indeed remove an incorrectly placed down(). Here is the > > > entire routine, marked with what the patch removes. > > > > > > > Andrew have you had a chance to review this? > > > > Confused. I did review it: http://lkml.org/lkml/2007/12/18/384 Yeah, but Geoff countered http://lkml.org/lkml/2007/12/18/409 Do you still think the patch is wrong, given the whole function? Daniel ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-12-20 20:14 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20071213003023.117964080@mvista.com> 2007-12-12 8:00 ` [PATCH 1/3] ps3: vuart: fix error path locking Daniel Walker 2007-12-13 2:00 ` Geoff Levand 2007-12-19 1:10 ` Andrew Morton 2007-12-19 1:54 ` Daniel Walker 2007-12-19 3:04 ` Geoff Levand 2007-12-20 19:32 ` Daniel Walker 2007-12-20 20:06 ` Andrew Morton 2007-12-20 20:13 ` Daniel Walker
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).