Re: [PATCH 1/2] swiotlb: Split up single swiotlb lock

From: Christoph Hellwig
Date: Wed Jun 29 2022 - 10:09:37 EST


On Mon, Jun 27, 2022 at 11:31:49AM -0400, Tianyu Lan wrote:
> +/**
> + * struct io_tlb_area - IO TLB memory area descriptor
> + *
> + * This is a single area with a single lock.
> + *
> + * @used: The number of used IO TLB block.
> + * @index: The slot index to start searching in this area for next round.
> + * @lock: The lock to protect the above data structures in the map and
> + * unmap calls.
> + */
> +struct io_tlb_area {
> + unsigned long used;
> + unsigned int index;
> + spinlock_t lock;
> +};

As already mentioned last time, please move this into swiotlb.c,
swiotlb.h only uses a pointer to this structure.

> static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start,
> - unsigned long nslabs, unsigned int flags, bool late_alloc)
> + unsigned long nslabs, unsigned int flags,
> + bool late_alloc, unsigned int nareas)

Nit: the two tab indentation for prototype continuations is a lot easier
to maintain, so don't graciously switch away from it.

> + alloc_size - (offset + ((i - slot_index) << IO_TLB_SHIFT));

Overly long line here.