1. 02 2月, 2008 1 次提交
  2. 29 11月, 2007 1 次提交
  3. 02 11月, 2007 1 次提交
  4. 13 10月, 2007 18 次提交
    • S
      USB: Export URB statistics for powertop · 4d59d8a1
      Sarah Sharp 提交于
      powertop currently tracks interrupts generated by uhci, ehci, and ohci,
      but it has no way of telling which USB device to blame USB bus activity on.
      This patch exports the number of URBs that are submitted for a given device.
      Cat the file 'urbnum' in /sys/bus/usb/devices/.../
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d59d8a1
    • A
      USB: flush outstanding URBs when suspending · 6840d255
      Alan Stern 提交于
      This patch (as989) makes usbcore flush all outstanding URBs for each
      device as the device is suspended.  This will be true even when
      CONFIG_USB_SUSPEND is not enabled.
      
      In addition, an extra can_submit flag is added to the usb_device
      structure.  That flag will be turned off whenever a suspend request
      has been received for the device, even if the device isn't actually
      suspended because CONFIG_USB_SUSPEND isn't set.
      
      It's no longer necessary to check for the device state being equal to
      USB_STATE_SUSPENDED during URB submission; that check can be replaced
      by a check of the can_submit flag.  This also permits us to remove
      some questionable references to the deprecated power.power_state field.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6840d255
    • A
      USB: break apart flush_endpoint and disable_endpoint · 95cf82f9
      Alan Stern 提交于
      This patch (as988) breaks usb_hcd_endpoint_disable() apart into two
      routines.  The first, usb_hcd_flush_endpoint() does the -ESHUTDOWN
      unlinking of all URBs in the endpoint's queue and waits for them to
      complete.  The second, usb_hcd_disable_endpoint() -- renamed for
      better grammatical style -- merely calls the HCD's endpoint_disable
      method.  The changeover is easy because the routine currently has only
      one caller.
      
      This separation of function will be exploited in the following patch:
      When a device is suspended, the core will be able to cancel all
      outstanding URBs for that device while leaving the HCD's
      endpoint-related data structures intact for later.
      
      As an added benefit, HCDs no longer need to check for existing URBs in
      their endpoint_disable methods.  It is now guaranteed that there will
      be none.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      95cf82f9
    • A
      USB: Eliminate urb->status usage! · 4a00027d
      Alan Stern 提交于
      This patch (as979) removes the last vestiges of urb->status from the
      host controller drivers and the root-hub emulator.  Now the field
      doesn't get set until just before the URB's completion routine is
      called.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a00027d
    • A
      USB: reorganize urb->status use in usbmon · 9347d51c
      Alan Stern 提交于
      This patch (as978) reorganizes the way usbmon uses urb->status.  It
      now accepts the status value as an argument.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9347d51c
    • A
      USB: fix mistake in usb_hcd_giveback_urb · 1f5a3d0f
      Alan Stern 提交于
      This patch (as971) fixes a small mistake: The URB's completion status
      needs to be adjusted before the URB is passed to usmon_urb_complete(),
      not afterward.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1f5a3d0f
    • A
      USB: add urb->unlinked field · eb231054
      Alan Stern 提交于
      This patch (as970) adds a new urb->unlinked field, which is used to
      store the status of unlinked URBs since we can't use urb->status for
      that purpose any more.  To help simplify the HCDs, usbcore will check
      urb->unlinked before calling the completion handler; if the value is
      set it will automatically override the status reported by the HCD.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eb231054
    • A
      USB: centralize -EREMOTEIO handling · b0d9efba
      Alan Stern 提交于
      This patch (as969) continues the ongoing changes to the way HCDs
      report URB statuses.  The programming interface has been simplified by
      making usbcore responsible for clearing urb->hcpriv and for setting
      -EREMOTEIO status when an URB with the URB_SHORT_NOT_OK flag ends up
      as a short transfer.
      
      By moving the work out of the HCDs, this removes a fair amount of
      repeated code.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b0d9efba
    • A
      USB: make HCDs responsible for managing endpoint queues · e9df41c5
      Alan Stern 提交于
      This patch (as954) implements a suggestion of David Brownell's.  Now
      the host controller drivers are responsible for linking and unlinking
      URBs to/from their endpoint queues.  This eliminates the possiblity of
      strange situations where usbcore thinks an URB is linked but the HCD
      thinks it isn't.  It also means HCDs no longer have to check for URBs
      being dequeued before they were fully enqueued.
      
      In addition to the core changes, this requires changing every host
      controller driver and the root-hub URB handler.  For the most part the
      required changes are fairly small; drivers have to call
      usb_hcd_link_urb_to_ep() in their urb_enqueue method,
      usb_hcd_check_unlink_urb() in their urb_dequeue method, and
      usb_hcd_unlink_urb_from_ep() before giving URBs back.  A few HCDs make
      matters more complicated by the way they split up the flow of control.
      
      In addition some method interfaces get changed.  The endpoint argument
      for urb_enqueue is now redundant so it is removed.  The unlink status
      is required by usb_hcd_check_unlink_urb(), so it has been added to
      urb_dequeue.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e9df41c5
    • I
      usb: cleanup usb_register_bus() and hook up sysfs group · eb579f58
      Inaky Perez-Gonzalez 提交于
      This path cleans the exit paths of usb_register_bus() [to use a goto
      schema], maximum line length (keeping it under ~75).
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eb579f58
    • I
      usb: add the concept of default authorization to USB hosts · 5234ce1b
      Inaky Perez-Gonzalez 提交于
      This introduces /sys/bus/devices/usb*/authorized_default; it dictates
      what is going to be the default authorization state for devices
      connected to the host. User space can set that using the sysfs file.
      
      We hook to the root hub instead of to the device controller as it is
      quite easy to get to it in sysfs from the device structure (device
      5-4.3 is usb5) vs. backtracking to the controller device.
      
      By default it is set to be 'authorized' (!0) for normal, wired USB
      devices and 'unauthorized' (0) for Wireless USB devices.
      
      As suggested by Adrian Bunk, make authorized_default static
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5234ce1b
    • A
      USB: separate out endpoint queue management and DMA mapping routines · 9a9bf406
      Alan Stern 提交于
      This patch (as953) separates out three key portions from
      usb_hcd_submit_urb(), usb_hcd_unlink_urb(), and usb_hcd_giveback_urb()
      and puts them in separate functions of their own.  In the next patch,
      these functions will be called directly by host controller drivers
      while holding their private spinlocks, which will remove the
      possibility of some unpleasant races.
      
      The code responsible for mapping and unmapping DMA buffers is also
      placed into a couple of separate subroutines, for the sake of
      cleanliness and consistency.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9a9bf406
    • A
      USB: update spinlock usage for root-hub URBs · 9439eb94
      Alan Stern 提交于
      This patch (as952) adjusts the spinlock usage in the root-hub
      emulation part of usbcore, to make it match more closely the pattern
      used by regular host controller drivers.  To wit: The private lock
      (usb_hcd_root_hub_lock) is held throughout the important parts, and it
      is dropped temporarily without re-enabling interrupts around the call
      to usb_hcd_giveback_urb().
      
      A nice side effect is that the code now avoids calling
      local_irq_save(), thereby becoming more RT-friendly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9439eb94
    • A
      USB: cleanup for previous patches · d617bc83
      Alan Stern 提交于
      This patch (as951) cleans up a few loose ends from earlier patches.
      Redundant checks for non-NULL urb->dev are removed, as are checks of
      urb->dev->bus (which can never be NULL).  Conversely, a check for
      non-NULL urb->ep is added to the unlink paths.
      
      A homegrown round-down-to-power-of-2 loop is simplified by using the
      ilog2 routine.  The comparison in usb_urb_dir_in() is made more
      transparent.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d617bc83
    • A
      USB: avoid using urb->pipe in usbcore · 5e60a161
      Alan Stern 提交于
      This patch (as946) eliminates many of the uses of urb->pipe in
      usbcore.  Unfortunately there will have to be a significant API
      change, affecting all USB drivers, before we can remove it entirely.
      This patch contents itself with changing only the interface to
      usb_buffer_map_sg() and friends: The pipe argument is replaced with a
      direction flag.  That can be done easily because those routines get
      used in only one place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5e60a161
    • A
      USB: add direction bit to urb->transfer_flags · fea34091
      Alan Stern 提交于
      This patch (as945) adds a bit to urb->transfer_flags for recording the
      direction of the URB.  The bit is set/cleared automatically in
      usb_submit_urb() so drivers don't have to worry about it (although as
      a result, it isn't valid until the URB has been submitted).  Inline
      routines are added for easily checking an URB's direction.  They
      replace calls to usb_pipein in the DMA-mapping parts of hcd.c.
      
      For non-control endpoints, the direction is determined directly from
      the endpoint descriptor.  However control endpoints are
      bi-directional; for them the direction is determined from the
      bRequestType byte and the wLength value in the setup packet.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fea34091
    • A
      USB: add ep->enable · bdd016ba
      Alan Stern 提交于
      This patch (as944) adds an explicit "enabled" field to the
      usb_host_endpoint structure and uses it in place of the current
      mechanism.  This is merely a time-space tradeoff; it makes checking
      whether URBs may be submitted to an endpoint simpler.  The existing
      mechanism is efficient when converting urb->pipe to an endpoint
      pointer, but it's not so efficient when urb->ep is used instead.
      
      As a side effect, the procedure for enabling an endpoint is now a
      little more complicated.  The ad-hoc inline code in usb.c and hub.c
      for enabling ep0 is now replaced with calls to usb_enable_endpoint,
      which is no longer static.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bdd016ba
    • A
      USB: add urb->ep · 5b653c79
      Alan Stern 提交于
      This patch (as943) prepares the way for eliminating urb->pipe by
      introducing an endpoint pointer into struct urb.  For now urb->ep
      is set by usb_submit_urb() from the pipe value; eventually drivers
      will set it themselves and we will remove urb->pipe completely.
      
      The patch also adds new inline routines to retrieve an endpoint
      descriptor's number and transfer type, essentially as replacements for
      usb_pipeendpoint and usb_pipetype.
      
      usb_submit_urb(), usb_hcd_submit_urb(), and usb_hcd_unlink_urb() are
      converted to use the new field and new routines.  Other parts of
      usbcore will be converted in later patches.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5b653c79
  5. 20 7月, 2007 2 次提交
  6. 13 7月, 2007 6 次提交
    • A
      USB: Don't resume root hub if the controller is suspended · cfa59dab
      Alan Stern 提交于
      Root hubs can't be resumed if their parent controller device is still
      suspended.  This patch (as925) adds a check for that condition in
      hcd_bus_resume() and prevents it from being treated as a fatal
      controller failure.
      
      ehci-hcd is updated to add the corresponding test.  Unnecessary
      debugging messages are removed from uhci-hcd and dummy-hcd.  The
      error return code from dummy-hcd is changed to -ESHUTDOWN, the same as
      the others.  ohci-hcd doesn't need any changes.
      
      Suspend handling in the non-PCI host drivers is somewhat hit-and-miss.
      This patch shouldn't have any effect on them.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cfa59dab
    • A
      USB: Remove usages of dev->power.power_state · e7e6da9e
      Alan Stern 提交于
      This patch (as922) removes all but one of the remaining vestiges of
      dev->power.power_state from usbcore.  The only usage left must remain
      until the deprecated "power/state" sysfs attribute is gone.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e7e6da9e
    • P
      usb: free DMA mappings if enqueue fails · 9f6a93f7
      Pete Zaitcev 提交于
      This patch releases DMA resources if enqueue fails in the HCD.
      
      Linux had this bug ever since we converted from virt_to_bus for 2.4.
      It is difficult to hit. A user would need a significant memory pressure
      or some other unusual condition.
      
      It was reported to me by IBM. They ran a management application for
      RSA II adapters which sent Bulk requests to an Interrupt endpoint.
      Submissions got rejected by HCD due to an invalid interval value
      and the swiotlb pool became depleted in the matter of hours.
      
      We fixed the invalid interval issue in devio.c separately, but this
      seems to be a bug worth fixing as well.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9f6a93f7
    • A
      USB: separate root and non-root suspend/resume · 686314cf
      Alan Stern 提交于
      This patch (as916) completes the separation of code paths for suspend
      and resume of root hubs as opposed to non-root devices.  Root hubs
      will be power-managed through their bus_suspend and bus_resume
      methods, whereas normal devices will use usb_port_suspend() and
      usb_port_resume().
      
      Changes to the hcd_bus_{suspend,resume} routines mostly represent
      motion of code that was already present elsewhere.  They include:
      
      	Adding debugging log messages,
      
      	Setting the device state appropriately, and
      
      	Adding a resume recovery time delay.
      
      Changes to the port-suspend and port-resume routines in hub.c include:
      
      	Removal of checks for root devices (since they will never
      	be triggered), and
      
      	Removal of checks for NULL or invalid device pointers (these
      	were left over from earlier kernel versions and aren't needed
      	at all).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      686314cf
    • O
      USB: introduce usb_anchor · 51a2f077
      Oliver Neukum 提交于
      - introduction of usb_anchor and its methods
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      51a2f077
    • A
      USB: Patch to align the various USB timers to fire at the same time · 01cd0819
      Arjan van de Ven 提交于
      This patch modifies the USB regular 250ms timer to be "perfectly aligned" to
      the second and quarters thereof. This change is there to make sure that if
      you have multiple USB ports, the timers for all these ports will fire at the
      same time rather than all spread out. All spread out wakes the CPU up from
      power saving idle a lot more than needed...
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      01cd0819
  7. 30 5月, 2007 1 次提交
    • A
      USB: replace flush_workqueue with cancel_sync_work · d5d4db70
      Alan Stern 提交于
      This patch (as912) replaces a couple of calls to flush_workqueue()
      with cancel_sync_work() and cancel_rearming_delayed_work().  Using a
      more directed approach allows us to avoid some nasty deadlocks.  The
      prime example occurs when a first-level device (the parent is a root
      hub) is removed while at the same time the root hub gets a remote
      wakeup request.  khubd would try to flush the autosuspend workqueue
      while holding the root-hub's lock, and the remote-wakeup workqueue
      routine would be waiting to lock the root hub.
      
      The patch also reorganizes the power management portion of
      usb_disconnect(), separating it out into its own routine.  The
      autosuspend workqueue entry is cancelled immediately instead of
      waiting for the device's release routine.  In addition,
      synchronization with the autosuspend thread is carried out even for
      root hubs (an oversight in the original code).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Mark Lord <lkml@rtr.ca>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d5d4db70
  8. 23 5月, 2007 2 次提交
  9. 28 4月, 2007 3 次提交
    • A
      USB: add "last_busy" field for use in autosuspend · 1941044a
      Alan Stern 提交于
      This patch (as877) adds a "last_busy" field to struct usb_device, for
      use by the autosuspend framework.  Now if an autosuspend call comes at
      a time when the device isn't busy but hasn't yet been idle for long
      enough, the timer can be set to exactly the desired value.  And we
      will be ready to handle things like HID drivers, which can't maintain
      a useful usage count and must rely on the time-of-last-use to decide
      when to autosuspend.
      
      The patch also makes some related minor improvements:
      
      	Move the calls to the autosuspend condition-checking routine
      	into usb_suspend_both(), which is the only place where it
      	really matters.
      
      	If the autosuspend timer is already running, don't stop
      	and restart it.
      
      	Replace immediate returns with gotos so that the optional
      	debugging ouput won't be bypassed.
      
      	If autoresume is disabled but the device is already awake,
      	don't return an error for an autoresume call.
      
      	Don't try to autoresume a device if it isn't suspended.
      	(Yes, this undercuts the previous change -- so sue me.)
      
      	Don't duplicate existing code in the autosuspend work routine.
      
      	Fix the kerneldoc in usb_autopm_put_interface(): If an
      	autoresume call fails, the usage counter is left unchanged.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      1941044a
    • A
      USB: separate autosuspend from external suspend · 6b157c9b
      Alan Stern 提交于
      This patch (as866) adds new entry points for external USB device
      suspend and resume requests, as opposed to internally-generated
      autosuspend or autoresume.  It also changes the existing
      remote-wakeup code paths to use the new routines, since remote wakeup
      is not the same as autoresume.
      
      As part of the change, it turns out to be necessary to do remote
      wakeup of root hubs from a workqueue.  We had been using khubd, but it
      does autoresume rather than an external resume.  Using the
      ksuspend_usb_wq workqueue for this purpose seemed a logical choice.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6b157c9b
    • A
      USB: fix race in HCD removal · 1b42ae6d
      Alan Stern 提交于
      This patch (as865) fixes a race in the HCD removal code discovered by
      Milan Plzik.  Arrival of an interrupt after the root hub was
      unregistered could cause the root-hub status timer to start up, even
      after it was supposed to have been shut down.  The problem is fixed by
      moving the del_timer_sync() call to after the HCD's stop() method, at
      which time IRQ generation should be disabled.
      
      Cc: Milan Plzik <milan.plzik@gmail.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1b42ae6d
  10. 08 2月, 2007 1 次提交
  11. 02 12月, 2006 1 次提交
    • I
      usb hub: fix root hub code so it takes more than 15 devices per root hub · 88fafff9
      inaky@linux.intel.com 提交于
      Wireless USB Host Controllers accept a large number of devices per
      host, which shows up as a large number of ports in its root hub.
      
      When the number of ports in a hub device goes over 16, the activation
      of the hub fails with the cryptic message in klogd.
      
      hub 2-0:1.0: activate --> -22
      
      Following this further, it was seen that:
      
      hub_probe()
        hub_configure()
          generates pipe number
      
          pseudo allocates buffer 'maxp' bytes in size using usb_maxpacket()
      
            The endpoint descriptor for a root hub interrupt endpoint is
            declared in
            drivers/usb/core/hcd.c:hs_rh_config_descriptor and declares it
            to be size two (supporting 15 devices max).
      
          hub_activate()
            usb_hcd_submit_urb()
              rh_urb_enqueue()
                urb->pipe is neither int nor ctl, so it errors out
                  rh_queue_status()
                    Returns -EINVAL because the buffer length is smaller
                    than the minimum needed to report all the hub port
                    bits as in accordance with USB2.0[11.12.3]. There has
                    to be trunc((PORTS + 1 + 7) / 8) bytes of space at
                    least.
      
      Alan Stern confirmed that the reason for reading maxpktsize and not
      the right amount is because some hubs are known to return more data
      and thus cause overflow. 
      
      So this patch simply changes the code to make the interrupt endpoint's
      max packet size be at least the minimum required by USB_MAXCHILDREN
      (instead of a fixed magic number) and add documentation for that. This
      way we are always ahead of the limit.
      Signed-off-by: NInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      88fafff9
  12. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  13. 02 10月, 2006 1 次提交
    • S
      [PATCH] namespaces: utsname: use init_utsname when appropriate · 96b644bd
      Serge E. Hallyn 提交于
      In some places, particularly drivers and __init code, the init utsns is the
      appropriate one to use.  This patch replaces those with a the init_utsname
      helper.
      
      Changes: Removed several uses of init_utsname().  Hope I picked all the
      	right ones in net/ipv4/ipconfig.c.  These are now changed to
      	utsname() (the per-process namespace utsname) in the previous
      	patch (2/7)
      
      [akpm@osdl.org: CIFS fix]
      Signed-off-by: NSerge E. Hallyn <serue@us.ibm.com>
      Cc: Kirill Korotaev <dev@openvz.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Herbert Poetzl <herbert@13thfloor.at>
      Cc: Andrey Savochkin <saw@sw.ru>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      96b644bd
  14. 29 9月, 2006 1 次提交