1. 14 Sep, 2018 1 commit
    • Olaf Hering's avatar
      xen: avoid crash in disable_hotplug_cpu · 3366cdb6
      Olaf Hering authored
      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 <f6> 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's avatarOlaf Hering <olaf@aepfle.de>
      Reviewed-by: Juergen Gross's avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: 's avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      3366cdb6
  2. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: 's avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: 's avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: 's avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  3. 09 Feb, 2017 1 commit
  4. 07 Feb, 2017 1 commit
  5. 23 Oct, 2015 2 commits
  6. 28 Jun, 2013 1 commit
    • Joe Perches's avatar
      xen: Convert printks to pr_<level> · 283c0972
      Joe Perches authored
      Convert printks to pr_<level> (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: 's avatarJoe Perches <joe@perches.com>
      Signed-off-by: 's avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      283c0972
  7. 15 Jan, 2013 1 commit
  8. 03 Feb, 2012 1 commit
    • Konrad Rzeszutek Wilk's avatar
      xen/bootup: During bootup suppress XENBUS: Unable to read cpu state · 5b02aa1e
      Konrad Rzeszutek Wilk authored
      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: 's avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      5b02aa1e
  9. 04 Nov, 2009 2 commits
  10. 08 Apr, 2009 1 commit
    • Ian Campbell's avatar
      xen: honour VCPU availability on boot · d745562c
      Ian Campbell authored
      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: 's avatarIan Campbell <ian.campbell@citrix.com>
      d745562c
  11. 02 Apr, 2009 1 commit
    • Ian Campbell's avatar
      xen: honour VCPU availability on boot · 53152f95
      Ian Campbell authored
      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: 's avatarIan Campbell <ian.campbell@citrix.com>
      53152f95
  12. 13 Mar, 2009 1 commit
  13. 23 Oct, 2008 1 commit
  14. 22 Oct, 2008 1 commit
    • Isaku Yamahata's avatar
      xen: compilation fix fo xen CPU hotplugging · a5af4eb1
      Isaku Yamahata authored
      This patch fixes compilation error on ia64.
      include asm/xen/hypervisor.h instead of asm-x86/xen/hypervisor.h
      use xen_pv_domain() instead of is_running_on_xen()
      
      >   CC      drivers/xen/cpu_hotplug.o
      > In file included from /linux-2.6/drivers/xen/cpu_hotplug.c:5:
      > /linux-2.6/include/asm-x86/xen/hypervisor.h:44:22: error: asm/desc.h: No such file or directory
      > /linux-2.6/include/asm-x86/xen/hypervisor.h:66:1: warning: "MULTI_UVMFLAGS_INDEX" redefined
      > In file included from /linux-2.6/include/asm-x86/xen/hypervisor.h:52,
      >                  from /linux-2.6/drivers/xen/cpu_hotplug.c:5:
      > /linux-2.6/arch/ia64/include/asm/xen/hypercall.h:233:1: warning: this is the location of the previous definition
      > /linux-2.6/drivers/xen/cpu_hotplug.c: In function 'setup_vcpu_hotplug_event':
      > /linux-2.6/drivers/xen/cpu_hotplug.c:81: error: implicit declaration of function 'is_running_on_xen'
      > make[4]: *** [drivers/xen/cpu_hotplug.o] Error 1
      > make[4]: *** Waiting for unfinished jobs....
      Signed-off-by: 's avatarIsaku Yamahata <yamahata@valinux.co.jp>
      Signed-off-by: 's avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Isaku Yamahata <yamahata@valinux.co.jp>
      Signed-off-by: 's avatarIngo Molnar <mingo@elte.hu>
      a5af4eb1
  15. 05 Sep, 2008 1 commit
  16. 25 Aug, 2008 1 commit
    • Alex Nixon's avatar
      xen: implement CPU hotplugging · d68d82af
      Alex Nixon authored
      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: 's avatarAlex Nixon <alex.nixon@citrix.com>
      Acked-by: 's avatarJeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: 's avatarIngo Molnar <mingo@elte.hu>
      d68d82af