01 Aug, 2013

1 commit

  • Pull Xen fixes from Konrad Rzeszutek Wilk:
    - Three fixes for ARM/ARM64 to either compile or not certain generic
    drivers
    - Fix for avoiding a potential deadlock when an user space event
    channel is destroyed.
    - Fix a workqueue resuming multiple times.

    * tag 'stable/for-linus-3.11-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen/tmem: do not allow XEN_TMEM on ARM64
    xen/evtchn: avoid a deadlock when unbinding an event channel
    xen/arm: enable PV control for ARM
    xen/arm64: Don't compile cpu hotplug
    xenbus: frontend resume cleanup

    Linus Torvalds
     

31 Jul, 2013

1 commit


30 Jul, 2013

1 commit

  • Unbinding an event channel (either with the ioctl or when the evtchn
    device is closed) may deadlock because disable_irq() is called with
    port_user_lock held which is also locked by the interrupt handler.

    Think of the IOCTL_EVTCHN_UNBIND is being serviced, the routine has
    just taken the lock, and an interrupt happens. The evtchn_interrupt
    is invoked, tries to take the lock and spins forever.

    A quick glance at the code shows that the spinlock is a local IRQ
    variant. Unfortunately that does not help as "disable_irq() waits for
    the interrupt handler on all CPUs to stop running. If the irq occurs
    on another VCPU, it tries to take port_user_lock and can't because
    the unbind ioctl is holding it." (from David). Hence we cannot
    depend on the said spinlock to protect us. We could make it a system
    wide IRQ disable spinlock but there is a better way.

    We can piggyback on the fact that the existence of the spinlock is
    to make get_port_user() checks be up-to-date. And we can alter those
    checks to not depend on the spin lock (as it's protected by u->bind_mutex
    in the ioctl) and can remove the unnecessary locking (this is
    IOCTL_EVTCHN_UNBIND) path.

    In the interrupt handler we cannot use the mutex, but we do not
    need it.

    "The unbind disables the irq before making the port user stale, so when
    you clear it you are guaranteed that the interrupt handler that might
    use that port cannot be running." (from David).

    Hence this patch removes the spinlock usage on the teardown path
    and piggybacks on disable_irq happening before we muck with the
    get_port_user() data. This ensures that the interrupt handler will
    never run on stale data.

    Signed-off-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk
    [v1: Expanded the commit description a bit]

    David Vrabel
     

29 Jul, 2013

3 commits

  • Enable lifecyle management (reboot, shutdown...) from the toolstack
    for ARM guests.

    Signed-off-by: Julien Grall
    Signed-off-by: Konrad Rzeszutek Wilk
    Acked-by: Stefano Stabellini

    Julien Grall
     
  • On ARM64, when CONFIG_XEN=y, the compilation will fail because CPU hotplug is
    not yet supported with XEN. For now, disable it.

    Signed-off-by: Julien Grall
    Signed-off-by: Konrad Rzeszutek Wilk
    Acked-by: Mark Rutland

    Julien Grall
     
  • Only create the delayed resume workqueue if we are running in the same domain
    as xenstored and issue a warning if the workqueue creation fails.

    Move the work initialization to the device probe so it is done only once.

    Signed-off-by: Aurelien Chartier
    Signed-off-by: Konrad Rzeszutek Wilk
    Reviewed-by: David Vrabel

    Aurelien Chartier
     

15 Jul, 2013

1 commit

  • The __cpuinit type of throwaway sections might have made sense
    some time ago when RAM was more constrained, but now the savings
    do not offset the cost and complications. For example, the fix in
    commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
    is a good example of the nasty type of bugs that can be created
    with improper use of the various __init prefixes.

    After a discussion on LKML[1] it was decided that cpuinit should go
    the way of devinit and be phased out. Once all the users are gone,
    we can then finally remove the macros themselves from linux/init.h.

    This removes all the remaining one-off uses of the __cpuinit macros
    from all C files in the drivers/* directory.

    [1] https://lkml.org/lkml/2013/5/20/589

    Cc: Greg Kroah-Hartman
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

07 Jul, 2013

1 commit

  • Pull timer core updates from Thomas Gleixner:
    "The timer changes contain:

    - posix timer code consolidation and fixes for odd corner cases

    - sched_clock implementation moved from ARM to core code to avoid
    duplication by other architectures

    - alarm timer updates

    - clocksource and clockevents unregistration facilities

    - clocksource/events support for new hardware

    - precise nanoseconds RTC readout (Xen feature)

    - generic support for Xen suspend/resume oddities

    - the usual lot of fixes and cleanups all over the place

    The parts which touch other areas (ARM/XEN) have been coordinated with
    the relevant maintainers. Though this results in an handful of
    trivial to solve merge conflicts, which we preferred over nasty cross
    tree merge dependencies.

    The patches which have been committed in the last few days are bug
    fixes plus the posix timer lot. The latter was in akpms queue and
    next for quite some time; they just got forgotten and Frederic
    collected them last minute."

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (59 commits)
    hrtimer: Remove unused variable
    hrtimers: Move SMP function call to thread context
    clocksource: Reselect clocksource when watchdog validated high-res capability
    posix-cpu-timers: don't account cpu timer after stopped thread runtime accounting
    posix_timers: fix racy timer delta caching on task exit
    posix-timers: correctly get dying task time sample in posix_cpu_timer_schedule()
    selftests: add basic posix timers selftests
    posix_cpu_timers: consolidate expired timers check
    posix_cpu_timers: consolidate timer list cleanups
    posix_cpu_timer: consolidate expiry time type
    tick: Sanitize broadcast control logic
    tick: Prevent uncontrolled switch to oneshot mode
    tick: Make oneshot broadcast robust vs. CPU offlining
    x86: xen: Sync the CMOS RTC as well as the Xen wallclock
    x86: xen: Sync the wallclock when the system time is set
    timekeeping: Indicate that clock was set in the pvclock gtod notifier
    timekeeping: Pass flags instead of multiple bools to timekeeping_update()
    xen: Remove clock_was_set() call in the resume path
    hrtimers: Support resuming with two or more CPUs online (but stopped)
    timer: Fix jiffies wrap behavior of round_jiffies_common()
    ...

    Linus Torvalds
     

05 Jul, 2013

1 commit


04 Jul, 2013

4 commits

  • Merge first patch-bomb from Andrew Morton:
    - various misc bits
    - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
    distracted. There has been quite a bit of activity.
    - About half the MM queue
    - Some backlight bits
    - Various lib/ updates
    - checkpatch updates
    - zillions more little rtc patches
    - ptrace
    - signals
    - exec
    - procfs
    - rapidio
    - nbd
    - aoe
    - pps
    - memstick
    - tools/testing/selftests updates

    * emailed patches from Andrew Morton : (445 commits)
    tools/testing/selftests: don't assume the x bit is set on scripts
    selftests: add .gitignore for kcmp
    selftests: fix clean target in kcmp Makefile
    selftests: add .gitignore for vm
    selftests: add hugetlbfstest
    self-test: fix make clean
    selftests: exit 1 on failure
    kernel/resource.c: remove the unneeded assignment in function __find_resource
    aio: fix wrong comment in aio_complete()
    drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
    drivers/memstick/host/r592.c: convert to module_pci_driver
    drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
    pps-gpio: add device-tree binding and support
    drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
    drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
    drivers/parport/share.c: use kzalloc
    Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
    aoe: update internal version number to v83
    aoe: update copyright date
    aoe: perform I/O completions in parallel
    ...

    Linus Torvalds
     
  • Calling dev_set_name with a single paramter causes it to be handled as a
    format string. Many callers are passing potentially dynamic string
    content, so use "%s" in those cases to avoid any potential accidents,
    including wrappers like device_create*() and bdi_register().

    Signed-off-by: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • Enhance adjust_managed_page_count() to adjust totalhigh_pages for
    highmem pages. And change code which directly adjusts totalram_pages to
    use adjust_managed_page_count() because it adjusts totalram_pages,
    totalhigh_pages and zone->managed_pages altogether in a safe way.

    Remove inc_totalhigh_pages() and dec_totalhigh_pages() from xen/balloon
    driver bacause adjust_managed_page_count() has already adjusted
    totalhigh_pages.

    This patch also fixes two bugs:

    1) enhances virtio_balloon driver to adjust totalhigh_pages when
    reserve/unreserve pages.
    2) enhance memory_hotplug.c to adjust totalhigh_pages when hot-removing
    memory.

    We still need to deal with modifications of totalram_pages in file
    arch/powerpc/platforms/pseries/cmm.c, but need help from PPC experts.

    [akpm@linux-foundation.org: remove ifdef, per Wanpeng Li, virtio_balloon.c cleanup, per Sergei]
    [akpm@linux-foundation.org: export adjust_managed_page_count() to modules, for drivers/virtio/virtio_balloon.c]
    Signed-off-by: Jiang Liu
    Cc: Chris Metcalf
    Cc: Rusty Russell
    Cc: "Michael S. Tsirkin"
    Cc: Konrad Rzeszutek Wilk
    Cc: Jeremy Fitzhardinge
    Cc: Wen Congyang
    Cc: Tang Chen
    Cc: Yasuaki Ishimatsu
    Cc: Mel Gorman
    Cc: Minchan Kim
    Cc: "H. Peter Anvin"
    Cc:
    Cc: Arnd Bergmann
    Cc: Catalin Marinas
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Jianguo Wu
    Cc: Joonsoo Kim
    Cc: Kamezawa Hiroyuki
    Cc: Marek Szyprowski
    Cc: Michel Lespinasse
    Cc: Rik van Riel
    Cc: Tejun Heo
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: Yinghai Lu
    Cc: Russell King
    Cc: Sergei Shtylyov
    Cc: Wu Fengguang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • …nux/kernel/git/konrad/xen

    Pull Xen bugfixes from Konrad Rzeszutek Wilk:
    - Fix memory leak when CPU hotplugging.
    - Compile bugs with various #ifdefs
    - Fix state changes in Xen PCI front not dealing well with new
    toolstack.
    - Cleanups in code (use pr_*, fix 80 characters splits, etc)
    - Long standing bug in double-reporting the steal time

    * tag 'stable/for-linus-3.11-rc0-tag-two' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/time: remove blocked time accounting from xen "clockchip"
    xen: Convert printks to pr_<level>
    xen: ifdef CONFIG_HIBERNATE_CALLBACKS xen_*_suspend
    xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state.
    xen/time: Free onlined per-cpu data structure if we want to online it again.
    xen/time: Check that the per_cpu data structure has data before freeing.
    xen/time: Don't leak interrupt name when offlining.
    xen/time: Encapsulate the struct clock_event_device in another structure.
    xen/spinlock: Don't leak interrupt name when offlining.
    xen/smp: Don't leak interrupt name when offlining.
    xen/smp: Set the per-cpu IRQ number to a valid default.
    xen/smp: Introduce a common structure to contain the IRQ name and interrupt line.
    xen/smp: Coalesce the free_irq calls in one function.
    xen-pciback: fix error return code in pcistub_irq_handler_switch()

    Linus Torvalds
     

29 Jun, 2013

1 commit

  • commit 359cdd3f866(xen: maintain clock offset over save/restore) added
    a clock_was_set() call into the xen resume code to propagate the
    system time changes. With the modified hrtimer resume code, which
    makes sure that all cpus are notified this call is not longer necessary.

    [ tglx: Separated it from the hrtimer change ]

    Signed-off-by: David Vrabel
    Cc: Konrad Rzeszutek Wilk
    Cc: John Stultz
    Cc:
    Link: http://lkml.kernel.org/r/1372329348-20841-2-git-send-email-david.vrabel@citrix.com
    Signed-off-by: Thomas Gleixner

    David Vrabel
     

28 Jun, 2013

2 commits

  • 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
     
  • xen_hvm_post_suspend, xen_pre_suspend, xen_post_suspend are only used if
    CONFIG_HIBERNATE_CALLBACKS is defined, resulting in:

    drivers/xen/manage.c:46:13: warning: ‘xen_hvm_post_suspend’ defined but not used [-Wunused-function]
    drivers/xen/manage.c:52:13: warning: ‘xen_pre_suspend’ defined but not used [-Wunused-function]
    drivers/xen/manage.c:59:13: warning: ‘xen_post_suspend’ defined but not used [-Wunused-function]

    If the kernel config is missing CONFIG_HIBERNATE_CALLBACKS.

    Simply ifdef CONFIG_HIBERNATE_CALLBACKS the three functions.

    Signed-off-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

10 Jun, 2013

2 commits

  • Commit 10a7a0771399a57a297fca9615450dbb3f88081a ("xen: tmem: enable Xen
    tmem shim to be built/loaded as a module") allows the tmem module
    to be loaded any time. For this work the frontswap API had to
    be able to asynchronously to call tmem_frontswap_init before
    or after the swap image had been set. That was added in git
    commit 905cd0e1bf9ffe82d6906a01fd974ea0f70be97a
    ("mm: frontswap: lazy initialization to allow tmem backends to build/run as modules").

    Which means we could do this (The common case):

    modprobe tmem [so calls frontswap_register_ops, no ->init]
    modifies tmem_frontswap_poolid = -1
    swapon /dev/xvda1 [__frontswap_init, calls -> init, tmem_frontswap_poolid is
    < 0 so tmem hypercall done]

    Or the failing one:

    swapon /dev/xvda1 [calls __frontswap_init, sets the need_init bitmap]
    modprobe tmem [calls frontswap_register_ops, -->init calls, finds out
    tmem_frontswap_poolid is 0, does not make a hypercall.
    Later in the module_init, sets tmem_frontswap_poolid=-1]

    Which meant that in the failing case we would not call the hypercall
    to initialize the pool and never be able to make any frontswap
    backend calls.

    Moving the frontswap_register_ops after setting the tmem_frontswap_poolid
    fixes it.

    Signed-off-by: Konrad Rzeszutek Wilk
    Reviewed-by: Bob Liu

    Konrad Rzeszutek Wilk
     
  • Fix to return -ENOENT in the pcistub_device_find() and pci_get_drvdata()
    error handling case instead of 0(overwrite to 0 by str_to_slot()), as done
    elsewhere in this function.

    Acked-by: Jan Beulich
    Signed-off-by: Wei Yongjun
    Signed-off-by: Konrad Rzeszutek Wilk

    Wei Yongjun
     

30 May, 2013

1 commit


29 May, 2013

3 commits

  • Signed-off-by: Jan Beulich
    Signed-off-by: Konrad Rzeszutek Wilk

    Jan Beulich
     
  • Save the xenstore local status computed in xenbus_init. It can then be used
    later to check if xenstored is running in this domain.

    Signed-off-by: Aurelien Chartier
    [Changes in v4:
    - Change variable name to xen_store_domain_type]
    Reviewed-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk

    Aurelien Chartier
     
  • If the xenbus frontend is located in a domain running xenstored, the device
    resume is hanging because it is happening before the process resume. This
    patch adds extra logic to the resume code to check if we are the domain
    running xenstored and delay the resume if needed.

    Signed-off-by: Aurelien Chartier
    [Changes in v2:
    - Instead of bypassing the resume, process it in a workqueue]
    [Changes in v3:
    - Add a struct work in xenbus_device to avoid dynamic allocation
    - Several small code fixes]
    [Changes in v4:
    - Use a dedicated workqueue]
    [Changes in v5:
    - Move create_workqueue error handling to xenbus_frontend_dev_resume]
    Acked-by: Jan Beulich
    Signed-off-by: Konrad Rzeszutek Wilk

    Aurelien Chartier
     

28 May, 2013

1 commit

  • In the (not so useful) kernel configuration where CONFIG_SWAP
    is undefined and CONFIG_XEN_SELFBALLOONING is defined,
    xen_tmem_init would use undefined variable 'static bool frontswap'.

    Added #else to have #define frontswap (0) in the case where
    CONFIG_FRONTSWAP is not defined.

    Signed-off-by: Frederico Cadete
    Signed-off-by: Konrad Rzeszutek Wilk

    Frederico Cadete
     

21 May, 2013

3 commits


15 May, 2013

11 commits


12 May, 2013

1 commit

  • …nux/kernel/git/konrad/xen

    Pull Xen bug-fixes from Konrad Rzeszutek Wilk:
    - More fixes in the vCPU PVHVM hotplug path.
    - Add more documentation.
    - Fix various ARM related issues in the Xen generic drivers.
    - Updates in the xen-pciback driver per Bjorn's updates.
    - Mask the x2APIC feature for PV guests.

    * tag 'stable/for-linus-3.10-rc0-tag-two' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pci: Used cached MSI-X capability offset
    xen/pci: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK
    xen: clear IRQ_NOAUTOEN and IRQ_NOREQUEST
    xen: mask x2APIC feature in PV
    xen: SWIOTLB is only used on x86
    xen/spinlock: Fix check from greater than to be also be greater or equal to.
    xen/smp/pvhvm: Don't point per_cpu(xen_vpcu, 33 and larger) to shared_info
    xen/vcpu: Document the xen_vcpu_info and xen_vcpu
    xen/vcpu/pvhvm: Fix vcpu hotplugging hanging.

    Linus Torvalds
     

08 May, 2013

2 commits

  • Reset the IRQ_NOAUTOEN and IRQ_NOREQUEST flags that are enabled by
    default on ARM. If IRQ_NOAUTOEN is set, __setup_irq doesn't call
    irq_startup, that is responsible for calling irq_unmask at startup time.
    As a result event channels remain masked.

    The clear is already made in bind_evtchn_to_irq with commit a8636c0 but was
    missing on all others bind_*_to_irq. Move the clear in xen_irq_info_common_init.

    On x86, IRQ_NOAUTOEN and IRQ_NOREQUEST are cleared by default, so this commit
    doesn't impact this architecture.

    Acked-by: Stefano Stabellini
    Signed-off-by: Julien Grall
    Signed-off-by: Konrad Rzeszutek Wilk

    Julien Grall
     
  • Enabling SWIOTLB_XEN on ARM results in build errors because the
    underlying SWIOTLB is only available on X86:

    drivers/xen/swiotlb-xen.c: In function 'is_xen_swiotlb_buffer':
    drivers/xen/swiotlb-xen.c:105:2: error: implicit declaration of function 'mfn_to_local_pfn

    Cc: Konrad Rzeszutek Wilk
    Acked-by: Stefano Stabellini
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Konrad Rzeszutek Wilk

    Arnd Bergmann