On Fri, Oct 29, 2010 at 10:59:08PM +0200, Julia Lawall wrote:
> > > You can give a timeout expressed in a number of seconds.  -timeout 120 is 
> > > probably good enough.  On the other hand, if you run into such problems, 
> > > please let me know (C file + semantic patch).  Often there is an 
> > > inefficiency that can be corrected.
> > 
> > I didn't report it because i was using a pretty old version (0.2.2)
> > If I see it next time I'll report it.
> 
> OK, but since then I think that the only thing I have done is remove 
> optimizations that turned out to be too aggressive, so even reports on the 
> old version would be useful.

The attached hostlock patch hits a 120 seconds timeout when run individually
for

drivers/scsi/ultrastor.c
drivers/scsi/ibmmca.c
drivers/scsi/aha1740.c
arch/ia64/hp/sim/simscsi.c
drivers/staging/hv/storvsc_drv.c

in Linus' current tree.
This is with 0.22

> > 
> > The other problem was that I replaced a typedef with a struct foo
> > and then the type expressions sometimes ended up with an extra
> > space (like (* foo)(....))
> 
> OK, I ill try to take a look.

I don't remember for which SCSI driver this was (somewhere in drivers/scsi/*)
but this was with the other spatch i'm attaching (scsi-cmnd-typedef.cocci) 
I think I only saw it on one or two. The problem was a unnecessary
space in front of the "done" 

-Andi

-- 
[email protected] -- Speaking for myself only.
@ rule1 @
struct scsi_host_template t;
identifier qc;
@@
t.queuecommand = qc;

@@
identifier rule1.qc;
identifier cmnd;
expression E;
statement S, S2;
typedef Scsi_Cmnd;
@@
int qc(Scsi_Cmnd *cmnd, ...) 
{
        ... when != S
+       unsigned long irqflags;

+       spin_lock_irqsave(cmnd->device->host->host_lock, irqflags);
+       scsi_cmd_get_serial(cmnd->device->host, cmnd);
        S2
        ...
+       spin_unlock_irqrestore(cmnd->device->host->host_lock, irqflags);
        return E;
}

@@
identifier rule1.qc;
identifier cmnd;
expression E;
statement S, S2;
@@
int qc(struct scsi_cmnd *cmnd, ...) 
{
        ... when != S
+       unsigned long irqflags;

+       spin_lock_irqsave(cmnd->device->host->host_lock, irqflags);
+       scsi_cmd_get_serial(cmnd->device->host, cmnd);
        S2
        ...
+       spin_unlock_irqrestore(cmnd->device->host->host_lock, irqflags);
        return E;
}

@ rule1 @
struct scsi_host_template t;
identifier qc;
@@
t.queuecommand = qc;

@@
typedef Scsi_Cmnd;
identifier rule1.qc;
identifier done, cmnd;
@@
- int qc(Scsi_Cmnd *cmnd, void (*done) (Scsi_Cmnd *))
+ int qc(struct scsi_cmnd *cmnd, void (*done)(struct scsi_cmnd *))
{
        ...
}

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to