* [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug
@ 2008-01-27 18:14 Stefan Richter
2008-01-27 18:26 ` Stefan Richter
2008-01-28 16:26 ` Jarod Wilson
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Richter @ 2008-01-27 18:14 UTC (permalink / raw)
To: linux1394-devel; +Cc: Jarod Wilson, Kristian Høgsberg, linux-kernel
If a device is being unplugged while fw-sbp2 had a login or reconnect on
schedule, it would take about half a minute to shut the fw_unit down:
Jan 27 18:34:54 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
<unplug>
Jan 27 18:34:59 stein firewire_sbp2: sbp2_scsi_abort
Jan 27 18:34:59 stein scsi 25:0:0:0: Device offlined - not ready after error recovery
Jan 27 18:35:01 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:06 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:12 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:17 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:22 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:27 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:32 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:32 stein firewire_sbp2: failed to login to fw2.0 LUN 0000
Jan 27 18:35:32 stein firewire_sbp2: released fw2.0
After this patch, typically only a few seconds spent in __scsi_add_device
remain:
Jan 27 19:05:50 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
<unplug>
Jan 27 19:05:56 stein firewire_sbp2: sbp2_scsi_abort
Jan 27 19:05:56 stein scsi 33:0:0:0: Device offlined - not ready after error recovery
Jan 27 19:05:56 stein firewire_sbp2: released fw2.0
The benefit of this is negligible on simple setups. But on buses with
several devices, we should avoid any unnecessary blockade of fw-sbp2's
workqueue thread.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/firewire/fw-sbp2.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -499,6 +499,9 @@ sbp2_send_management_orb(struct sbp2_log
unsigned int timeout;
int retval = -ENOMEM;
+ if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device))
+ return 0;
+
orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
if (orb == NULL)
return -ENOMEM;
@@ -619,16 +622,13 @@ static void sbp2_release_target(struct k
struct sbp2_logical_unit *lu, *next;
struct Scsi_Host *shost =
container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
- struct fw_device *device = fw_device(tgt->unit->device.parent);
list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
if (lu->sdev)
scsi_remove_device(lu->sdev);
- if (!fw_device_is_shutdown(device))
- sbp2_send_management_orb(lu, tgt->node_id,
- lu->generation, SBP2_LOGOUT_REQUEST,
- lu->login_id, NULL);
+ sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
+ SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
fw_core_remove_address_handler(&lu->address_handler);
list_del(&lu->link);
@@ -673,6 +673,9 @@ static void sbp2_login(struct work_struc
struct sbp2_login_response response;
int generation, node_id, local_node_id;
+ if (fw_device_is_shutdown(device))
+ goto out;
+
generation = device->generation;
smp_rmb(); /* node_id must not be older than generation */
node_id = device->node_id;
@@ -968,6 +971,9 @@ static void sbp2_reconnect(struct work_s
struct fw_device *device = fw_device(unit->device.parent);
int generation, node_id, local_node_id;
+ if (fw_device_is_shutdown(device))
+ goto out;
+
generation = device->generation;
smp_rmb(); /* node_id must not be older than generation */
node_id = device->node_id;
--
Stefan Richter
-=====-==--- ---= ==-==
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug
2008-01-27 18:14 [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug Stefan Richter
@ 2008-01-27 18:26 ` Stefan Richter
2008-01-28 16:26 ` Jarod Wilson
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Richter @ 2008-01-27 18:26 UTC (permalink / raw)
To: linux1394-devel; +Cc: Jarod Wilson, Kristian Høgsberg, linux-kernel
I wrote:
> If a device is being unplugged while fw-sbp2 had a login or reconnect on
> schedule, it would take about half a minute to shut the fw_unit down:
>
> Jan 27 18:34:54 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
> <unplug>
> Jan 27 18:34:59 stein firewire_sbp2: sbp2_scsi_abort
> Jan 27 18:34:59 stein scsi 25:0:0:0: Device offlined - not ready after error recovery
> Jan 27 18:35:01 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:06 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:12 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:17 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:22 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:27 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:32 stein firewire_sbp2: orb reply timed out, rcode=0x11
> Jan 27 18:35:32 stein firewire_sbp2: failed to login to fw2.0 LUN 0000
> Jan 27 18:35:32 stein firewire_sbp2: released fw2.0
>
> After this patch, typically only a few seconds spent in __scsi_add_device
> remain:
>
> Jan 27 19:05:50 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
> <unplug>
> Jan 27 19:05:56 stein firewire_sbp2: sbp2_scsi_abort
> Jan 27 19:05:56 stein scsi 33:0:0:0: Device offlined - not ready after error recovery
> Jan 27 19:05:56 stein firewire_sbp2: released fw2.0
>
> The benefit of this is negligible on simple setups. But on buses with
> several devices, we should avoid any unnecessary blockade of fw-sbp2's
> workqueue thread.
There is an error in the last sentences. The time spent sleeping in
workqueue jobs is the same before and after. What this patch only
avoids are a few wasted CPU cycles, irritating log messages, and
needlessly prolonged lifetime of a few driver objects.
However, less noise in the syslog may already be enough justification
for this patch.
--
Stefan Richter
-=====-==--- ---= ==-==
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug
2008-01-27 18:14 [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug Stefan Richter
2008-01-27 18:26 ` Stefan Richter
@ 2008-01-28 16:26 ` Jarod Wilson
1 sibling, 0 replies; 3+ messages in thread
From: Jarod Wilson @ 2008-01-28 16:26 UTC (permalink / raw)
To: Stefan Richter; +Cc: linux1394-devel, Kristian Høgsberg, linux-kernel
On Sunday 27 January 2008 01:14:44 pm Stefan Richter wrote:
> If a device is being unplugged while fw-sbp2 had a login or reconnect on
> schedule, it would take about half a minute to shut the fw_unit down:
>
> Jan 27 18:34:54 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0
> retries) <unplug>
> Jan 27 18:34:59 stein firewire_sbp2: sbp2_scsi_abort
> Jan 27 18:34:59 stein scsi 25:0:0:0: Device offlined - not ready after
> error recovery Jan 27 18:35:01 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:06 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:12 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:17 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:22 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:27 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:32 stein firewire_sbp2: orb reply timed out,
> rcode=0x11 Jan 27 18:35:32 stein firewire_sbp2: failed to login to fw2.0
> LUN 0000 Jan 27 18:35:32 stein firewire_sbp2: released fw2.0
>
> After this patch, typically only a few seconds spent in __scsi_add_device
> remain:
>
> Jan 27 19:05:50 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0
> retries) <unplug>
> Jan 27 19:05:56 stein firewire_sbp2: sbp2_scsi_abort
> Jan 27 19:05:56 stein scsi 33:0:0:0: Device offlined - not ready after
> error recovery Jan 27 19:05:56 stein firewire_sbp2: released fw2.0
>
> The benefit of this is negligible on simple setups. But on buses with
> several devices, we should avoid any unnecessary blockade of fw-sbp2's
> workqueue thread.
>
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Looks good, makes sense to me, I've hit this one a few times myself. Even if
we do end up still having the workqueue sleep time, nuking all the
unnecessary spew and saving a few cycles is definitely worth it.
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
--
Jarod Wilson
jwilson@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-28 16:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-27 18:14 [PATCH] firewire: fw-sbp2: don't retry login or reconnect after unplug Stefan Richter
2008-01-27 18:26 ` Stefan Richter
2008-01-28 16:26 ` Jarod Wilson
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).