[openfabrics-ewg] IB/ipath - initialize diagpkt file on device init only

Robert Walsh rjwalsh at pathscale.com
Wed Oct 4 19:07:31 PDT 2006


Roland Dreier wrote:
> I tried loading ib_ipath on one of my systems without an ipath device,
> and I got the message
> 
>     ib_ipath: Could not create class_dev for minor 127, ipath_diagpkt (err 19)
> 
> but I couldn't reproduce the hang of modprobe.

This was without the patch, though, right?  Cause if you've applied the 
patch and you're still getting this message, I'm confused.

> Anyway, taking a quick look at what caused that message showed that
> the problem is that ipath_class is NULL there.  And that makes sense,
> because ipath_class isn't created until ipath_user_add() is called in
> ipath_init_one() (which is never called if there are no devices).

Ah.  Well spotted.

> So I think a correct fix is to move any global initialization like
> creating ipath_class into the module_init function before probing any
> devices.  I don't approve of this latest patch because you do this:
> 
>  > -int __init ipath_diagpkt_add(void)
>  > -{
>  > -	return ipath_cdev_init(IPATH_DIAGPKT_MINOR,
>  > -			       "ipath_diagpkt", &diagpkt_file_ops,
>  > -			       &diagpkt_cdev, &diagpkt_class_dev);
>  > -}
> 
>  > +void ipath_diagpkt_add(void)
>  > +{
>  > +	if (atomic_inc_return(&diagpkt_count) == 1)
>  > +		ipath_cdev_init(IPATH_DIAGPKT_MINOR,
>  > +				"ipath_diagpkt", &diagpkt_file_ops,
>  > +				&diagpkt_cdev, &diagpkt_class_dev);
>  > +}
> 
> which means that you've stopped checking the return value of
> ipath_cdev_init().  What will happen if it fails?  I would guess
> everything blows up, right?

Sigh.  Yeah.  Code go boom.  I'll roll it again.  We had been ignoring 
the failure anyway before this patch.  I'll just make sure we do a 
dev_warn and atomic_dec if ipath_cdev_init fails.

Michael: do we have much longer left for RC7?  As I said before, it's no 
skin of my nose if you want to roll RC7 with my hacky workaround patch 
in place, or even without that.  But if you're still working on other 
stuff, I can probably get a "proper" fix in tonight.

Regards,
  Robert.




More information about the ewg mailing list