Re: [PATCH] kvm tools: plug race between uip_init and virtio_net_rx_thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 6, 2013 at 9:13 PM, Marc Zyngier <marc.zyngier@xxxxxxx> wrote:
> When fa7226f (kvm tools: init network devices only when the virtio
> driver is ready to go) was introduced, a tiny detail was overlooked:
>
> - Initialization of the uip layer is now coming in very late (only
>   when the guest driver says it is ready).
> - In parallel, the rx thread is created quite early (as soon as the
>   queues are allocated).
>
> This cause the rx thread to call uip_rx, which calls uip_buf_get_used,
> which starts to use buf_lock mutex/the buf_used_cond, which haven't
> been initialized yet. Tears and devastation follow, not to mention a
> certain lack of network connectivity for the unsuspecting guest.
>
> The (not so pretty) fix is to split uip_init:
> - uip_static_init: initialize the lists, mutexes and conditions,
>   called from virtio_net__init_one.
> - uip_init: perform the dynamic memory allocations, called from
>   notify_status.
>
> This allows the network to be safely initialized.
>
> Cc: Sasha Levin <sasha.levin@xxxxxxxxxx>
> Cc: Pekka Enberg <penberg@xxxxxxxxxx>
> Cc: Will Deacon <will.deacon@xxxxxxx>
> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>

Applied, thanks a lot!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux