<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/xen/events, branch linux-4.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-06-06T23:12:34Z</updated>
<entry>
<title>xen/events: Don't move disabled irqs</title>
<updated>2016-06-06T23:12:34Z</updated>
<author>
<name>Ross Lagerwall</name>
</author>
<published>2016-05-10T15:11:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=22ada7cca2bf9fe6f214d83cb79c6bd95b2313cc'/>
<id>urn:sha1:22ada7cca2bf9fe6f214d83cb79c6bd95b2313cc</id>
<content type='text'>
[ Upstream commit f0f393877c71ad227d36705d61d1e4062bc29cf5 ]

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") open-coded
irq_move_irq() but left out checking if the IRQ is disabled. This broke
resuming from suspend since it tries to move a (disabled) irq without
holding the IRQ's desc-&gt;lock. Fix it by adding in a check for disabled
IRQs.

The resulting stacktrace was:
kernel BUG at /build/linux-UbQGH5/linux-4.4.0/kernel/irq/migration.c:31!
invalid opcode: 0000 [#1] SMP
Modules linked in: xenfs xen_privcmd ...
CPU: 0 PID: 9 Comm: migration/0 Not tainted 4.4.0-22-generic #39-Ubuntu
Hardware name: Xen HVM domU, BIOS 4.6.1-xs125180 05/04/2016
task: ffff88003d75ee00 ti: ffff88003d7bc000 task.ti: ffff88003d7bc000
RIP: 0010:[&lt;ffffffff810e26e2&gt;]  [&lt;ffffffff810e26e2&gt;] irq_move_masked_irq+0xd2/0xe0
RSP: 0018:ffff88003d7bfc50  EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffff88003d40ba00 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000100 RDI: ffff88003d40bad8
RBP: ffff88003d7bfc68 R08: 0000000000000000 R09: ffff88003d000000
R10: 0000000000000000 R11: 000000000000023c R12: ffff88003d40bad0
R13: ffffffff81f3a4a0 R14: 0000000000000010 R15: 00000000ffffffff
FS:  0000000000000000(0000) GS:ffff88003da00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd4264de624 CR3: 0000000037922000 CR4: 00000000003406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffff88003d40ba38 0000000000000024 0000000000000000 ffff88003d7bfca0
 ffffffff814c8d92 00000010813ef89d 00000000805ea732 0000000000000009
 0000000000000024 ffff88003cc39b80 ffff88003d7bfce0 ffffffff814c8f66
Call Trace:
 [&lt;ffffffff814c8d92&gt;] eoi_pirq+0xb2/0xf0
 [&lt;ffffffff814c8f66&gt;] __startup_pirq+0xe6/0x150
 [&lt;ffffffff814ca659&gt;] xen_irq_resume+0x319/0x360
 [&lt;ffffffff814c7e75&gt;] xen_suspend+0xb5/0x180
 [&lt;ffffffff81120155&gt;] multi_cpu_stop+0xb5/0xe0
 [&lt;ffffffff811200a0&gt;] ? cpu_stop_queue_work+0x80/0x80
 [&lt;ffffffff811203d0&gt;] cpu_stopper_thread+0xb0/0x140
 [&lt;ffffffff810a94e6&gt;] ? finish_task_switch+0x76/0x220
 [&lt;ffffffff810ca731&gt;] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
 [&lt;ffffffff810a3935&gt;] smpboot_thread_fn+0x105/0x160
 [&lt;ffffffff810a3830&gt;] ? sort_range+0x30/0x30
 [&lt;ffffffff810a0588&gt;] kthread+0xd8/0xf0
 [&lt;ffffffff810a04b0&gt;] ? kthread_create_on_node+0x1e0/0x1e0
 [&lt;ffffffff8182568f&gt;] ret_from_fork+0x3f/0x70
 [&lt;ffffffff810a04b0&gt;] ? kthread_create_on_node+0x1e0/0x1e0

Signed-off-by: Ross Lagerwall &lt;ross.lagerwall@citrix.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>xen/events: Mask a moving irq</title>
<updated>2016-04-20T05:03:44Z</updated>
<author>
<name>Boris Ostrovsky</name>
</author>
<published>2016-03-18T14:11:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=413917195fe1c4f2e02e4a85515587f63cc65c8d'/>
<id>urn:sha1:413917195fe1c4f2e02e4a85515587f63cc65c8d</id>
<content type='text'>
[ Upstream commit ff1e22e7a638a0782f54f81a6c9cb139aca2da35 ]

Moving an unmasked irq may result in irq handler being invoked on both
source and target CPUs.

With 2-level this can happen as follows:

On source CPU:
        evtchn_2l_handle_events() -&gt;
            generic_handle_irq() -&gt;
                handle_edge_irq() -&gt;
                   eoi_pirq():
                       irq_move_irq(data);

                       /***** WE ARE HERE *****/

                       if (VALID_EVTCHN(evtchn))
                           clear_evtchn(evtchn);

If at this moment target processor is handling an unrelated event in
evtchn_2l_handle_events()'s loop it may pick up our event since target's
cpu_evtchn_mask claims that this event belongs to it *and* the event is
unmasked and still pending. At the same time, source CPU will continue
executing its own handle_edge_irq().

With FIFO interrupt the scenario is similar: irq_move_irq() may result
in a EVTCHNOP_unmask hypercall which, in turn, may make the event
pending on the target CPU.

We can avoid this situation by moving and clearing the event while
keeping event masked.

Signed-off-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>xen/events: don't bind non-percpu VIRQs with percpu chip</title>
<updated>2015-05-19T18:55:36Z</updated>
<author>
<name>David Vrabel</name>
</author>
<published>2015-05-19T17:40:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=77bb3dfdc0d554befad58fdefbc41be5bc3ed38a'/>
<id>urn:sha1:77bb3dfdc0d554befad58fdefbc41be5bc3ed38a</id>
<content type='text'>
A non-percpu VIRQ (e.g., VIRQ_CONSOLE) may be freed on a different
VCPU than it is bound to.  This can result in a race between
handle_percpu_irq() and removing the action in __free_irq() because
handle_percpu_irq() does not take desc-&gt;lock.  The interrupt handler
sees a NULL action and oopses.

Only use the percpu chip/handler for per-CPU VIRQs (like VIRQ_TIMER).

  # cat /proc/interrupts | grep virq
   40:      87246          0  xen-percpu-virq      timer0
   44:          0          0  xen-percpu-virq      debug0
   47:          0      20995  xen-percpu-virq      timer1
   51:          0          0  xen-percpu-virq      debug1
   69:          0          0   xen-dyn-virq      xen-pcpu
   74:          0          0   xen-dyn-virq      mce
   75:         29          0   xen-dyn-virq      hvc_console

Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>xen/events: Set irq_info-&gt;evtchn before binding the channel to CPU in __startup_pirq()</title>
<updated>2015-05-05T17:27:14Z</updated>
<author>
<name>Boris Ostrovsky</name>
</author>
<published>2015-04-29T21:10:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=16e6bd5970c88a2ac018b84a5f1dd5c2ff1fdf2c'/>
<id>urn:sha1:16e6bd5970c88a2ac018b84a5f1dd5c2ff1fdf2c</id>
<content type='text'>
.. because bind_evtchn_to_cpu(evtchn, cpu) will map evtchn to
'info' and pass 'info' down to xen_evtchn_port_bind_to_cpu().

Signed-off-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Tested-by: Annie Li &lt;annie.li@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
</content>
</entry>
<entry>
<title>xen/events: Clear cpu_evtchn_mask before resuming</title>
<updated>2015-05-05T17:27:11Z</updated>
<author>
<name>Boris Ostrovsky</name>
</author>
<published>2015-04-29T21:10:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5cec98834989a014a9560b1841649eaca95cf00e'/>
<id>urn:sha1:5cec98834989a014a9560b1841649eaca95cf00e</id>
<content type='text'>
When a guest is resumed, the hypervisor may change event channel
assignments. If this happens and the guest uses 2-level events it
is possible for the interrupt to be claimed by wrong VCPU since
cpu_evtchn_mask bits may be stale. This can happen even though
evtchn_2l_bind_to_cpu() attempts to clear old bits: irq_info that
is passed in is not necessarily the original one (from pre-migration
times) but instead is freshly allocated during resume and so any
information about which CPU the channel was bound to is lost.

Thus we should clear the mask during resume.

We also need to make sure that bits for xenstore and console channels
are set when these two subsystems are resumed. While rebind_evtchn_irq()
(which is invoked for both of them on a resume) calls irq_set_affinity(),
the latter will in fact postpone setting affinity until handling the
interrupt. But because cpu_evtchn_mask will have bits for these two
cleared we won't be able to take the interrupt.

With that in mind, we need to bind those two channels explicitly in
rebind_evtchn_irq(). We will keep irq_set_affinity() so that we have a
pass through generic irq affinity code later, in case something needs
to be updated there as well.

(Also replace cpumask_of(0) with cpumask_of(info-&gt;cpu) in
rebind_evtchn_irq(): it should be set to zero in preceding
xen_irq_info_evtchn_setup().)

Signed-off-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Reported-by: Annie Li &lt;annie.li@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 3.14+
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
</content>
</entry>
<entry>
<title>xen/events: avoid NULL pointer dereference in dom0 on large machines</title>
<updated>2015-03-06T13:16:32Z</updated>
<author>
<name>Juergen Gross</name>
</author>
<published>2015-02-26T05:52:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85e40b0539b24518c8bdf63e2605c8522377d00f'/>
<id>urn:sha1:85e40b0539b24518c8bdf63e2605c8522377d00f</id>
<content type='text'>
Using the pvops kernel a NULL pointer dereference was detected on a
large machine (144 processors) when booting as dom0 in
evtchn_fifo_unmask() during assignment of a pirq.

The event channel in question was the first to need a new entry in
event_array[] in events_fifo.c. Unfortunately xen_irq_info_pirq_setup()
is called with evtchn being 0 for a new pirq and the real event channel
number is assigned to the pirq only during __startup_pirq().

It is mandatory to call xen_evtchn_port_setup() after assigning the
event channel number to the pirq to make sure all memory needed for the
event channel is allocated.

Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 3.14+
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
</content>
</entry>
<entry>
<title>xen/events: support threaded irqs for interdomain event channels</title>
<updated>2014-09-23T13:36:19Z</updated>
<author>
<name>Juergen Gross</name>
</author>
<published>2014-08-28T04:44:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=854072dd0f73b8e4238c88bdf0dd2a8db0239c1c'/>
<id>urn:sha1:854072dd0f73b8e4238c88bdf0dd2a8db0239c1c</id>
<content type='text'>
Export bind_interdomain_evtchn_to_irq() so drivers can use threaded
interrupt handlers with:

 irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port);
 if (irq &lt; 0)
     /* error */
 ret = request_threaded_irq(...);

Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Acked-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
</content>
</entry>
<entry>
<title>xen/events: drop negativity check of unsigned parameter</title>
<updated>2014-08-01T14:44:45Z</updated>
<author>
<name>Andrey Utkin</name>
</author>
<published>2014-07-17T16:25:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=474b8feafb5013130d625898139b56fa54e6c9f2'/>
<id>urn:sha1:474b8feafb5013130d625898139b56fa54e6c9f2</id>
<content type='text'>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80531
Reported-by: David Binderman &lt;dcb314@hotmail.com&gt;
Signed-off-by: Andrey Utkin &lt;andrey.krieger.utkin@gmail.com&gt;
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
</content>
</entry>
<entry>
<title>xen/events/fifo: remove a unecessary use of BM()</title>
<updated>2014-07-31T16:59:18Z</updated>
<author>
<name>Frediano Ziglio</name>
</author>
<published>2014-07-31T15:22:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e4a7431240e0e4230bb4e2e05ccf413325a60e88'/>
<id>urn:sha1:e4a7431240e0e4230bb4e2e05ccf413325a60e88</id>
<content type='text'>
Since 05a812ac474d0d6aef6d54b66bb08b81abde79c6 (xen/events/fifo:
correctly align bitops), ready is an unsigned long instead of uint32_t
and the BM() macro is no longer required.

Signed-off-by: Frediano Ziglio &lt;frediano.ziglio@citrix.com&gt;
Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
</content>
</entry>
<entry>
<title>xen/events/fifo: ensure all bitops are properly aligned even on x86</title>
<updated>2014-07-31T16:58:38Z</updated>
<author>
<name>David Vrabel</name>
</author>
<published>2014-07-31T15:22:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dcecb8fd93a65787130a74e61fdf29932c8d85eb'/>
<id>urn:sha1:dcecb8fd93a65787130a74e61fdf29932c8d85eb</id>
<content type='text'>
When using the FIFO-based ABI on x86_64, if the last port is at the
end of an event array page then sync_test_bit() on this port's event
word will read beyond the end of the page and in certain circumstances
this may fault.

The fault requires the following page in the kernel's direct mapping
to be not present, which would mean:

a) the array page is the last page of RAM; or

b) the following page is ballooned out /and/ it has been used for a
   foreign mapping by a kernel driver (such as netback or blkback)
   /and/ the grant has been unmapped.

Use the infrastructure added for arm64 to ensure that all bitops
operating on event words are unsigned long aligned.

Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
</feed>
