07 Nov, 2012

1 commit

  • exit_idle() should be called after irq_enter(), otherwise it throws:

    [ INFO: suspicious RCU usage. ]
    3.6.5 #1 Not tainted
    -------------------------------
    include/linux/rcupdate.h:725 rcu_read_lock() used illegally while idle!

    other info that might help us debug this:

    RCU used illegally from idle CPU!
    rcu_scheduler_active = 1, debug_locks = 1
    RCU used illegally from extended quiescent state!
    1 lock held by swapper/0/0:
    #0: (rcu_read_lock){......}, at: [] __atomic_notifier_call_chain+0x0/0x140

    stack backtrace:
    Pid: 0, comm: swapper/0 Not tainted 3.6.5 #1
    Call Trace:
    [] lockdep_rcu_suspicious+0xe2/0x130
    [] __atomic_notifier_call_chain+0x12c/0x140
    [] ? atomic_notifier_chain_unregister+0x90/0x90
    [] ? trace_hardirqs_off+0xd/0x10
    [] atomic_notifier_call_chain+0x16/0x20
    [] exit_idle+0x43/0x50
    [] xen_evtchn_do_upcall+0x25/0x50
    [] xen_do_hypervisor_callback+0x1e/0x30
    [] ? hypercall_page+0x3aa/0x1000
    [] ? hypercall_page+0x3aa/0x1000
    [] ? xen_safe_halt+0x10/0x20
    [] ? default_idle+0xba/0x570
    [] ? cpu_idle+0xdf/0x140
    [] ? rest_init+0x135/0x144
    [] ? csum_partial_copy_generic+0x16c/0x16c
    [] ? start_kernel+0x3db/0x3e8
    [] ? repair_env_string+0x5a/0x5a
    [] ? x86_64_start_reservations+0x131/0x135
    [] ? xen_start_kernel+0x465/0x46

    Git commit 98ad1cc14a5c4fd658f9d72c6ba5c86dfd3ce0d5
    Author: Frederic Weisbecker
    Date: Fri Oct 7 18:22:09 2011 +0200

    x86: Call idle notifier after irq_enter()

    did this, but it missed the Xen code.

    Signed-off-by: Mojiong Qiu
    Cc: stable@vger.kernel.org # from 3.3 and newer.
    Signed-off-by: Konrad Rzeszutek Wilk

    Mojiong Qiu
     

20 Oct, 2012

1 commit


03 Oct, 2012

1 commit

  • xen_init_IRQ should be marked __init because it calls other functions
    marked __init and is always called by functions marked __init (on both
    x86 and arm).

    Also remove the unused EXPORT_SYMBOL_GPL(xen_init_IRQ).

    Both changes were introduced by "xen/arm: receive Xen events on ARM".

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

    Stefano Stabellini
     

14 Sep, 2012

1 commit


23 Aug, 2012

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.

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

    Stefano Stabellini
     
  • When unmask_evtchn is called, if we already have an event pending, we
    just set evtchn_pending_sel waiting for local_irq_enable to be called.
    That is because PV guests set the irq_enable pvops to
    xen_irq_enable_direct in xen_setup_vcpu_info_placement:
    xen_irq_enable_direct is implemented in assembly in
    arch/x86/xen/xen-asm.S and call xen_force_evtchn_callback if
    XEN_vcpu_info_pending is set.

    However HVM guests (and ARM guests) do not change or do not have the
    irq_enable pvop, so evtchn_unmask cannot work properly for them.

    Considering that having the pending_irq bit set when unmask_evtchn is
    called is not very common, and it is simpler to keep the
    native_irq_enable implementation for HVM guests (and ARM guests), the
    best thing to do is just use the EVTCHNOP_unmask hypercall (Xen
    re-injects pending events in response).

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

    Stefano Stabellini
     

16 Jun, 2012

1 commit

  • Pull five Xen bug-fixes from Konrad Rzeszutek Wilk:

    - When booting as PVHVM we would try to use PV console - but would not validate
    the parameters causing us to crash during restore b/c we re-use the wrong event
    channel.
    - When booting on machines with SR-IOV PCI bridge we didn't check for the bridge
    and tried to use it.
    - Under AMD machines would advertise the APERFMPERF resulting in needless amount
    of MSRs from the guest.
    - A global value (xen_released_pages) was not subtracted at bootup when pages
    were added back in. This resulted in the balloon worker having the wrong
    account of how many pages were truly released.
    - Fix dead-lock when xen-blkfront is run in the same domain as xen-blkback.

    * tag 'stable/for-linus-3.5-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: mark local pages as FOREIGN in the m2p_override
    xen/setup: filter APERFMPERF cpuid feature out
    xen/balloon: Subtract from xen_released_pages the count that is populated.
    xen/pci: Check for PCI bridge before using it.
    xen/events: Add WARN_ON when quick lookup found invalid type.
    xen/hvc: Check HVM_PARAM_CONSOLE_[EVTCHN|PFN] for correctness.
    xen/hvc: Fix error cases around HVM_PARAM_CONSOLE_PFN
    xen/hvc: Collapse error logic.

    Linus Torvalds
     

30 May, 2012

1 commit

  • All of the bind_XYZ_to_irq do a quick lookup to see if the
    event exists. And if it does, then the initialized IRQ number
    is returned instead of initializing a new IRQ number.

    This patch adds an extra logic to check that the type returned
    is proper one and that there is an IRQ handler setup for it.

    This patch has the benefit of being able to find drivers that
    are doing something naught.

    [v1: Enhanced based on Stefano's review]
    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     

25 May, 2012

1 commit

  • Pull Xen updates from Konrad Rzeszutek Wilk:
    "Features:
    * Extend the APIC ops implementation and add IRQ_WORKER vector
    support so that 'perf' can work properly.
    * Fix self-ballooning code, and balloon logic when booting as initial
    domain.
    * Move array printing code to generic debugfs
    * Support XenBus domains.
    * Lazily free grants when a domain is dead/non-existent.
    * In M2P code use batching calls
    Bug-fixes:
    * Fix NULL dereference in allocation failure path (hvc_xen)
    * Fix unbinding of IRQ_WORKER vector during vCPU hot-unplug
    * Fix HVM guest resume - we would leak an PIRQ value instead of
    reusing the existing one."

    Fix up add-add onflicts in arch/x86/xen/enlighten.c due to addition of
    apic ipi interface next to the new apic_id functions.

    * tag 'stable/for-linus-3.5-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: do not map the same GSI twice in PVHVM guests.
    hvc_xen: NULL dereference on allocation failure
    xen: Add selfballoning memory reservation tunable.
    xenbus: Add support for xenbus backend in stub domain
    xen/smp: unbind irqworkX when unplugging vCPUs.
    xen: enter/exit lazy_mmu_mode around m2p_override calls
    xen/acpi/sleep: Enable ACPI sleep via the __acpi_os_prepare_sleep
    xen: implement IRQ_WORK_VECTOR handler
    xen: implement apic ipi interface
    xen/setup: update VA mapping when releasing memory during setup
    xen/setup: Combine the two hypercall functions - since they are quite similar.
    xen/setup: Populate freed MFNs from non-RAM E820 entries and gaps to E820 RAM
    xen/setup: Only print "Freeing XXX-YYY pfn range: Z pages freed" if Z > 0
    xen/gnttab: add deferred freeing logic
    debugfs: Add support to print u32 array in debugfs
    xen/p2m: An early bootup variant of set_phys_to_machine
    xen/p2m: Collapse early_alloc_p2m_middle redundant checks.
    xen/p2m: Allow alloc_p2m_middle to call reserve_brk depending on argument
    xen/p2m: Move code around to allow for better re-usage.

    Linus Torvalds
     

22 May, 2012

1 commit

  • PV on HVM guests map GSIs into event channels. At restore time the
    event channels are resumed by restore_pirqs.

    Device drivers might try to register the same GSI again through ACPI at
    restore time, but the GSI has already been mapped and bound by
    restore_pirqs. This patch detects these situations and avoids
    mapping the same GSI multiple times.

    Without this patch we get:
    (XEN) irq.c:2235: dom4: pirq 23 or emuirq 28 already mapped
    and waste a pirq.

    CC: stable@kernel.org
    Signed-off-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

27 Apr, 2012

1 commit

  • In pirq_check_eoi_map use the pirq number rather than the Linux irq
    number to check whether an eoi is needed in the pirq_eoi_map.

    The reason is that the irq number is not always identical to the
    pirq number so if we wrongly use the irq number to check the
    pirq_eoi_map we are going to check for the wrong pirq to EOI.

    As a consequence some interrupts might not be EOI'ed by the
    guest correctly.

    Signed-off-by: Stefano Stabellini
    Tested-by: Tobias Geiger
    [v1: Added some extra wording to git commit]
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

21 Mar, 2012

1 commit

  • The pirq_eoi_map is a bitmap offered by Xen to check which pirqs need to
    be EOI'd without having to issue an hypercall every time.
    We use PHYSDEVOP_pirq_eoi_gmfn_v2 to map the bitmap, then if we
    succeed we use pirq_eoi_map to check whether pirqs need eoi.

    Changes in v3:

    - explicitly use PHYSDEVOP_pirq_eoi_gmfn_v2 rather than
    PHYSDEVOP_pirq_eoi_gmfn;

    - introduce pirq_check_eoi_map, a function to check if a pirq needs an
    eoi using the map;

    -rename pirq_needs_eoi into pirq_needs_eoi_flag;

    - introduce a function pointer called pirq_needs_eoi that is going to be
    set to the right implementation depending on the availability of
    PHYSDEVOP_pirq_eoi_gmfn_v2.

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

    Stefano Stabellini
     

17 Dec, 2011

1 commit


22 Nov, 2011

1 commit

  • Event channels exposed to userspace by the evtchn module may be used by
    other modules in an asynchronous manner, which requires that reference
    counting be used to prevent the event channel from being closed before
    the signals are delivered.

    The reference count on new event channels defaults to -1 which indicates
    the event channel is not referenced outside the kernel; evtchn_get fails
    if called on such an event channel. The event channels made visible to
    userspace by evtchn have a normal reference count.

    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     

07 Nov, 2011

1 commit

  • * 'stable/cleanups-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: use static initializers in xen-balloon.c
    Xen: fix braces and tabs coding style issue in xenbus_probe.c
    Xen: fix braces coding style issue in xenbus_probe.h
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/pci.c
    Xen: fix braces coding style issue in gntdev.c and grant-table.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/events.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/balloon.c

    Fix up trivial whitespace-conflicts in
    drivers/xen/{balloon.c,pci.c,xenbus/xenbus_probe.c}

    Linus Torvalds
     

26 Oct, 2011

1 commit


25 Oct, 2011

1 commit

  • …ci.fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/drivers-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xenbus: don't rely on xen_initial_domain to detect local xenstore
    xenbus: Fix loopback event channel assuming domain 0
    xen/pv-on-hvm:kexec: Fix implicit declaration of function 'xen_hvm_domain'
    xen/pv-on-hvm kexec: add xs_reset_watches to shutdown watches from old kernel
    xen/pv-on-hvm kexec: update xs_wire.h:xsd_sockmsg_type from xen-unstable
    xen/pv-on-hvm kexec+kdump: reset PV devices in kexec or crash kernel
    xen/pv-on-hvm kexec: rebind virqs to existing eventchannel ports
    xen/pv-on-hvm kexec: prevent crash in xenwatch_thread() when stale watch events arrive

    * 'stable/drivers.bugfixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pciback: Check if the device is found instead of blindly assuming so.
    xen/pciback: Do not dereference psdev during printk when it is NULL.
    xen: remove XEN_PLATFORM_PCI config option
    xen: XEN_PVHVM depends on PCI
    xen/pciback: double lock typo
    xen/pciback: use mutex rather than spinlock in vpci backend
    xen/pciback: Use mutexes when working with Xenbus state transitions.
    xen/pciback: miscellaneous adjustments
    xen/pciback: use mutex rather than spinlock in passthrough backend
    xen/pciback: use resource_size()

    * 'stable/pci.fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pci: support multi-segment systems
    xen-swiotlb: When doing coherent alloc/dealloc check before swizzling the MFNs.
    xen/pci: make bus notifier handler return sane values
    xen-swiotlb: fix printk and panic args
    xen-swiotlb: Fix wrong panic.
    xen-swiotlb: Retry up three times to allocate Xen-SWIOTLB
    xen-pcifront: Update warning comment to use 'e820_host' option.

    Linus Torvalds
     

20 Oct, 2011

3 commits


17 Oct, 2011

1 commit

  • This adds a mechanism to resume selected IRQs during syscore_resume
    instead of dpm_resume_noirq.

    Under Xen we need to resume IRQs associated with IPIs early enough
    that the resched IPI is unmasked and we can therefore schedule
    ourselves out of the stop_machine where the suspend/resume takes
    place.

    This issue was introduced by 676dc3cf5bc3 "xen: Use IRQF_FORCE_RESUME".

    Signed-off-by: Ian Campbell
    Cc: Rafael J. Wysocki
    Cc: Jeremy Fitzhardinge
    Cc: xen-devel
    Cc: Konrad Rzeszutek Wilk
    Link: http://lkml.kernel.org/r/1318713254.11016.52.camel@dagon.hellion.org.uk
    Cc: stable@kernel.org (at least to 2.6.32.y)
    Signed-off-by: Thomas Gleixner

    Ian Campbell
     

15 Sep, 2011

1 commit

  • When we allocate/change the IRQ informations, we do not
    need to use spinlocks. We can use a mutex (which is
    what the generic IRQ code does for allocations/changes).
    Fixes a slew of:

    BUG: sleeping function called from invalid context at /linux/kernel/mutex.c:271
    in_atomic(): 1, irqs_disabled(): 0, pid: 3216, name: xenstored
    2 locks held by xenstored/3216:
    #0: (&u->bind_mutex){......}, at: [] evtchn_ioctl+0x30/0x3a0 [xen_evtchn]
    #1: (irq_mapping_update_lock){......}, at: [] bind_evtchn_to_irq+0x24/0x90
    Pid: 3216, comm: xenstored Not tainted 3.1.0-rc6-00021-g437a3d1 #2
    Call Trace:
    [] __might_sleep+0x100/0x130
    [] mutex_lock_nested+0x2f/0x50
    [] __irq_alloc_descs+0x49/0x200
    [] ? evtchn_ioctl+0x30/0x3a0 [xen_evtchn]
    [] xen_allocate_irq_dynamic+0x34/0x70
    [] bind_evtchn_to_irq+0x5d/0x90
    [] ? evtchn_bind_to_user+0x60/0x60 [xen_evtchn]
    [] bind_evtchn_to_irqhandler+0x32/0x80
    [] evtchn_bind_to_user+0x49/0x60 [xen_evtchn]
    [] evtchn_ioctl+0x144/0x3a0 [xen_evtchn]
    [] ? vfsmount_lock_local_unlock+0x50/0x80
    [] do_vfs_ioctl+0x9a/0x5e0
    [] ? mntput+0x1f/0x30
    [] ? fput+0x199/0x240
    [] sys_ioctl+0xa1/0xb0
    [] system_call_fastpath+0x16/0x1b

    Reported-by: Jim Burns
    Acked-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     

01 Sep, 2011

1 commit

  • During a kexec boot some virqs such as timer and debugirq were already
    registered by the old kernel. The hypervisor will return -EEXISTS from
    the new EVTCHNOP_bind_virq request and the BUG in bind_virq_to_irq()
    triggers. Catch the -EEXISTS error and loop through all possible ports to find
    what port belongs to the virq/cpu combo.

    Signed-off-by: Olaf Hering
    [v2:
    - use NR_EVENT_CHANNELS instead of private MAX_EVTCHNS]
    Signed-off-by: Konrad Rzeszutek Wilk

    Olaf Hering
     

27 Jul, 2011

1 commit


12 Jul, 2011

2 commits


16 Jun, 2011

1 commit


31 May, 2011

1 commit


20 May, 2011

2 commits

  • …stable/mmu.bugfixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/irq' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: do not clear and mask evtchns in __xen_evtchn_do_upcall

    * 'stable/p2m.bugfixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/p2m: Create entries in the P2M_MFN trees's to track 1-1 mappings

    * 'stable/e820.bugfixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/setup: Fix for incorrect xen_extra_mem_start initialization under 32-bit
    xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings.

    * 'stable/mmu.bugfixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen mmu: fix a race window causing leave_mm BUG()

    Linus Torvalds
     
  • …rnel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/backend.base.v3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pci: Fix compiler error when CONFIG_XEN_PRIVILEGED_GUEST is not set.
    xen/p2m: Add EXPORT_SYMBOL_GPL to the M2P override functions.
    xen/p2m/m2p/gnttab: Support GNTMAP_host_map in the M2P override.
    xen/irq: The Xen hypervisor cleans up the PIRQs if the other domain forgot.
    xen/irq: Export 'xen_pirq_from_irq' function.
    xen/irq: Add support to check if IRQ line is shared with other domains.
    xen/irq: Check if the PCI device is owned by a domain different than DOMID_SELF.
    xen/pci: Add xen_[find|register|unregister]_device_domain_owner functions.

    * 'stable/gntalloc.v7' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/gntdev,gntalloc: Remove unneeded VM flags

    Linus Torvalds
     

11 May, 2011

1 commit

  • Change the irq handler of evtchns and pirqs that don't need EOI (pirqs
    that correspond to physical edge interrupts) to handle_edge_irq.

    Use handle_fasteoi_irq for pirqs that need eoi (they generally
    correspond to level triggered irqs), no risk in loosing interrupts
    because we have to EOI the irq anyway.

    This change has the following benefits:

    - it uses the very same handlers that Linux would use on native for the
    same irqs (handle_edge_irq for edge irqs and msis, and
    handle_fasteoi_irq for everything else);

    - it uses these handlers in the same way native code would use them: it
    let Linux mask\unmask and ack the irq when Linux want to mask\unmask
    and ack the irq;

    - it fixes a problem occurring when a driver calls disable_irq() in its
    handler: the old code was unconditionally unmasking the evtchn even if
    the irq is disabled when irq_eoi was called.

    See Documentation/DocBook/genericirq.tmpl for more informations.

    Signed-off-by: Stefano Stabellini
    [v1: Fixed space/tab issues]
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

14 Apr, 2011

4 commits


12 Apr, 2011

1 commit


31 Mar, 2011

2 commits


29 Mar, 2011

2 commits