21 Oct, 2020

4 commits

  • This commit removed unnecessary spin_locks in vhost_vring_call
    and related operations. Because we manipulate irq offloading
    contents in vhost_vdpa ioctl code path which is already
    protected by dev mutex and vq mutex.

    Signed-off-by: Zhu Lingshan
    Link: https://lore.kernel.org/r/20200909065234.3313-1-lingshan.zhu@intel.com
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang

    Zhu Lingshan
     
  • If riov and wiov are both defined and they point to different
    objects, only riov is initialized. If the wiov is not initialized
    by the caller, the function fails returning -EINVAL and printing
    "Readable desc 0x... after writable" error message.

    This issue happens when descriptors have both readable and writable
    buffers (eg. virtio-blk devices has virtio_blk_outhdr in the readable
    buffer and status as last byte of writable buffer) and we call
    __vringh_iov() to get both type of buffers in two different iovecs.

    Let's replace the 'else if' clause with 'if' to initialize both
    riov and wiov if they are not NULL.

    As checkpatch pointed out, we also avoid crashing the kernel
    when riov and wiov are both NULL, replacing BUG() with WARN_ON()
    and returning -EINVAL.

    Fixes: f87d0fbb5798 ("vringh: host-side implementation of virtio rings.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefano Garzarella
    Link: https://lore.kernel.org/r/20201008204256.162292-1-sgarzare@redhat.com
    Signed-off-by: Michael S. Tsirkin

    Stefano Garzarella
     
  • linux/kernel.h is included more than once, Remove the one that isn't
    necessary.

    Signed-off-by: Tian Tao
    Link: https://lore.kernel.org/r/1600131102-24672-1-git-send-email-tiantao6@hisilicon.com
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang

    Tian Tao
     
  • Fix the warning: [-Werror=-Wframe-larger-than=]

    drivers/vhost/vhost.c: In function log_used:
    drivers/vhost/vhost.c:1906:1:
    warning: the frame size of 1040 bytes is larger than 1024 bytes

    Signed-off-by: Li Wang
    Link: https://lore.kernel.org/r/1600106889-25013-1-git-send-email-li.wang@windriver.com
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang

    Li Wang
     

04 Oct, 2020

5 commits

  • Pinned pages are not properly accounted particularly when
    mapping error occurs on IOTLB update. Clean up dangling
    pinned pages for the error path. As the inflight pinned
    pages, specifically for memory region that strides across
    multiple chunks, would need more than one free page for
    book keeping and accounting. For simplicity, pin pages
    for all memory in the IOVA range in one go rather than
    have multiple pin_user_pages calls to make up the entire
    region. This way it's easier to track and account the
    pages already mapped, particularly for clean-up in the
    error path.

    Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
    Signed-off-by: Si-Wei Liu
    Link: https://lore.kernel.org/r/1601701330-16837-3-git-send-email-si-wei.liu@oracle.com
    Signed-off-by: Michael S. Tsirkin

    Si-Wei Liu
     
  • vhost_vdpa_map() should remove the iotlb entry just added
    if the corresponding mapping fails to set up properly.

    Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
    Signed-off-by: Si-Wei Liu
    Link: https://lore.kernel.org/r/1601701330-16837-2-git-send-email-si-wei.liu@oracle.com
    Signed-off-by: Michael S. Tsirkin

    Si-Wei Liu
     
  • When the IOTLB device is enabled, the log_guest_addr that is passed by
    userspace to the VHOST_SET_VRING_ADDR ioctl, and which is then written
    to vq->log_addr, is a GIOVA. All writes to this address are translated
    by log_user() to writes to an HVA, and then ultimately logged through
    the corresponding GPAs in log_write_hva(). No logging will ever occur
    with vq->log_addr in this case. It is thus wrong to pass vq->log_addr
    and log_guest_addr to log_access_vq() which assumes they are actual
    GPAs.

    Introduce a new vq_log_used_access_ok() helper that only checks accesses
    to the log for the used structure when there isn't an IOTLB device around.

    Signed-off-by: Greg Kurz
    Link: https://lore.kernel.org/r/160171933385.284610.10189082586063280867.stgit@bahia.lan
    Signed-off-by: Michael S. Tsirkin

    Greg Kurz
     
  • The open-coded computation of the used size doesn't take the event
    into account when the VIRTIO_RING_F_EVENT_IDX feature is present.
    Fix that by using vhost_get_used_size().

    Fixes: 8ea8cf89e19a ("vhost: support event index")
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kurz
    Link: https://lore.kernel.org/r/160171932300.284610.11846106312938909461.stgit@bahia.lan
    Signed-off-by: Michael S. Tsirkin

    Greg Kurz
     
  • When the IOTLB device is enabled, the vring addresses we get
    from userspace are GIOVAs. It is thus wrong to pass them down
    to access_ok() which only takes HVAs.

    Access validation is done at prefetch time with IOTLB. Teach
    vq_access_ok() about that by moving the (vq->iotlb) check
    from vhost_vq_access_ok() to vq_access_ok(). This prevents
    vhost_vring_set_addr() to fail when verifying the accesses.
    No behavior change for vhost_vq_access_ok().

    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1883084
    Fixes: 6b1e6cc7855b ("vhost: new device IOTLB API")
    Cc: jasowang@redhat.com
    CC: stable@vger.kernel.org # 4.14+
    Signed-off-by: Greg Kurz
    Acked-by: Jason Wang
    Link: https://lore.kernel.org/r/160171931213.284610.2052489816407219136.stgit@bahia.lan
    Signed-off-by: Michael S. Tsirkin

    Greg Kurz
     

30 Sep, 2020

1 commit

  • We must free the vqs array in the open failure path, because
    vhost_vdpa_release will not be called.

    Signed-off-by: Mike Christie
    Link: https://lore.kernel.org/r/1600712588-9514-2-git-send-email-michael.christie@oracle.com
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang

    Mike Christie
     

24 Sep, 2020

2 commits

  • Commit 653055b9acd4 ("vhost-vdpa: support get/set backend features")
    introduces two malfunction backend features ioctls:

    1) the ioctls was blindly added to vring ioctl instead of vdpa device
    ioctl
    2) vhost_set_backend_features() was called when dev mutex has already
    been held which will lead a deadlock

    This patch fixes the above issues.

    Cc: Eli Cohen
    Reported-by: Zhu Lingshan
    Fixes: 653055b9acd4 ("vhost-vdpa: support get/set backend features")
    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200907104343.31141-1-jasowang@redhat.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     
  • Fix documentation to match actual function prototypes

    "end" used instead of "last". Fix that.

    Signed-off-by: Eli Cohen
    Link: https://lore.kernel.org/r/20200630052925.GA157062@mtl-vdi-166.wap.labs.mlnx
    Signed-off-by: Michael S. Tsirkin

    Eli Cohen
     

04 Sep, 2020

1 commit

  • Pull networking fixes from David Miller:

    1) Use netif_rx_ni() when necessary in batman-adv stack, from Jussi
    Kivilinna.

    2) Fix loss of RTT samples in rxrpc, from David Howells.

    3) Memory leak in hns_nic_dev_probe(), from Dignhao Liu.

    4) ravb module cannot be unloaded, fix from Yuusuke Ashizuka.

    5) We disable BH for too lokng in sctp_get_port_local(), add a
    cond_resched() here as well, from Xin Long.

    6) Fix memory leak in st95hf_in_send_cmd, from Dinghao Liu.

    7) Out of bound access in bpf_raw_tp_link_fill_link_info(), from
    Yonghong Song.

    8) Missing of_node_put() in mt7530 DSA driver, from Sumera
    Priyadarsini.

    9) Fix crash in bnxt_fw_reset_task(), from Michael Chan.

    10) Fix geneve tunnel checksumming bug in hns3, from Yi Li.

    11) Memory leak in rxkad_verify_response, from Dinghao Liu.

    12) In tipc, don't use smp_processor_id() in preemptible context. From
    Tuong Lien.

    13) Fix signedness issue in mlx4 memory allocation, from Shung-Hsi Yu.

    14) Missing clk_disable_prepare() in gemini driver, from Dan Carpenter.

    15) Fix ABI mismatch between driver and firmware in nfp, from Louis
    Peens.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (110 commits)
    net/smc: fix sock refcounting in case of termination
    net/smc: reset sndbuf_desc if freed
    net/smc: set rx_off for SMCR explicitly
    net/smc: fix toleration of fake add_link messages
    tg3: Fix soft lockup when tg3_reset_task() fails.
    doc: net: dsa: Fix typo in config code sample
    net: dp83867: Fix WoL SecureOn password
    nfp: flower: fix ABI mismatch between driver and firmware
    tipc: fix shutdown() of connectionless socket
    ipv6: Fix sysctl max for fib_multipath_hash_policy
    drivers/net/wan/hdlc: Change the default of hard_header_len to 0
    net: gemini: Fix another missing clk_disable_unprepare() in probe
    net: bcmgenet: fix mask check in bcmgenet_validate_flow()
    amd-xgbe: Add support for new port mode
    net: usb: dm9601: Add USB ID of Keenetic Plus DSL
    vhost: fix typo in error message
    net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
    pktgen: fix error message with wrong function name
    net: ethernet: ti: am65-cpsw: fix rmii 100Mbit link mode
    cxgb4: fix thermal zone device registration
    ...

    Linus Torvalds
     

02 Sep, 2020

1 commit

  • "enable" should be "disable" when the function name is
    vhost_disable_notify(), which does the disabling work.

    Signed-off-by: Yunsheng Lin
    Acked-by: Jason Wang
    Acked-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller

    Yunsheng Lin
     

26 Aug, 2020

1 commit


12 Aug, 2020

1 commit

  • Pull virtio updates from Michael Tsirkin:

    - IRQ bypass support for vdpa and IFC

    - MLX5 vdpa driver

    - Endianness fixes for virtio drivers

    - Misc other fixes

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (71 commits)
    vdpa/mlx5: fix up endian-ness for mtu
    vdpa: Fix pointer math bug in vdpasim_get_config()
    vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
    vdpa/mlx5: fix memory allocation failure checks
    vdpa/mlx5: Fix uninitialised variable in core/mr.c
    vdpa_sim: init iommu lock
    virtio_config: fix up warnings on parisc
    vdpa/mlx5: Add VDPA driver for supported mlx5 devices
    vdpa/mlx5: Add shared memory registration code
    vdpa/mlx5: Add support library for mlx5 VDPA implementation
    vdpa/mlx5: Add hardware descriptive header file
    vdpa: Modify get_vq_state() to return error code
    net/vdpa: Use struct for set/get vq state
    vdpa: remove hard coded virtq num
    vdpasim: support batch updating
    vhost-vdpa: support IOTLB batching hints
    vhost-vdpa: support get/set backend features
    vhost: generialize backend features setting/getting
    vhost-vdpa: refine ioctl pre-processing
    vDPA: dont change vq irq after DRIVER_OK
    ...

    Linus Torvalds
     

06 Aug, 2020

7 commits

  • Modify get_vq_state() so it returns an error code. In case of hardware
    acceleration, the available index may be retrieved from the device, an
    operation that can possibly fail.

    Reviewed-by: Parav Pandit
    Signed-off-by: Eli Cohen
    Link: https://lore.kernel.org/r/20200804162048.22587-9-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang

    Eli Cohen
     
  • For now VQ state involves 16 bit available index value encoded in u64
    variable. In the future it will be extended to contain more fields. Use
    struct to contain the state, now containing only a single u16 for the
    available index. In the future we can add fields to this struct.

    Reviewed-by: Parav Pandit
    Acked-by: Jason Wang
    Signed-off-by: Eli Cohen
    Link: https://lore.kernel.org/r/20200804162048.22587-8-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Eli Cohen
     
  • This will enable vdpa providers to add support for multi queue feature
    and publish it to upper layers (vhost and virtio).

    Signed-off-by: Max Gurtovoy
    Reviewed-by: Jason Wang
    Link: https://lore.kernel.org/r/20200804162048.22587-7-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Max Gurtovoy
     
  • This patches extend the vhost IOTLB API to accept batch updating hints
    form userspace. When userspace wants update the device IOTLB in a
    batch, it may do:

    1) Write vhost_iotlb_msg with VHOST_IOTLB_BATCH_BEGIN flag
    2) Perform a batch of IOTLB updating via VHOST_IOTLB_UPDATE/INVALIDATE
    3) Write vhost_iotlb_msg with VHOST_IOTLB_BATCH_END flag

    Vhost-vdpa may decide to batch the IOMMU/IOTLB updating in step 3 when
    vDPA device support set_map() ops. This is useful for the vDPA device
    that want to know all the mappings to tweak their own DMA translation
    logic.

    For vDPA device that doesn't require set_map(), no behavior changes.

    This capability is advertised via VHOST_BACKEND_F_IOTLB_BATCH capability.

    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200804162048.22587-5-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     
  • This patch makes userspace can get and set backend features to
    vhost-vdpa.

    Signed-off-by: Cindy Lu
    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200804162048.22587-4-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     
  • Move the backend features setting/getting from net.c to vhost.c to be
    reused by vhost-vdpa.

    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200804162048.22587-3-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     
  • Switch to use 'switch' to make the codes more easier to be extended.

    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200804162048.22587-2-eli@mellanox.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     

05 Aug, 2020

7 commits

  • IRQ of a vq is not expected to be changed in a DRIVER_OK ~ !DRIVER_OK
    period for irq offloading purposes. Place this comment at the side of
    bus ops get_vq_irq than in set_status in vhost_vdpa.

    Signed-off-by: Zhu Lingshan
    Link: https://lore.kernel.org/r/20200804102123.69978-1-lingshan.zhu@intel.com
    Signed-off-by: Michael S. Tsirkin

    Zhu Lingshan
     
  • This patch introduce a set of functions for setup/unsetup
    and update irq offloading respectively by register/unregister
    and re-register the irq_bypass_producer.

    With these functions, this commit can setup/unsetup
    irq offloading through setting DRIVER_OK/!DRIVER_OK, and
    update irq offloading through SET_VRING_CALL.

    Signed-off-by: Zhu Lingshan
    Suggested-by: Jason Wang
    Link: https://lore.kernel.org/r/20200731065533.4144-5-lingshan.zhu@intel.com
    Signed-off-by: Michael S. Tsirkin

    Zhu Lingshan
     
  • This commit introduces struct vhost_vring_call which replaced
    raw struct eventfd_ctx *call_ctx in struct vhost_virtqueue.
    Besides eventfd_ctx, it contains a spin lock and an
    irq_bypass_producer in its structure.

    Signed-off-by: Zhu Lingshan
    Suggested-by: Jason Wang
    Link: https://lore.kernel.org/r/20200731065533.4144-2-lingshan.zhu@intel.com
    Signed-off-by: Michael S. Tsirkin

    Zhu Lingshan
     
  • Make use of the flex_array_size() helper to calculate the size of a
    flexible array member within an enclosing structure.

    This helper offers defense-in-depth against potential integer
    overflows, while at the same time makes it explicitly clear that
    we are dealing with a flexible array member.

    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200731130956.GA30525@embeddedor
    Signed-off-by: Michael S. Tsirkin

    Gustavo A. R. Silva
     
  • We used to have a per device feature whitelist to filter out the
    unsupported virtio features. But this seems unnecessary since:

    - the main idea behind feature whitelist is to block control vq
    feature until we finalize the control virtqueue API. But the current
    vhost-vDPA uAPI is sufficient to support control virtqueue. For
    device that has hardware control virtqueue, the vDPA device driver
    can just setup the hardware virtqueue and let userspace to use
    hardware virtqueue directly. For device that doesn't have a control
    virtqueue, the vDPA device driver need to use e.g vringh to emulate
    a software control virtqueue.
    - we don't do it in virtio-vDPA driver

    So remove this limitation.

    Signed-off-by: Jason Wang
    Link: https://lore.kernel.org/r/20200720085043.16485-1-jasowang@redhat.com
    Signed-off-by: Michael S. Tsirkin

    Jason Wang
     
  • For new helpers handling legacy features to be effective,
    vhost needs to invoke them. Tie them in.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • Pull uninitialized_var() macro removal from Kees Cook:
    "This is long overdue, and has hidden too many bugs over the years. The
    series has several "by hand" fixes, and then a trivial treewide
    replacement.

    - Clean up non-trivial uses of uninitialized_var()

    - Update documentation and checkpatch for uninitialized_var() removal

    - Treewide removal of uninitialized_var()"

    * tag 'uninit-macro-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    compiler: Remove uninitialized_var() macro
    treewide: Remove uninitialized_var() usage
    checkpatch: Remove awareness of uninitialized_var() macro
    mm/debug_vm_pgtable: Remove uninitialized_var() usage
    f2fs: Eliminate usage of uninitialized_var() macro
    media: sur40: Remove uninitialized_var() usage
    KVM: PPC: Book3S PR: Remove uninitialized_var() usage
    clk: spear: Remove uninitialized_var() usage
    clk: st: Remove uninitialized_var() usage
    spi: davinci: Remove uninitialized_var() usage
    ide: Remove uninitialized_var() usage
    rtlwifi: rtl8192cu: Remove uninitialized_var() usage
    b43: Remove uninitialized_var() usage
    drbd: Remove uninitialized_var() usage
    x86/mm/numa: Remove uninitialized_var() usage
    docs: deprecated.rst: Add uninitialized_var()

    Linus Torvalds
     

04 Aug, 2020

2 commits

  • Pull arm64 and cross-arch updates from Catalin Marinas:
    "Here's a slightly wider-spread set of updates for 5.9.

    Going outside the usual arch/arm64/ area is the removal of
    read_barrier_depends() series from Will and the MSI/IOMMU ID
    translation series from Lorenzo.

    The notable arm64 updates include ARMv8.4 TLBI range operations and
    translation level hint, time namespace support, and perf.

    Summary:

    - Removal of the tremendously unpopular read_barrier_depends()
    barrier, which is a NOP on all architectures apart from Alpha, in
    favour of allowing architectures to override READ_ONCE() and do
    whatever dance they need to do to ensure address dependencies
    provide LOAD -> LOAD/STORE ordering.

    This work also offers a potential solution if compilers are shown
    to convert LOAD -> LOAD address dependencies into control
    dependencies (e.g. under LTO), as weakly ordered architectures will
    effectively be able to upgrade READ_ONCE() to smp_load_acquire().
    The latter case is not used yet, but will be discussed further at
    LPC.

    - Make the MSI/IOMMU input/output ID translation PCI agnostic,
    augment the MSI/IOMMU ACPI/OF ID mapping APIs to accept an input ID
    bus-specific parameter and apply the resulting changes to the
    device ID space provided by the Freescale FSL bus.

    - arm64 support for TLBI range operations and translation table level
    hints (part of the ARMv8.4 architecture version).

    - Time namespace support for arm64.

    - Export the virtual and physical address sizes in vmcoreinfo for
    makedumpfile and crash utilities.

    - CPU feature handling cleanups and checks for programmer errors
    (overlapping bit-fields).

    - ACPI updates for arm64: disallow AML accesses to EFI code regions
    and kernel memory.

    - perf updates for arm64.

    - Miscellaneous fixes and cleanups, most notably PLT counting
    optimisation for module loading, recordmcount fix to ignore
    relocations other than R_AARCH64_CALL26, CMA areas reserved for
    gigantic pages on 16K and 64K configurations.

    - Trivial typos, duplicate words"

    Link: http://lkml.kernel.org/r/20200710165203.31284-1-will@kernel.org
    Link: http://lkml.kernel.org/r/20200619082013.13661-1-lorenzo.pieralisi@arm.com

    * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (82 commits)
    arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack
    arm64/mm: save memory access in check_and_switch_context() fast switch path
    arm64: sigcontext.h: delete duplicated word
    arm64: ptrace.h: delete duplicated word
    arm64: pgtable-hwdef.h: delete duplicated words
    bus: fsl-mc: Add ACPI support for fsl-mc
    bus/fsl-mc: Refactor the MSI domain creation in the DPRC driver
    of/irq: Make of_msi_map_rid() PCI bus agnostic
    of/irq: make of_msi_map_get_device_domain() bus agnostic
    dt-bindings: arm: fsl: Add msi-map device-tree binding for fsl-mc bus
    of/device: Add input id to of_dma_configure()
    of/iommu: Make of_map_rid() PCI agnostic
    ACPI/IORT: Add an input ID to acpi_dma_configure()
    ACPI/IORT: Remove useless PCI bus walk
    ACPI/IORT: Make iort_msi_map_rid() PCI agnostic
    ACPI/IORT: Make iort_get_device_domain IRQ domain agnostic
    ACPI/IORT: Make iort_match_node_callback walk the ACPI namespace for NC
    arm64: enable time namespace support
    arm64/vdso: Restrict splitting VVAR VMA
    arm64/vdso: Handle faults on timens page
    ...

    Linus Torvalds
     
  • Rename the bit to match latest virtio spec.
    Add a compat macro to avoid breaking existing userspace.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: David Hildenbrand

    Michael S. Tsirkin
     

30 Jul, 2020

1 commit

  • vhost/scsi doesn't handle type conversion correctly
    for request type when using virtio 1.0 and up for BE,
    or cross-endian platforms.

    Fix it up using vhost_32_to_cpu.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang
    Reviewed-by: Stefan Hajnoczi

    Michael S. Tsirkin
     

21 Jul, 2020

1 commit

  • Since commit 76ebbe78f739 ("locking/barriers: Add implicit
    smp_read_barrier_depends() to READ_ONCE()"), there is no need to use
    smp_read_barrier_depends() outside of the Alpha architecture code.

    Unfortunately, there is precisely _one_ user in the vhost code, and
    there isn't an obvious READ_ONCE() access making the barrier
    redundant. However, on closer inspection (thanks, Jason), it appears
    that vring synchronisation between the producer and consumer occurs via
    the 'avail_idx' field, which is followed up by an rmb() in
    vhost_get_vq_desc(), making the read_barrier_depends() redundant on
    Alpha.

    Jason says:

    | I'm also confused about the barrier here, basically in driver side
    | we did:
    |
    | 1) allocate pages
    | 2) store pages in indirect->addr
    | 3) smp_wmb()
    | 4) increase the avail idx (somehow a tail pointer of vring)
    |
    | in vhost we did:
    |
    | 1) read avail idx
    | 2) smp_rmb()
    | 3) read indirect->addr
    | 4) read from indirect->addr
    |
    | It looks to me even the data dependency barrier is not necessary
    | since we have rmb() which is sufficient for us to the correct
    | indirect->addr and driver are not expected to do any writing to
    | indirect->addr after avail idx is increased

    Remove the redundant barrier invocation.

    Acked-by: Michael S. Tsirkin
    Acked-by: Peter Zijlstra (Intel)
    Suggested-by: Jason Wang
    Acked-by: Paul E. McKenney
    Signed-off-by: Will Deacon

    Will Deacon
     

17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

23 Jun, 2020

2 commits

  • Currently, it only removes and add backend, but it will reset vq
    position in future commits.

    Signed-off-by: Eugenio Pérez
    Link: https://lore.kernel.org/r/20200418102217.32327-5-eperezma@redhat.com
    Signed-off-by: Michael S. Tsirkin

    Eugenio Pérez
     
  • The "vma->vm_pgoff" variable is an unsigned long so if it's larger than
    INT_MAX then "index" can be negative leading to an underflow. Fix this
    by changing the type of "index" to "unsigned long".

    Fixes: ddd89d0a059d ("vhost_vdpa: support doorbell mapping via mmap")
    Signed-off-by: Dan Carpenter
    Link: https://lore.kernel.org/r/20200610085852.GB5439@mwanda
    Signed-off-by: Michael S. Tsirkin

    Dan Carpenter
     

14 Jun, 2020

2 commits

  • Pull more Kbuild updates from Masahiro Yamada:

    - fix build rules in binderfs sample

    - fix build errors when Kbuild recurses to the top Makefile

    - covert '---help---' in Kconfig to 'help'

    * tag 'kbuild-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    treewide: replace '---help---' in Kconfig files with 'help'
    kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables
    samples: binderfs: really compile this sample and fix build issues

    Linus Torvalds
     
  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

12 Jun, 2020

1 commit

  • Merge some more updates from Andrew Morton:

    - various hotfixes and minor things

    - hch's use_mm/unuse_mm clearnups

    Subsystems affected by this patch series: mm/hugetlb, scripts, kcov,
    lib, nilfs, checkpatch, lib, mm/debug, ocfs2, lib, misc.

    * emailed patches from Andrew Morton :
    kernel: set USER_DS in kthread_use_mm
    kernel: better document the use_mm/unuse_mm API contract
    kernel: move use_mm/unuse_mm to kthread.c
    kernel: move use_mm/unuse_mm to kthread.c
    stacktrace: cleanup inconsistent variable type
    lib: test get_count_order/long in test_bitops.c
    mm: add comments on pglist_data zones
    ocfs2: fix spelling mistake and grammar
    mm/debug_vm_pgtable: fix kernel crash by checking for THP support
    lib: fix bitmap_parse() on 64-bit big endian archs
    checkpatch: correct check for kernel parameters doc
    nilfs2: fix null pointer dereference at nilfs_segctor_do_construct()
    lib/lz4/lz4_decompress.c: document deliberate use of `&'
    kcov: check kcov_softirq in kcov_remote_stop()
    scripts/spelling: add a few more typos
    khugepaged: selftests: fix timeout condition in wait_for_scan()

    Linus Torvalds