11 Dec, 2014

4 commits

  • firewire-core uses fw_card.lock to protect topology data and transaction
    data. firewire-sbp2 uses fw_card.lock for entirely unrelated purposes.

    Introduce a sbp2_target.lock to firewire-sbp2 and replace all
    fw_card.lock uses in the driver. fw_card.lock is now entirely private
    to firewire-core. This has no immediate advantage apart from making it
    clear in the code that firewire-sbp2 does not interact with the core
    via the core lock.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Users of card->lock Calling context
    ------------------------------------------------------------------------
    sbp2_status_write AR-req handler, tasklet
    complete_transaction AR-resp or AT-req handler, tasklet
    sbp2_send_orb among else scsi host .queuecommand, which may
    be called in some sort of atomic context
    sbp2_cancel_orbs sbp2_send_management_orb/
    sbp2_{login,reconnect,remove},
    worklet or process
    sbp2_scsi_abort, scsi eh thread
    sbp2_allow_block sbp2_login, worklet
    sbp2_conditionally_block among else complete_command_orb, tasklet
    sbp2_conditionally_unblock sbp2_{login,reconnect}, worklet
    sbp2_unblock sbp2_{login,remove}, worklet or process

    Drop the IRQ flags saving from sbp2_cancel_orbs,
    sbp2_conditionally_unblock, and sbp2_unblock.
    It was already omitted in sbp2_allow_block.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • The assertion in the comment in sbp2_allow_block() is no longer true.
    Or maybe it never was true. At least now, the sole caller of
    sbp2_allow_block(), sbp2_login, can run concurrently to one of
    sbp2_unblock()'s callers, sbp2_remove.

    sbp2_login is performed by sbp2_logical_unit.work.
    sbp2_remove is performed by fw_device.work.
    sbp2_remove cancels sbp2_logical_unit.work, but only after it called
    sbp2_unblock.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • fw_csr_string() truncates and terminates target strings like strlcpy()
    does. Unlike strlcpy(), it returns the target strlen, not the source
    strlen, hence users of fw_csr_string() are unable to detect truncation.

    Point this behavior out in the kerneldoc comment.

    Signed-off-by: Stefan Richter
    Reviewed-by: Takashi Sakamoto

    Stefan Richter
     

19 Nov, 2014

1 commit


14 Nov, 2014

1 commit

  • Found by the UC-KLEE tool: A user could supply less input to
    firewire-cdev ioctls than write- or write/read-type ioctl handlers
    expect. The handlers used data from uninitialized kernel stack then.

    This could partially leak back to the user if the kernel subsequently
    generated fw_cdev_event_'s (to be read from the firewire-cdev fd)
    which notably would contain the _u64 closure field which many of the
    ioctl argument structures contain.

    The fact that the handlers would act on random garbage input is a
    lesser issue since all handlers must check their input anyway.

    The fix simply always null-initializes the entire ioctl argument buffer
    regardless of the actual length of expected user input. That is, a
    runtime overhead of memset(..., 40) is added to each firewirew-cdev
    ioctl() call. [Comment from Clemens Ladisch: This part of the stack is
    most likely to be already in the cache.]

    Remarks:
    - There was never any leak from kernel stack to the ioctl output
    buffer itself. IOW, it was not possible to read kernel stack by a
    read-type or write/read-type ioctl alone; the leak could at most
    happen in combination with read()ing subsequent event data.
    - The actual expected minimum user input of each ioctl from
    include/uapi/linux/firewire-cdev.h is, in bytes:
    [0x00] = 32, [0x05] = 4, [0x0a] = 16, [0x0f] = 20, [0x14] = 16,
    [0x01] = 36, [0x06] = 20, [0x0b] = 4, [0x10] = 20, [0x15] = 20,
    [0x02] = 20, [0x07] = 4, [0x0c] = 0, [0x11] = 0, [0x16] = 8,
    [0x03] = 4, [0x08] = 24, [0x0d] = 20, [0x12] = 36, [0x17] = 12,
    [0x04] = 20, [0x09] = 24, [0x0e] = 4, [0x13] = 40, [0x18] = 4.

    Reported-by: David Ramos
    Cc:
    Signed-off-by: Stefan Richter

    Stefan Richter
     

07 Aug, 2014

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Steady transitioning of the BPF instructure to a generic spot so
    all kernel subsystems can make use of it, from Alexei Starovoitov.

    2) SFC driver supports busy polling, from Alexandre Rames.

    3) Take advantage of hash table in UDP multicast delivery, from David
    Held.

    4) Lighten locking, in particular by getting rid of the LRU lists, in
    inet frag handling. From Florian Westphal.

    5) Add support for various RFC6458 control messages in SCTP, from
    Geir Ola Vaagland.

    6) Allow to filter bridge forwarding database dumps by device, from
    Jamal Hadi Salim.

    7) virtio-net also now supports busy polling, from Jason Wang.

    8) Some low level optimization tweaks in pktgen from Jesper Dangaard
    Brouer.

    9) Add support for ipv6 address generation modes, so that userland
    can have some input into the process. From Jiri Pirko.

    10) Consolidate common TCP connection request code in ipv4 and ipv6,
    from Octavian Purdila.

    11) New ARP packet logger in netfilter, from Pablo Neira Ayuso.

    12) Generic resizable RCU hash table, with intial users in netlink and
    nftables. From Thomas Graf.

    13) Maintain a name assignment type so that userspace can see where a
    network device name came from (enumerated by kernel, assigned
    explicitly by userspace, etc.) From Tom Gundersen.

    14) Automatic flow label generation on transmit in ipv6, from Tom
    Herbert.

    15) New packet timestamping facilities from Willem de Bruijn, meant to
    assist in measuring latencies going into/out-of the packet
    scheduler, latency from TCP data transmission to ACK, etc"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1536 commits)
    cxgb4 : Disable recursive mailbox commands when enabling vi
    net: reduce USB network driver config options.
    tg3: Modify tg3_tso_bug() to handle multiple TX rings
    amd-xgbe: Perform phy connect/disconnect at dev open/stop
    amd-xgbe: Use dma_set_mask_and_coherent to set DMA mask
    net: sun4i-emac: fix memory leak on bad packet
    sctp: fix possible seqlock seadlock in sctp_packet_transmit()
    Revert "net: phy: Set the driver when registering an MDIO bus device"
    cxgb4vf: Turn off SGE RX/TX Callback Timers and interrupts in PCI shutdown routine
    team: Simplify return path of team_newlink
    bridge: Update outdated comment on promiscuous mode
    net-timestamp: ACK timestamp for bytestreams
    net-timestamp: TCP timestamping
    net-timestamp: SCHED timestamp on entering packet scheduler
    net-timestamp: add key to disambiguate concurrent datagrams
    net-timestamp: move timestamp flags out of sk_flags
    net-timestamp: extend SCM_TIMESTAMPING ancillary data struct
    cxgb4i : Move stray CPL definitions to cxgb4 driver
    tcp: reduce spurious retransmits due to transient SACK reneging
    qlcnic: Initialize dcbnl_ops before register_netdev
    ...

    Linus Torvalds
     

06 Aug, 2014

1 commit

  • Pull timer and time updates from Thomas Gleixner:
    "A rather large update of timers, timekeeping & co

    - Core timekeeping code is year-2038 safe now for 32bit machines.
    Now we just need to fix all in kernel users and the gazillion of
    user space interfaces which rely on timespec/timeval :)

    - Better cache layout for the timekeeping internal data structures.

    - Proper nanosecond based interfaces for in kernel users.

    - Tree wide cleanup of code which wants nanoseconds but does hoops
    and loops to convert back and forth from timespecs. Some of it
    definitely belongs into the ugly code museum.

    - Consolidation of the timekeeping interface zoo.

    - A fast NMI safe accessor to clock monotonic for tracing. This is a
    long standing request to support correlated user/kernel space
    traces. With proper NTP frequency correction it's also suitable
    for correlation of traces accross separate machines.

    - Checkpoint/restart support for timerfd.

    - A few NOHZ[_FULL] improvements in the [hr]timer code.

    - Code move from kernel to kernel/time of all time* related code.

    - New clocksource/event drivers from the ARM universe. I'm really
    impressed that despite an architected timer in the newer chips SoC
    manufacturers insist on inventing new and differently broken SoC
    specific timers.

    [ Ed. "Impressed"? I don't think that word means what you think it means ]

    - Another round of code move from arch to drivers. Looks like most
    of the legacy mess in ARM regarding timers is sorted out except for
    a few obnoxious strongholds.

    - The usual updates and fixlets all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (114 commits)
    timekeeping: Fixup typo in update_vsyscall_old definition
    clocksource: document some basic timekeeping concepts
    timekeeping: Use cached ntp_tick_length when accumulating error
    timekeeping: Rework frequency adjustments to work better w/ nohz
    timekeeping: Minor fixup for timespec64->timespec assignment
    ftrace: Provide trace clocks monotonic
    timekeeping: Provide fast and NMI safe access to CLOCK_MONOTONIC
    seqcount: Add raw_write_seqcount_latch()
    seqcount: Provide raw_read_seqcount()
    timekeeping: Use tk_read_base as argument for timekeeping_get_ns()
    timekeeping: Create struct tk_read_base and use it in struct timekeeper
    timekeeping: Restructure the timekeeper some more
    clocksource: Get rid of cycle_last
    clocksource: Move cycle_last validation to core code
    clocksource: Make delta calculation a function
    wireless: ath9k: Get rid of timespec conversions
    drm: vmwgfx: Use nsec based interfaces
    drm: i915: Use nsec based interfaces
    timekeeping: Provide ktime_get_raw()
    hangcheck-timer: Use ktime_get_ns()
    ...

    Linus Torvalds
     

31 Jul, 2014

1 commit


28 Jul, 2014

1 commit


24 Jul, 2014

1 commit

  • Revert half of commit d151f9854f21: If isochronous I/O is attempted with
    packets larget than 1 kByte, VIA VT6315 rev 01 immediately stops to generate
    any interrupts if MSI are used. Fix this by going back to legacy interrupts.
    [Thread "Isochronous streaming with VT6315 OHCI",
    http://marc.info/?t=139049641500003]

    With smaller packets, the loss of IRQs happens too but only very rarely ---
    rarely eneough that it was not yet possible for me to determine whether
    QUIRK_NO_MSI is an actual fix for this rare variation of this chip bug.

    I am keeping QUIRK_CYCLE_TIMER off of VT6315 rev >= 1 because this has been
    verified by myself with certainty. On the other hand, I am also keeping
    QUIRK_CYCLE_TIMER on for VT6315 rev 0 because I don't know at this time
    whether this revision accesses Cycle Timer non-atomically like most of the
    other VIA OHCIs are known to do.

    Reported-by: Rémy Bruno
    Signed-off-by: Stefan Richter

    Stefan Richter
     

17 Jul, 2014

1 commit


16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

15 Jul, 2014

1 commit


14 Jul, 2014

1 commit

  • Commit b3d681a4fc108f9653bbb44e4f4e72db2b8a5734 ("firewire: Use
    COMPILE_TEST for build testing") added COMPILE_TEST as an alternative
    dependency for the purpose of build testing the firewire core.
    However, this bypasses all other implicit dependencies assumed by PCI,
    like HAS_DMA.

    If NO_DMA=y:

    drivers/built-in.o: In function `fw_iso_buffer_destroy':
    (.text+0x36a096): undefined reference to `dma_unmap_page'
    drivers/built-in.o: In function `fw_iso_buffer_map_dma':
    (.text+0x36a164): undefined reference to `dma_map_page'
    drivers/built-in.o: In function `fw_iso_buffer_map_dma':
    (.text+0x36a172): undefined reference to `dma_mapping_error'
    drivers/built-in.o: In function `sbp2_send_management_orb':
    sbp2.c:(.text+0x36c6b4): undefined reference to `dma_map_single'
    sbp2.c:(.text+0x36c6c8): undefined reference to `dma_mapping_error'
    sbp2.c:(.text+0x36c772): undefined reference to `dma_map_single'
    sbp2.c:(.text+0x36c786): undefined reference to `dma_mapping_error'
    sbp2.c:(.text+0x36c854): undefined reference to `dma_unmap_single'
    sbp2.c:(.text+0x36c872): undefined reference to `dma_unmap_single'
    drivers/built-in.o: In function `sbp2_map_scatterlist':
    sbp2.c:(.text+0x36ccbc): undefined reference to `scsi_dma_map'
    sbp2.c:(.text+0x36cd36): undefined reference to `dma_map_single'
    sbp2.c:(.text+0x36cd4e): undefined reference to `dma_mapping_error'
    sbp2.c:(.text+0x36cd84): undefined reference to `scsi_dma_unmap'
    drivers/built-in.o: In function `sbp2_unmap_scatterlist':
    sbp2.c:(.text+0x36cda6): undefined reference to `scsi_dma_unmap'
    sbp2.c:(.text+0x36cdc6): undefined reference to `dma_unmap_single'
    drivers/built-in.o: In function `complete_command_orb':
    sbp2.c:(.text+0x36d6ac): undefined reference to `dma_unmap_single'
    drivers/built-in.o: In function `sbp2_scsi_queuecommand':
    sbp2.c:(.text+0x36d8e0): undefined reference to `dma_map_single'
    sbp2.c:(.text+0x36d8f6): undefined reference to `dma_mapping_error'

    Add an explicit dependency on HAS_DMA to fix this.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Jean Delvare
    Signed-off-by: Stefan Richter

    Geert Uytterhoeven
     

12 Jun, 2014

1 commit

  • do_posix_clock_monotonic_gettime() is a leftover from the initial
    posix timer implementation which maps to ktime_get_ts()

    Signed-off-by: Thomas Gleixner
    Cc: John Stultz
    Cc: Peter Zijlstra
    Acked-by: Stefan Richter
    Link: http://lkml.kernel.org/r/20140611234607.351283464@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

05 Jun, 2014

1 commit

  • Pull sound updates from Takashi Iwai:
    "At this time, majority of changes come from ASoC world while we got a
    few new drivers in other places for FireWire and USB. There have been
    lots of ASoC core cleanups / refactoring, but very little visible to
    external users.

    ASoC:
    - Support for specifying aux CODECs in DT
    - Removal of the deprecated mux and enum macros
    - More moves towards full componentisation
    - Removal of some unused I/O code
    - Lots of cleanups, fixes and enhancements to the davinci, Freescale,
    Haswell and Realtek drivers
    - Several drivers exposed directly in Kconfig for use with
    simple-card
    - GPIO descriptor support for jacks
    - More updates and fixes to the Freescale SSI, Intel and rsnd drivers
    - New drivers for Cirrus CS42L56, Realtek RT5639, RT5642 and RT5651
    and ST STA350, Analog Devices ADAU1361, ADAU1381, ADAU1761 and
    ADAU1781, and Realtek RT5677

    HD-audio:
    - Clean up Dell headset quirks
    - Noise fixes for Dell and Sony laptops
    - Thinkpad T440 dock fix
    - Realtek codec updates (ALC293,ALC233,ALC3235)
    - Tegra HD-audio HDMI support

    FireWire-audio:
    - FireWire audio stack enhancement (AMDTP, MIDI), support for
    incoming isochronous stream and duplex streams with timestamp
    synchronization
    - BeBoB-based devices support
    - Fireworks-based device support

    USB-audio:
    - Behringer BCD2000 USB device support

    Misc:
    - Clean up of a few old drivers, atmel, fm801, etc"

    * tag 'sound-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (480 commits)
    ASoC: Fix wrong argument for card remove callbacks
    ASoC: free jack GPIOs before the sound card is freed
    ALSA: firewire-lib: Remove a comment about restriction of asynchronous operation
    ASoC: cache: Fix error code when not using ASoC level cache
    ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup
    ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop
    ALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data
    ASoC: add RT5677 CODEC driver
    ASoC: intel: The Baytrail/MAX98090 driver depends on I2C
    ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared support
    ASoC: rt5640: Add the function of the PLL clock calculation to RL6231 shared support
    ASoC: rt5640: Add RL6231 class device shared support for RT5640, RT5645 and RT5651
    ASoC: cache: Fix possible ZERO_SIZE_PTR pointer dereferencing error.
    ASoC: Add helper functions to cast from DAPM context to CODEC/platform
    ALSA: bebob: sizeof() vs ARRAY_SIZE() typo
    ASoC: wm9713: correct mono out PGA sources
    ALSA: synth: emux: soundfont.c: Cleaning up memory leak
    ASoC: fsl: Remove dependencies of boards for SND_SOC_EUKREA_TLV320
    ASoC: fsl-ssi: Use regmap
    ASoC: fsl-ssi: reorder and document fsl_ssi_private
    ...

    Linus Torvalds
     

04 Jun, 2014

2 commits

  • …ee1394/linux1394 into next

    Pull firewire updates from Stefan Richter:
    "IEEE 1394 (FireWire) subsystem changes: One optimization for some VIA
    controllers, one fix, one kconfig brushup"

    * tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
    firewire: ohci: enable MSI for VIA VT6315 rev 1, drop cycle timer quirk
    firewire: Use COMPILE_TEST for build testing
    firewire: net: fix NULL derefencing in fwnet_probe()

    Linus Torvalds
     
  • …el/git/tip/tip into next

    Pull core locking updates from Ingo Molnar:
    "The main changes in this cycle were:

    - reduced/streamlined smp_mb__*() interface that allows more usecases
    and makes the existing ones less buggy, especially in rarer
    architectures

    - add rwsem implementation comments

    - bump up lockdep limits"

    * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
    rwsem: Add comments to explain the meaning of the rwsem's count field
    lockdep: Increase static allocations
    arch: Mass conversion of smp_mb__*()
    arch,doc: Convert smp_mb__*()
    arch,xtensa: Convert smp_mb__*()
    arch,x86: Convert smp_mb__*()
    arch,tile: Convert smp_mb__*()
    arch,sparc: Convert smp_mb__*()
    arch,sh: Convert smp_mb__*()
    arch,score: Convert smp_mb__*()
    arch,s390: Convert smp_mb__*()
    arch,powerpc: Convert smp_mb__*()
    arch,parisc: Convert smp_mb__*()
    arch,openrisc: Convert smp_mb__*()
    arch,mn10300: Convert smp_mb__*()
    arch,mips: Convert smp_mb__*()
    arch,metag: Convert smp_mb__*()
    arch,m68k: Convert smp_mb__*()
    arch,m32r: Convert smp_mb__*()
    arch,ia64: Convert smp_mb__*()
    ...

    Linus Torvalds
     

30 May, 2014

1 commit

  • Commit af0cdf494781 "firewire: ohci: fix regression with VIA VT6315,
    disable MSI" acted upon a report against VT6315 rev 0:
    http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-12/msg02301.html
    $ lspci -nn
    VIA Technologies, Inc. VT6315 Series Firewire Controller [1106:3403]

    I now got a card with
    $ lspci -nn
    VIA Technologies, Inc. VT6315 Series Firewire Controller [1106:3403] (rev 01)
    and this works fine with MSI enabled.

    Second, I tested this VT6315 rev 1 without CYCLE_TIMER quirk flag using
    http://me.in-berlin.de/~s5r6/linux1394/utils/test_cycle_time_v20100125.c
    and found that this chip does in fact access the cycle timer atomically.

    Things I can't test because I don't have the hardware:
    - whether VT6315 rev 0 really needs QUIRK_CYCLE_TIMER,
    - whether the VT6320 PCI device needs QUIRK_CYCLE_TIMER,
    - whether the VT6325 and VT6330 PCIe devices need QUIRK_CYCLE_TIMER
    and QUIRK_NO_MSI.

    Hence, just add a whitelist entry specifically for VT6315 rev >= 1
    without any quirk flags. Before this entry we need an extra entry to
    catch VT6315 rev

    Stefan Richter
     

29 May, 2014

1 commit

  • Undo a feature introduced in v3.14 by commit fcd46b34425d
    "firewire: Enable remote DMA above 4 GB". That change raised the
    minimum address at which protocol drivers and user programs can register
    for request reception from 0x0001'0000'0000 to 0x8000'0000'0000.
    It turned out that at least one vendor-specific protocol exists which
    uses lower addresses: https://bugzilla.kernel.org/show_bug.cgi?id=76921

    For the time being, revert most of commit fcd46b34425d so that affected
    protocols work like with kernel v3.13 and before. Just keep the valid
    documentation parts from the regressing commit, and the ability to
    identify controllers which could be programmed to accept >32 bit
    physical DMA addresses. The rest of fcd46b34425d should probably be
    brought back as an optional instead of default feature.

    Reported-by: Fabien Spindler
    Cc: # 3.14+
    Signed-off-by: Stefan Richter

    Stefan Richter
     

26 May, 2014

1 commit

  • In post commit, a quirk of this firmware about transactions is reported.
    This commit apply a workaround for this quirk.

    They often fail transactions due to gap_count mismatch. This state is changed
    by generating bus reset.

    The fw_schedule_bus_reset() is an exported symbol in firewire-core. But there
    are no header for public. This commit moves its prototype from
    drivers/firewire/core.h to include/linux/firewire.h.

    This mismatch still affects bus management before generating this bus reset.
    It still takes a time to call driver's probe() because transactions are still
    often failed.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

17 May, 2014

1 commit


12 May, 2014

1 commit


18 Apr, 2014

1 commit

  • Mostly scripted conversion of the smp_mb__* barriers.

    Signed-off-by: Peter Zijlstra
    Acked-by: Paul E. McKenney
    Link: http://lkml.kernel.org/n/tip-55dhyhocezdw1dg7u19hmh1u@git.kernel.org
    Cc: Linus Torvalds
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

09 Mar, 2014

1 commit

  • Pull workqueue fix from Tejun Heo:
    "This pull request contains a workqueue usage fix for firewire.

    For quite a long time now, workqueue only treats two work items
    identical iff both their addresses and callbacks match. This is to
    avoid introducing false dependency through the work item being
    recycled while being executed. This changes non-reentrancy guarantee
    for the users of PREPARE[_DELAYED]_WORK() - if the function changes,
    reentrancy isn't guaranteed against the previous instance. Firewire
    depended on such nonreentrancy guarantee.

    This is fixed by doing the work item multiplexing from firewire proper
    while keeping the work function unchanged"

    * 'for-3.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
    firewire: don't use PREPARE_DELAYED_WORK

    Linus Torvalds
     

07 Mar, 2014

2 commits

  • PREPARE_[DELAYED_]WORK() are being phased out. They have few users
    and a nasty surprise in terms of reentrancy guarantee as workqueue
    considers work items to be different if they don't have the same work
    function.

    firewire core-device and sbp2 have been been multiplexing work items
    with multiple work functions. Introduce fw_device_workfn() and
    sbp2_lu_workfn() which invoke fw_device->workfn and
    sbp2_logical_unit->workfn respectively and always use the two
    functions as the work functions and update the users to set the
    ->workfn fields instead of overriding work functions using
    PREPARE_DELAYED_WORK().

    This fixes a variety of possible regressions since a2c1c57be8d9
    "workqueue: consider work function when searching for busy work items"
    due to which fw_workqueue lost its required non-reentrancy property.

    Signed-off-by: Tejun Heo
    Acked-by: Stefan Richter
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: stable@vger.kernel.org # v3.9+
    Cc: stable@vger.kernel.org # v3.8.2+
    Cc: stable@vger.kernel.org # v3.4.60+
    Cc: stable@vger.kernel.org # v3.2.40+

    Tejun Heo
     
  • Since commit bd972688eb24
    "firewire: ohci: Fix 'failed to read phy reg' on FW643 rev8",
    there is a high chance that firewire-ohci fails to initialize LSI née
    Agere controllers.
    https://bugzilla.kernel.org/show_bug.cgi?id=65151

    Peter Hurley points out the reason: IEEE 1394a:2000 clause 5A.1 (or
    IEEE 1394:2008 clause 17.2.1) say: "The PHY shall insure that no more
    than 10 ms elapse from the reassertion of LPS until the interface is
    reset. The link shall not assert LReq until the reset is complete."
    In other words, the link needs to give the PHY at least 10 ms to get
    the interface operational.

    With just the msleep(1) in bd972688eb24, the first read_phy_reg()
    during ohci_enable() may happen before the phy-link interface reset was
    finished, and fail. Due to the high variability of msleep(n) with small
    n, this failure was not fully reproducible, and not apparent at all with
    low CONFIG_HZ setting.

    On the other hand, Peter can no longer reproduce the issue with FW643
    rev8. The read phy reg failures that happened back then may have had an
    unrelated cause. So, just revert bd972688eb24, except for the valid
    comment on TSB82AA2 cards.

    Reported-by: Mikhail Gavrilov
    Reported-by: Jay Fenlason
    Reported-by: Clemens Ladisch
    Reported-by: Peter Hurley
    Cc: stable@vger.kernel.org # v3.10+
    Signed-off-by: Stefan Richter

    Stefan Richter
     

28 Feb, 2014

1 commit

  • Commit 8408dc1c14c1 "firewire: net: use dev_printk API" introduced a
    use-after-free in a failure path. fwnet_transmit_packet_failed(ptask)
    may free ptask, then the dev_err() call dereferenced it. The fix is
    straightforward; simply reorder the two calls.

    Reported-by: Dan Carpenter
    Cc: stable@vger.kernel.org # v3.4+
    Signed-off-by: Stefan Richter

    Stefan Richter
     

20 Jan, 2014

1 commit

  • This makes all of a machine's memory accessible to remote debugging via
    FireWire, using the physical response unit (i.e. RDMA) of OHCI-1394 link
    layer controllers.

    This requires actual support by the controller. The only ones currently
    known to support it are Agere/LSI FW643. Most if not all other OHCI-1394
    controllers do not implement the optional Physical Upper Bound register.
    With them, RDMA will continue to be limited to the lowermost 4 GB.

    firewire-ohci's startup message in the kernel log is augmented to tell
    whether the controller does expose more than 4 GB to RDMA.

    While OHCI-1394 allows for a maximum Physical Upper Bound of
    0xffff'0000'0000 (near 256 TB), this implementation sets it to
    0x8000'0000'0000 (128 TB) in order to avoid interference with applications
    that require interrupt-served asynchronous request reception at
    respectively low addresses.

    Note, this change does not switch remote DMA on. It only increases the
    range of remote access to all memory (instead of just 4 GB) whenever
    remote DMA was switched on by other means. The latter is achieved by
    setting firewire-ohci's remote_dma parameter, or if the physical DMA
    filter is opened through firewire-sbp2.

    Derived from patch "firewire: Enable physical DMA above 4GB" by
    Peter Hurley from March 27, 2013.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

13 Jan, 2014

1 commit


15 Dec, 2013

1 commit

  • Commit 54b2b50c20a6 "[SCSI] Disable WRITE SAME for RAID and virtual
    host adapter drivers" disabled WRITE SAME support for all SBP-2 attached
    targets. But as described in the changelog of commit b0ea5f19d3d8
    "firewire: sbp2: allow WRITE SAME and REPORT SUPPORTED OPERATION CODES",
    it is not required to blacklist WRITE SAME.

    Bring the feature back by reverting the sbp2.c hunk of commit 54b2b50c20a6.

    Signed-off-by: Stefan Richter
    Cc: stable@kernel.org

    Stefan Richter
     

29 Nov, 2013

1 commit

  • Some host adapters do not pass commands through to the target disk
    directly. Instead they provide an emulated target which may or may not
    accurately report its capabilities. In some cases the physical device
    characteristics are reported even when the host adapter is processing
    commands on the device's behalf. This can lead to adapter firmware hangs
    or excessive I/O errors.

    This patch disables WRITE SAME for devices connected to host adapters
    that provide an emulated target. Driver writers can disable WRITE SAME
    by setting the no_write_same flag in the host adapter template.

    [jejb: fix up rejections due to eh_deadline patch]
    Signed-off-by: Martin K. Petersen
    Cc: stable@kernel.org
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

15 Nov, 2013

1 commit


30 Aug, 2013

2 commits

  • Put bus_reset_work into its own workqueue. By doing this, forward
    progress of bus_reset_work() is guaranteed if the work is switched over
    to a rescuer thread.

    Switching work to a rescuer thread happens if a new worker thread could
    not be allocated in certain time (MAYDAY_INITIAL_TIMEOUT, typically 10
    ms). This might not be possible under high memory pressure or even on a
    heavily loaded embedded system running a slow serial console.

    The former deadlock occured in the following situation:
    The rescuer thread ran
    fw_device_init->read_config_rom->read_rom->fw_run_transaction.
    fw_run_transaction blocked waiting for the completion object.
    This completion object would have been completed in bus_reset_work,
    but this work was never executed in the rescuer thread due to its
    strictly sequential behaviour.

    [Stefan R.: Removed WQ_NON_REENTRANT flag from allocation because
    it is no longer needed in current kernels. Add it back if you backport
    to kernels older than 3.7, i.e. one which does not contain dbf2576e37da
    "workqueue: make all workqueues non-reentrant". Swapped order of
    destroy_workqueue and pci_unregister_driver.]

    Signed-off-by: Stephan Gatzka
    Signed-off-by: Stefan Richter

    Stephan Gatzka
     
  • This is a prerequisite to allocate a per driver self_id workqueue.
    This reverts the ohci.c part of patch
    fe2af11c220c7bb3a67f7aec0594811e5c59e019.

    Signed-off-by: Stephan Gatzka
    Signed-off-by: Stefan Richter

    Stephan Gatzka
     

19 Aug, 2013

2 commits

  • a) Sort device IDs by vendor -- device -- revision.

    b) Write quirk flags in hexadecimal. This affects the user-visible
    output of "modinfo firewire-ohci". Since more flags have been added
    recently, it is now easier to cope with them in hexadecimal represen-
    tation. Besides, the device-specific combination of quirk flags is
    shown in hexadecimal in the kernel log too. (And firewire-sbp2
    presents its own quirk flags in modinfo as hexadecimals as well.)

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • We have got

    struct descriptor *descriptors;
    dma_addr_t descriptors_bus;

    dma_addr_t buffer_bus;
    struct descriptor buffer[0];

    void *misc_buffer;
    dma_addr_t misc_buffer_bus;

    __be32 *config_rom;
    dma_addr_t config_rom_bus;
    __be32 *next_config_rom;
    dma_addr_t next_config_rom_bus;

    But then we have got

    __le32 *self_id_cpu;
    dma_addr_t self_id_bus;

    Better apply the pattern of xyz vs. xyz_bus to self_id vs. self_id_bus
    as well. The _cpu suffix looks particularly weird in conversions from
    little endian to CPU endian.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

30 Jul, 2013

2 commits

  • An idr related patch introduced the following sparse warning:
    drivers/firewire/core-cdev.c:488:33: warning: incorrect type in initializer (different base types)
    drivers/firewire/core-cdev.c:488:33: expected bool [unsigned] [usertype] preload
    drivers/firewire/core-cdev.c:488:33: got restricted gfp_t
    So let's convert from gfp_t bitfield to Boolean explicitly and safely.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • dbf2576e37 ("workqueue: make all workqueues non-reentrant") made
    WQ_NON_REENTRANT no-op and the flag is going away. Remove its usages.

    This patch doesn't introduce any behavior changes.

    Signed-off-by: Tejun Heo
    Signed-off-by: Stefan Richter

    Tejun Heo