22 May, 2020

1 commit

  • Commit a926f81d2f6c ("xen/cpuhotplug: Replace cpu_up/down() with
    device_online/offline()") replaced cpu_down() with device_offline()
    call which requires that the CPU has been registered before. This
    registration, however, happens later from topology_init() which
    is called as subsys_initcall(). setup_vcpu_hotplug_event(), on the
    other hand, is invoked earlier, during arch_initcall().

    As result, booting a PV(H) guest with vcpus < maxvcpus causes a crash.

    Move setup_vcpu_hotplug_event() (and therefore setup_cpu_watcher()) to
    late_initcall(). In addition, instead of performing all offlining steps
    in setup_cpu_watcher() simply call disable_hotplug_cpu().

    Fixes: a926f81d2f6c (xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()"
    Signed-off-by: Boris Ostrovsky
    Link: https://lore.kernel.org/r/1588976923-3667-1-git-send-email-boris.ostrovsky@oracle.com
    Reviewed-by: Juergen Gross
    Signed-off-by: Boris Ostrovsky

    Boris Ostrovsky
     

25 Mar, 2020

1 commit

  • The core device API performs extra housekeeping bits that are missing
    from directly calling cpu_up/down().

    See commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and
    serialization during LPM") for an example description of what might go
    wrong.

    This also prepares to make cpu_up/down() a private interface of the cpu
    subsystem.

    Signed-off-by: Qais Yousef
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Juergen Gross
    Link: https://lkml.kernel.org/r/20200323135110.30522-14-qais.yousef@arm.com

    Qais Yousef
     

09 Mar, 2019

1 commit

  • The "cpu" variable comes from the sscanf() so Smatch marks it as
    untrusted data. We can't pass a higher value than "nr_cpu_ids" to
    cpu_possible() or it results in an out of bounds access.

    Fixes: d68d82afd4c8 ("xen: implement CPU hotplugging")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Dan Carpenter
     

14 Sep, 2018

1 commit

  • The command 'xl vcpu-set 0 0', issued in dom0, will crash dom0:

    BUG: unable to handle kernel NULL pointer dereference at 00000000000002d8
    PGD 0 P4D 0
    Oops: 0000 [#1] PREEMPT SMP NOPTI
    CPU: 7 PID: 65 Comm: xenwatch Not tainted 4.19.0-rc2-1.ga9462db-default #1 openSUSE Tumbleweed (unreleased)
    Hardware name: Intel Corporation S5520UR/S5520UR, BIOS S5500.86B.01.00.0050.050620101605 05/06/2010
    RIP: e030:device_offline+0x9/0xb0
    Code: 77 24 00 e9 ce fe ff ff 48 8b 13 e9 68 ff ff ff 48 8b 13 e9 29 ff ff ff 48 8b 13 e9 ea fe ff ff 90 66 66 66 66 90 41 54 55 53 87 d8 02 00 00 01 0f 85 88 00 00 00 48 c7 c2 20 09 60 81 31 f6
    RSP: e02b:ffffc90040f27e80 EFLAGS: 00010203
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    RDX: ffff8801f3800000 RSI: ffffc90040f27e70 RDI: 0000000000000000
    RBP: 0000000000000000 R08: ffffffff820e47b3 R09: 0000000000000000
    R10: 0000000000007ff0 R11: 0000000000000000 R12: ffffffff822e6d30
    R13: dead000000000200 R14: dead000000000100 R15: ffffffff8158b4e0
    FS: 00007ffa595158c0(0000) GS:ffff8801f39c0000(0000) knlGS:0000000000000000
    CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000000002d8 CR3: 00000001d9602000 CR4: 0000000000002660
    Call Trace:
    handle_vcpu_hotplug_event+0xb5/0xc0
    xenwatch_thread+0x80/0x140
    ? wait_woken+0x80/0x80
    kthread+0x112/0x130
    ? kthread_create_worker_on_cpu+0x40/0x40
    ret_from_fork+0x3a/0x50

    This happens because handle_vcpu_hotplug_event is called twice. In the
    first iteration cpu_present is still true, in the second iteration
    cpu_present is false which causes get_cpu_device to return NULL.
    In case of cpu#0, cpu_online is apparently always true.

    Fix this crash by checking if the cpu can be hotplugged, which is false
    for a cpu that was just removed.

    Also check if the cpu was actually offlined by device_remove, otherwise
    leave the cpu_present state as it is.

    Rearrange to code to do all work with device_hotplug_lock held.

    Signed-off-by: Olaf Hering
    Reviewed-by: Juergen Gross
    Signed-off-by: Boris Ostrovsky

    Olaf Hering
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

10 Feb, 2017

1 commit

  • Today a Xenstore watch event is delivered via a callback function
    declared as:

    void (*callback)(struct xenbus_watch *,
    const char **vec, unsigned int len);

    As all watch events only ever come with two parameters (path and token)
    changing the prototype to:

    void (*callback)(struct xenbus_watch *,
    const char *path, const char *token);

    is the natural thing to do.

    Apply this change and adapt all users.

    Cc: konrad.wilk@oracle.com
    Cc: roger.pau@citrix.com
    Cc: wei.liu2@citrix.com
    Cc: paul.durrant@citrix.com
    Cc: netdev@vger.kernel.org

    Signed-off-by: Juergen Gross
    Reviewed-by: Paul Durrant
    Reviewed-by: Wei Liu
    Reviewed-by: Roger Pau Monné
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     

07 Feb, 2017

1 commit


23 Oct, 2015

2 commits

  • When offlining a cpu, instead of cpu_down, call device_offline, which
    also takes care of updating the cpu.dev.offline field. This keeps the
    sysfs file /sys/devices/system/cpu/cpuN/online, up to date. Also move
    the call to disable_hotplug_cpu, because it makes more sense to have it
    there.

    We don't call device_online at cpu-hotplug time, because that would
    immediately take the cpu online, while we want to retain the current
    behaviour: the user needs to explicitly enable the cpu after it has
    been hotplugged.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Boris Ostrovsky
    CC: konrad.wilk@oracle.com
    CC: boris.ostrovsky@oracle.com
    CC: david.vrabel@citrix.com

    Stefano Stabellini
     
  • Build cpu_hotplug for ARM and ARM64 guests.

    Rename arch_(un)register_cpu to xen_(un)register_cpu and provide an
    empty implementation on ARM and ARM64. On x86 just call
    arch_(un)register_cpu as we are already doing.

    Initialize cpu_hotplug on ARM.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Julien Grall
    Reviewed-by: Boris Ostrovsky

    Stefano Stabellini
     

28 Jun, 2013

1 commit

  • Convert printks to pr_ (excludes printk(KERN_DEBUG...)
    to be more consistent throughout the xen subsystem.

    Add pr_fmt with KBUILD_MODNAME or "xen:" KBUILD_MODNAME
    Coalesce formats and add missing word spaces
    Add missing newlines
    Align arguments and reflow to 80 columns
    Remove DRV_NAME from formats as pr_fmt adds the same content

    This does change some of the prefixes of these messages
    but it also does make them more consistent.

    Signed-off-by: Joe Perches
    Signed-off-by: Konrad Rzeszutek Wilk

    Joe Perches
     

16 Jan, 2013

1 commit


04 Feb, 2012

1 commit

  • When the initial domain starts, it prints (depending on the
    amount of CPUs) a slew of
    XENBUS: Unable to read cpu state
    XENBUS: Unable to read cpu state
    XENBUS: Unable to read cpu state
    XENBUS: Unable to read cpu state

    which provide no useful information - as the error is a valid
    issue - but not on the initial domain. The reason is that the
    XenStore is not accessible at that time (it is after all the
    first guest) so the CPU hotplug watch cannot parse "availability/cpu"
    attribute.

    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     

12 Dec, 2009

1 commit

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (109 commits)
    PCI: fix coding style issue in pci_save_state()
    PCI: add pci_request_acs
    PCI: fix BUG_ON triggered by logical PCIe root port removal
    PCI: remove ifdefed pci_cleanup_aer_correct_error_status
    PCI: unconditionally clear AER uncorr status register during cleanup
    x86/PCI: claim SR-IOV BARs in pcibios_allocate_resource
    PCI: portdrv: remove redundant definitions
    PCI: portdrv: remove unnecessary struct pcie_port_data
    PCI: portdrv: minor cleanup for pcie_port_device_register
    PCI: portdrv: add missing irq cleanup
    PCI: portdrv: enable device before irq initialization
    PCI: portdrv: cleanup service irqs initialization
    PCI: portdrv: check capabilities first
    PCI: portdrv: move PME capability check
    PCI: portdrv: remove redundant pcie type calculation
    PCI: portdrv: cleanup pcie_device registration
    PCI: portdrv: remove redundant pcie_port_device_probe
    PCI: Always set prefetchable base/limit upper32 registers
    PCI: read-modify-write the pcie device control register when initiating pcie flr
    PCI: show dma_mask bits in /sys
    ...

    Fixed up conflicts in:
    arch/x86/kernel/amd_iommu_init.c
    drivers/pci/dmar.c
    drivers/pci/hotplug/acpiphp_glue.c

    Linus Torvalds
     

05 Nov, 2009

1 commit


04 Nov, 2009

1 commit


09 Apr, 2009

1 commit

  • If a VM is booted with offline VCPUs then unplug them during boot. Determining
    the availability of a VCPU requires access to XenStore which is not available
    at the point smp_prepare_cpus() is called, therefore we bring up all VCPUS
    initially and unplug the offline ones as soon as XenStore becomes available.

    Signed-off-by: Ian Campbell

    Ian Campbell
     

13 Mar, 2009

1 commit


23 Oct, 2008

1 commit


05 Sep, 2008

1 commit


25 Aug, 2008

1 commit

  • Note the changes from 2.6.18-xen CPU hotplugging:

    A vcpu_down request from the remote admin via Xenbus both hotunplugs the
    CPU, and disables it by removing it from the cpu_present map, and removing
    its entry in /sys.

    A vcpu_up request from the remote admin only re-enables the CPU, and does
    not immediately bring the CPU up. A udev event is emitted, which can be
    caught by the user if he wishes to automatically re-up CPUs when available,
    or implement a more complex policy.

    Signed-off-by: Alex Nixon
    Acked-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar

    Alex Nixon