Re: [PATCH v3 2/3] hvc_init(): Enforce one-time initialization.

From: Amit Shah
Date: Fri Dec 16 2011 - 01:01:26 EST


On (Tue) 06 Dec 2011 [09:05:38], Miche Baker-Harvey wrote:
> Amit,
>
> Ah, indeed. I am not using MSI-X, so virtio_pci::vp_try_to_find_vqs()
> calls vp_request_intx() and sets up an interrupt callback. From
> there, when an interrupt occurs, the stack looks something like this:
>
> virtio_pci::vp_interrupt()
> virtio_pci::vp_vring_interrupt()
> virtio_ring::vring_interrupt()
> vq->vq.callback() <-- in this case, that's virtio_console::control_intr()
> workqueue::schedule_work()
> workqueue::queue_work()
> queue_work_on(get_cpu()) <-- queues the work on the current CPU.
>
> I'm not doing anything to keep multiple control message from being
> sent concurrently to the guest, and we will take those interrupts on
> any CPU. I've confirmed that the two instances of
> handle_control_message() are occurring on different CPUs.

Hi Miche,

Here's a quick-and-dirty hack that should help. I've not tested this,
and it's not yet signed-off-by. Let me know if this helps.