29 Dec, 2018

3 commits

  • Pull char/misc driver updates from Greg KH:
    "Here is the big set of char and misc driver patches for 4.21-rc1.

    Lots of different types of driver things in here, as this tree seems
    to be the "collection of various driver subsystems not big enough to
    have their own git tree" lately.

    Anyway, some highlights of the changes in here:

    - binderfs: is it a rule that all driver subsystems will eventually
    grow to have their own filesystem? Binder now has one to handle the
    use of it in containerized systems.

    This was discussed at the Plumbers conference a few months ago and
    knocked into mergable shape very fast by Christian Brauner. Who
    also has signed up to be another binder maintainer, showing a
    distinct lack of good judgement :)

    - binder updates and fixes

    - mei driver updates

    - fpga driver updates and additions

    - thunderbolt driver updates

    - soundwire driver updates

    - extcon driver updates

    - nvmem driver updates

    - hyper-v driver updates

    - coresight driver updates

    - pvpanic driver additions and reworking for more device support

    - lp driver updates. Yes really, it's _finally_ moved to the proper
    parallal port driver model, something I never thought I would see
    happen. Good stuff.

    - other tiny driver updates and fixes.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (116 commits)
    MAINTAINERS: add another Android binder maintainer
    intel_th: msu: Fix an off-by-one in attribute store
    stm class: Add a reference to the SyS-T document
    stm class: Fix a module refcount leak in policy creation error path
    char: lp: use new parport device model
    char: lp: properly count the lp devices
    char: lp: use first unused lp number while registering
    char: lp: detach the device when parallel port is removed
    char: lp: introduce list to save port number
    bus: qcom: remove duplicated include from qcom-ebi2.c
    VMCI: Use memdup_user() rather than duplicating its implementation
    char/rtc: Use of_node_name_eq for node name comparisons
    misc: mic: fix a DMA pool free failure
    ptp: fix an IS_ERR() vs NULL check
    genwqe: Fix size check
    binder: implement binderfs
    binder: fix use-after-free due to ksys_close() during fdget()
    bus: fsl-mc: remove duplicated include files
    bus: fsl-mc: explicitly define the fsl_mc_command endianness
    misc: ti-st: make array read_ver_cmd static, shrinks object size
    ...

    Linus Torvalds
     
  • totalram_pages and totalhigh_pages are made static inline function.

    Main motivation was that managed_page_count_lock handling was complicating
    things. It was discussed in length here,
    https://lore.kernel.org/patchwork/patch/995739/#1181785 So it seemes
    better to remove the lock and convert variables to atomic, with preventing
    poteintial store-to-read tearing as a bonus.

    [akpm@linux-foundation.org: coding style fixes]
    Link: http://lkml.kernel.org/r/1542090790-21750-4-git-send-email-arunks@codeaurora.org
    Signed-off-by: Arun KS
    Suggested-by: Michal Hocko
    Suggested-by: Vlastimil Babka
    Reviewed-by: Konstantin Khlebnikov
    Reviewed-by: Pavel Tatashin
    Acked-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Cc: David Hildenbrand
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun KS
     
  • Patch series "mm: convert totalram_pages, totalhigh_pages and managed
    pages to atomic", v5.

    This series converts totalram_pages, totalhigh_pages and
    zone->managed_pages to atomic variables.

    totalram_pages, zone->managed_pages and totalhigh_pages updates are
    protected by managed_page_count_lock, but readers never care about it.
    Convert these variables to atomic to avoid readers potentially seeing a
    store tear.

    Main motivation was that managed_page_count_lock handling was complicating
    things. It was discussed in length here,
    https://lore.kernel.org/patchwork/patch/995739/#1181785 It seemes better
    to remove the lock and convert variables to atomic. With the change,
    preventing poteintial store-to-read tearing comes as a bonus.

    This patch (of 4):

    This is in preparation to a later patch which converts totalram_pages and
    zone->managed_pages to atomic variables. Please note that re-reading the
    value might lead to a different value and as such it could lead to
    unexpected behavior. There are no known bugs as a result of the current
    code but it is better to prevent from them in principle.

    Link: http://lkml.kernel.org/r/1542090790-21750-2-git-send-email-arunks@codeaurora.org
    Signed-off-by: Arun KS
    Reviewed-by: Konstantin Khlebnikov
    Reviewed-by: David Hildenbrand
    Acked-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Reviewed-by: Pavel Tatashin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun KS
     

27 Dec, 2018

1 commit

  • Pull KVM updates from Paolo Bonzini:
    "ARM:
    - selftests improvements
    - large PUD support for HugeTLB
    - single-stepping fixes
    - improved tracing
    - various timer and vGIC fixes

    x86:
    - Processor Tracing virtualization
    - STIBP support
    - some correctness fixes
    - refactorings and splitting of vmx.c
    - use the Hyper-V range TLB flush hypercall
    - reduce order of vcpu struct
    - WBNOINVD support
    - do not use -ftrace for __noclone functions
    - nested guest support for PAUSE filtering on AMD
    - more Hyper-V enlightenments (direct mode for synthetic timers)

    PPC:
    - nested VFIO

    s390:
    - bugfixes only this time"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (171 commits)
    KVM: x86: Add CPUID support for new instruction WBNOINVD
    kvm: selftests: ucall: fix exit mmio address guessing
    Revert "compiler-gcc: disable -ftracer for __noclone functions"
    KVM: VMX: Move VM-Enter + VM-Exit handling to non-inline sub-routines
    KVM: VMX: Explicitly reference RCX as the vmx_vcpu pointer in asm blobs
    KVM: x86: Use jmp to invoke kvm_spurious_fault() from .fixup
    MAINTAINERS: Add arch/x86/kvm sub-directories to existing KVM/x86 entry
    KVM/x86: Use SVM assembly instruction mnemonics instead of .byte streams
    KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()
    KVM/MMU: Flush tlb directly in kvm_set_pte_rmapp()
    KVM/MMU: Move tlb flush in kvm_set_pte_rmapp() to kvm_mmu_notifier_change_pte()
    KVM: Make kvm_set_spte_hva() return int
    KVM: Replace old tlb flush function with new one to flush a specified range.
    KVM/MMU: Add tlb flush with range helper function
    KVM/VMX: Add hv tlb range flush support
    x86/hyper-v: Add HvFlushGuestAddressList hypercall support
    KVM: Add tlb_remote_flush_with_range callback in kvm_x86_ops
    KVM: x86: Disable Intel PT when VMXON in L1 guest
    KVM: x86: Set intercept for Intel PT MSRs read/write
    KVM: x86: Implement Intel PT MSRs read/write emulation
    ...

    Linus Torvalds
     

15 Dec, 2018

1 commit


14 Dec, 2018

3 commits


10 Dec, 2018

1 commit


03 Dec, 2018

2 commits

  • vmbus_process_offer() mustn't call channel->sc_creation_callback()
    directly for sub-channels, because sc_creation_callback() ->
    vmbus_open() may never get the host's response to the
    OPEN_CHANNEL message (the host may rescind a channel at any time,
    e.g. in the case of hot removing a NIC), and vmbus_onoffer_rescind()
    may not wake up the vmbus_open() as it's blocked due to a non-zero
    vmbus_connection.offer_in_progress, and finally we have a deadlock.

    The above is also true for primary channels, if the related device
    drivers use sync probing mode by default.

    And, usually the handling of primary channels and sub-channels can
    depend on each other, so we should offload them to different
    workqueues to avoid possible deadlock, e.g. in sync-probing mode,
    NIC1's netvsc_subchan_work() can race with NIC2's netvsc_probe() ->
    rtnl_lock(), and causes deadlock: the former gets the rtnl_lock
    and waits for all the sub-channels to appear, but the latter
    can't get the rtnl_lock and this blocks the handling of sub-channels.

    The patch can fix the multiple-NIC deadlock described above for
    v3.x kernels (e.g. RHEL 7.x) which don't support async-probing
    of devices, and v4.4, v4.9, v4.14 and v4.18 which support async-probing
    but don't enable async-probing for Hyper-V drivers (yet).

    The patch can also fix the hang issue in sub-channel's handling described
    above for all versions of kernels, including v4.19 and v4.20-rc4.

    So actually the patch should be applied to all the existing kernels,
    not only the kernels that have 8195b1396ec8.

    Fixes: 8195b1396ec8 ("hv_netvsc: fix deadlock on hotplug")
    Cc: stable@vger.kernel.org
    Cc: Stephen Hemminger
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • We need the fixes in here as well.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

27 Nov, 2018

2 commits

  • This is a longstanding issue: if the vmbus upper-layer drivers try to
    consume too many GPADLs, the host may return with an error
    0xC0000044 (STATUS_QUOTA_EXCEEDED), but currently we forget to check
    the creation_status, and hence we can pass an invalid GPADL handle
    into the OPEN_CHANNEL message, and get an error code 0xc0000225 in
    open_info->response.open_result.status, and finally we hang in
    vmbus_open() -> "goto error_free_info" -> vmbus_teardown_gpadl().

    With this patch, we can exit gracefully on STATUS_QUOTA_EXCEEDED.

    Cc: Stephen Hemminger
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: stable@vger.kernel.org
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • Commit d86adf482b84 ("scsi: storvsc: Enable multi-queue support") removed
    the usage of the API in Jan 2017, and the API is not used since then.

    netvsc and storvsc have their own algorithms to determine the outgoing
    channel, so this API is useless.

    And the API is potentially unsafe, because it reads primary->num_sc without
    any lock held. This can be risky considering the RESCIND-OFFER message.

    Let's remove the API.

    Cc: Long Li
    Cc: Stephen Hemminger
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

26 Nov, 2018

1 commit


12 Nov, 2018

4 commits

  • I didn't find a real issue. Let's just make it consistent with the
    next "case REG_U64:" where %llu is used.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • The correct module name is hv_utils. This patch corrects
    the name in struct hv_driver util_drv.

    Signed-off-by: Haiyang Zhang
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Haiyang Zhang
     
  • Currently we are replicating state in struct hv_context that is unnecessary -
    this state can be retrieved from the hypervisor. Furthermore, this is a per-cpu
    state that is being maintained as a global state in struct hv_context.
    Get rid of this state in struct hv_context.

    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    K. Y. Srinivasan
     
  • In kvp_send_key(), we do need call process_ib_ipinfo() if
    message->kvp_hdr.operation is KVP_OP_GET_IP_INFO, because it turns out
    the userland hv_kvp_daemon needs the info of operation, adapter_id and
    addr_family. With the incorrect fc62c3b1977d, the host can't get the
    VM's IP via KVP.

    And, fc62c3b1977d added a "break;", but actually forgot to initialize
    the key_size/value in the case of KVP_OP_SET, so the default key_size of
    0 is passed to the kvp daemon, and the pool files
    /var/lib/hyperv/.kvp_pool_* can't be updated.

    This patch effectively rolls back the previous fc62c3b1977d, and
    correctly fixes the "this statement may fall through" warnings.

    This patch is tested on WS 2012 R2 and 2016.

    Fixes: fc62c3b1977d ("Drivers: hv: kvp: Fix two "this statement may fall through" warnings")
    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Stephen Hemminger
    Signed-off-by: Haiyang Zhang
    Cc:
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

16 Oct, 2018

1 commit

  • lockdep_assert_held() is better suited to checking locking requirements,
    since it won't get confused when someone else holds the lock. This is
    also a step towards possibly removing spin_is_locked().

    Signed-off-by: Lance Roy
    Cc: "K. Y. Srinivasan"
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Reviewed-by: Vitaly Kuznetsov
    Signed-off-by: Greg Kroah-Hartman

    Lance Roy
     

08 Oct, 2018

1 commit


03 Oct, 2018

4 commits

  • A cpumask structure on the stack can cause a warning with
    CONFIG_NR_CPUS=8192 (e.g. Ubuntu 16.04 and 18.04 use this):

    drivers/hv//channel_mgmt.c: In function ‘init_vp_index’:
    drivers/hv//channel_mgmt.c:702:1: warning: the frame size of 1032 bytes
    is larger than 1024 bytes [-Wframe-larger-than=]

    Nowadays it looks most distros enable CONFIG_CPUMASK_OFFSTACK=y, and
    hence we can work around the warning by using cpumask_var_t.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc:
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • We don't need to call process_ib_ipinfo() if message->kvp_hdr.operation is
    KVP_OP_GET_IP_INFO in kvp_send_key(), because here we just need to pass on
    the op code from the host to the userspace; when the userspace returns
    the info requested by the host, we pass the info on to the host in
    kvp_respond_to_host() -> process_ob_ipinfo(). BTW, the current buggy code
    actually doesn't cause any harm, because only message->kvp_hdr.operation
    is used by the userspace, in the case of KVP_OP_GET_IP_INFO.

    The patch also adds a missing "break;" in kvp_send_key(). BTW, the current
    buggy code actually doesn't cause any harm, because in the case of
    KVP_OP_SET, the unexpected fall-through corrupts
    message->body.kvp_set.data.key_size, but that is not really used: see
    the definition of struct hv_kvp_exchg_msg_value.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc:
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • No functional change.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • No functional change.

    Added descriptions for some parameters.
    Fixed some typos.
    Removed some out-of-date comments.

    Signed-off-by: Dexuan Cui
    Cc: Jonathan Corbet
    Cc: linux-doc@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

30 Sep, 2018

1 commit

  • With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
    BUG: using smp_processor_id() in preemptible [00000000]

    Fix the false warning by using get/put_cpu().

    Here vmbus_connect() sends a message to the host and waits for the
    host's response. The host will deliver the response message and an
    interrupt on CPU msg->target_vcpu, and later the interrupt handler
    will wake up vmbus_connect(). vmbus_connect() doesn't really have
    to run on the same cpu as CPU msg->target_vcpu, so it's safe to
    call put_cpu() just here.

    Signed-off-by: Dexuan Cui
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

26 Sep, 2018

3 commits


17 Sep, 2018

1 commit


12 Sep, 2018

3 commits

  • If hv_synic_alloc() errors out, the state of the per-cpu context
    for some CPUs is unknown since the zero'ing is done as each
    CPU is iterated over. In such case, hv_synic_cleanup() may try to
    free memory based on uninitialized values. Fix this by zero'ing
    the per-cpu context for all CPUs before doing any memory
    allocations that might fail.

    Signed-off-by: Michael Kelley
    Reported-by: Dan Carpenter
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     
  • Add support for overriding the default driver for a VMBus device
    in the same way that it can be done for PCI devices. This patch
    adds the /sys/bus/vmbus/devices/.../driver_override file
    and the logic for matching.

    This is used by driverctl tool to do driver override.
    https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fdriverctl%2Fdriverctl&data=02%7C01%7Ckys%40microsoft.com%7C42e803feb2c544ef6ea908d5fd538878%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636693457619960040&sdata=kEyYHRIjNZCk%2B37moCSqbrZL426YccNQrsWpENcrZdw%3D&reserved=0

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • For unsupported device types, the vmbus channel ringbuffer is never
    initialized, and therefore reading the sysfs files will return garbage
    or cause a kernel OOPS.

    Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Cc: # 4.15
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     

02 Aug, 2018

3 commits

  • clk_evt memory is not being freed when the synic is shutdown
    or when there is an allocation error. Add the appropriate
    kfree() call, along with a comment to clarify how the memory
    gets freed after an allocation error. Make the free path
    consistent by removing checks for NULL since kfree() and
    free_page() already do the check.

    Signed-off-by: Michael Kelley
    Reported-by: Dan Carpenter
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     
  • slow_virt_to_phys() is only implemented for arch/x86.
    Remove its use in arch independent Hyper-V drivers, and
    replace with test for vmalloc() address followed by
    appropriate v-to-p function. This follows the typical
    pattern of other drivers and avoids the need to implement
    slow_virt_to_phys() for Hyper-V on ARM64.

    Signed-off-by: Michael Kelley
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     
  • Before setting channel->rescind in vmbus_rescind_cleanup(), we should make
    sure the channel callback won't run any more, otherwise a high-level
    driver like pci_hyperv, which may be infinitely waiting for the host VSP's
    response and notices the channel has been rescinded, can't safely give
    up: e.g., in hv_pci_protocol_negotiation() -> wait_for_response(), it's
    unsafe to exit from wait_for_response() and proceed with the on-stack
    variable "comp_pkt" popped. The issue was originally spotted by
    Michael Kelley .

    In vmbus_close_internal(), the patch also minimizes the range protected by
    disabling/enabling channel->callback_event: we don't really need that for
    the whole function.

    Signed-off-by: Dexuan Cui
    Reviewed-by: Michael Kelley
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Stephen Hemminger
    Cc: Michael Kelley
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

29 Jul, 2018

4 commits


08 Jul, 2018

1 commit

  • In the VM mode on Hyper-V, currently, when the kernel panics, an error
    code and few register values are populated in an MSR and the Hypervisor
    notified. This information is collected on the host. The amount of
    information currently collected is found to be limited and not very
    actionable. To gather more actionable data, such as stack trace, the
    proposal is to write one page worth of kmsg data on an allocated page
    and the Hypervisor notified of the page address through the MSR.

    - Sysctl option to control the behavior, with ON by default.

    Cc: K. Y. Srinivasan
    Cc: Stephen Hemminger
    Signed-off-by: Sunil Muthuswamy
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Sunil Muthuswamy