• S
    iommu/vt-d: Don't disable preemption while accessing deferred_flush() · 58c4a95f
    Sebastian Andrzej Siewior 提交于
    get_cpu() disables preemption and returns the current CPU number. The
    CPU number is only used once while retrieving the address of the local's
    CPU deferred_flush pointer.
    We can instead use raw_cpu_ptr() while we remain preemptible. The worst
    thing that can happen is that flush_unmaps_timeout() is invoked multiple
    times: once by taskA after seeing HIGH_WATER_MARK and then preempted to
    another CPU and then by taskB which saw HIGH_WATER_MARK on the same CPU
    as taskA. It is also likely that ->size got from HIGH_WATER_MARK to 0
    right after its read because another CPU invoked flush_unmaps_timeout()
    for this CPU.
    The access to flush_data is protected by a spinlock so even if we get
    migrated to another CPU or preempted - the data structure is protected.
    
    While at it, I marked deferred_flush static since I can't find a
    reference to it outside of this file.
    
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Joerg Roedel <joro@8bytes.org>
    Cc: iommu@lists.linux-foundation.org
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: NJoerg Roedel <jroedel@suse.de>
    58c4a95f
intel-iommu.c 139.1 KB