Re: [RFC 10/22] usb: Make core allocate resources per PCI-device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 05, 2011 at 03:54:30PM -0500, Alan Stern wrote:
> On Wed, 5 Jan 2011, Sarah Sharp wrote:
> 
> > I think I'm hearing you want some of the shared_hcd references to go
> > away, with the eventual goal of perhaps getting rid of the pointer out
> > of the usb_hcd entirely.  I agree that dead code like the SAW_IRQ flag
> > and the check_root_hub_suspended() code should go away, but I don't
> > think we can get rid of shared_hcd entirely.
> 
> Yeah, that's what I'd like.  Since you still feel you need it, go ahead
> and redo the RFC using the other changes we discussed and keep the
> shared_hcd pointer.  Afterward we can go through and figure out how to
> eliminate it (or even whether it _should_ be eliminated).
> 
> > You've addressed the use cases in the suspend and resume path, but
> > there's still an issue with the allocation and freeing.  If you agree
> > that the shared roothub allocation should go in the PCI core because of
> > the shared resource visibility issue,
> 
> Refresh my memory: What is the shared resource visibility issue?  It's
> probably sitting in an old email message somewhere, but so many of them
> have gone by that I can't put my finger on it.

Right now, the bandwidth mutex needs to be shared between the two
roothubs, and in the future there could be other usb_hcd variables that
also need to get shared.  My argument was if we push the shared_hcd
allocation into the xHCI driver, the changes are less visible in the USB
PCI core, and people won't think about obscure code in xHCI before
adding new resources.  But even with your suggestions to get rid of
shared_hcd, usb_create_shared_hcd() still stays in the USB core, so
people would have to be pretty blind not to see it.

> That's simple.  You allocate the primary hcd first (along with all the
> necessary resources) in the usual way by calling usb_hcd_pci_probe, and
> then you add the secondary hcd, letting it share the primary's
> resources (usb_add_shared_hcd).  When it's time for the driver to be
> unloaded, you deallocate the secondary hcd (usb_remove_shared_hcd)  
> leaving the shared resources intact, and then you deallocate the
> primary hcd by calling usb_hcd_pci_remove normally.  In other words, 
> you reverse the actions taken during the original registration.
> 
> This also handles the problem of the bandwidth mutex; it gets treated
> like all the other shared resources.  hcd_release can simply do:
> 
> 	if (primary_hcd(hcd))
> 		kfree(hcd->bandwidth_mutex);

Ok, yes, I think that might work.  I'll finish up the other changes and
then start to think about how to remove shared_hcd.

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux