All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tianyu Lan <ltykernel@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>,
	hch@infradead.org, m.szyprowski@samsung.com,
	michael.h.kelley@microsoft.com, kys@microsoft.com
Cc: parri.andrea@gmail.com, thomas.lendacky@amd.com,
	wei.liu@kernel.org, Andi Kleen <ak@linux.intel.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	linux-hyperv@vger.kernel.org, konrad.wilk@oracle.com,
	linux-kernel@vger.kernel.org, kirill.shutemov@intel.com,
	iommu@lists.linux-foundation.org, andi.kleen@intel.com,
	brijesh.singh@amd.com, vkuznets@redhat.com, hch@lst.de
Subject: Re: [RFC PATCH 1/2] swiotlb: Split up single swiotlb lock
Date: Thu, 28 Apr 2022 23:54:31 +0800	[thread overview]
Message-ID: <8c390129-4fb3-dd7c-cf83-0451c405d0b9@gmail.com> (raw)
In-Reply-To: <e7b644f0-6c90-fe99-792d-75c38505dc54@arm.com>

On 4/28/2022 10:44 PM, Robin Murphy wrote:
> On 2022-04-28 15:14, Tianyu Lan wrote:
>> From: Tianyu Lan <Tianyu.Lan@microsoft.com>
>>
>> Traditionally swiotlb was not performance critical because it was only
>> used for slow devices. But in some setups, like TDX/SEV confidential
>> guests, all IO has to go through swiotlb. Currently swiotlb only has a
>> single lock. Under high IO load with multiple CPUs this can lead to
>> significat lock contention on the swiotlb lock.
>>
>> This patch splits the swiotlb into individual areas which have their
>> own lock. When there are swiotlb map/allocate request, allocate
>> io tlb buffer from areas averagely and free the allocation back
>> to the associated area. This is to prepare to resolve the overhead
>> of single spinlock among device's queues. Per device may have its
>> own io tlb mem and bounce buffer pool.
>>
>> This idea from Andi Kleen 
>> patch(https://github.com/intel/tdx/commit/4529b578
>> 4c141782c72ec9bd9a92df2b68cb7d45). Rework it and make it may work
>> for individual device's io tlb mem. The device driver may determine
>> area number according to device queue number.
> 
> Rather than introduce this extra level of allocator complexity, how 
> about just dividing up the initial SWIOTLB allocation into multiple 
> io_tlb_mem instances?
> 
> Robin.

Agree. Thanks for suggestion. That will be more generic and will update
in the next version.

Thanks.


WARNING: multiple messages have this Message-ID (diff)
From: Tianyu Lan <ltykernel@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>,
	hch@infradead.org, m.szyprowski@samsung.com,
	michael.h.kelley@microsoft.com, kys@microsoft.com
Cc: parri.andrea@gmail.com, thomas.lendacky@amd.com,
	wei.liu@kernel.org, Andi Kleen <ak@linux.intel.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	konrad.wilk@oracle.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, kirill.shutemov@intel.com,
	iommu@lists.linux-foundation.org, andi.kleen@intel.com,
	brijesh.singh@amd.com, vkuznets@redhat.com, hch@lst.de
Subject: Re: [RFC PATCH 1/2] swiotlb: Split up single swiotlb lock
Date: Thu, 28 Apr 2022 23:54:31 +0800	[thread overview]
Message-ID: <8c390129-4fb3-dd7c-cf83-0451c405d0b9@gmail.com> (raw)
In-Reply-To: <e7b644f0-6c90-fe99-792d-75c38505dc54@arm.com>

On 4/28/2022 10:44 PM, Robin Murphy wrote:
> On 2022-04-28 15:14, Tianyu Lan wrote:
>> From: Tianyu Lan <Tianyu.Lan@microsoft.com>
>>
>> Traditionally swiotlb was not performance critical because it was only
>> used for slow devices. But in some setups, like TDX/SEV confidential
>> guests, all IO has to go through swiotlb. Currently swiotlb only has a
>> single lock. Under high IO load with multiple CPUs this can lead to
>> significat lock contention on the swiotlb lock.
>>
>> This patch splits the swiotlb into individual areas which have their
>> own lock. When there are swiotlb map/allocate request, allocate
>> io tlb buffer from areas averagely and free the allocation back
>> to the associated area. This is to prepare to resolve the overhead
>> of single spinlock among device's queues. Per device may have its
>> own io tlb mem and bounce buffer pool.
>>
>> This idea from Andi Kleen 
>> patch(https://github.com/intel/tdx/commit/4529b578
>> 4c141782c72ec9bd9a92df2b68cb7d45). Rework it and make it may work
>> for individual device's io tlb mem. The device driver may determine
>> area number according to device queue number.
> 
> Rather than introduce this extra level of allocator complexity, how 
> about just dividing up the initial SWIOTLB allocation into multiple 
> io_tlb_mem instances?
> 
> Robin.

Agree. Thanks for suggestion. That will be more generic and will update
in the next version.

Thanks.

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2022-04-28 15:54 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 14:14 [RFC PATCH 0/2] swiotlb: Introduce swiotlb device allocation function Tianyu Lan
2022-04-28 14:14 ` Tianyu Lan
2022-04-28 14:14 ` [RFC PATCH 1/2] swiotlb: Split up single swiotlb lock Tianyu Lan
2022-04-28 14:14   ` Tianyu Lan
2022-04-28 14:44   ` Robin Murphy
2022-04-28 14:44     ` Robin Murphy
2022-04-28 14:45     ` Christoph Hellwig
2022-04-28 14:45       ` Christoph Hellwig
2022-04-28 14:55       ` Andi Kleen
2022-04-28 14:55         ` Andi Kleen
2022-04-28 15:05         ` Christoph Hellwig
2022-04-28 15:05           ` Christoph Hellwig
2022-04-28 15:16           ` Andi Kleen
2022-04-28 15:16             ` Andi Kleen
2022-04-28 15:07         ` Robin Murphy
2022-04-28 15:07           ` Robin Murphy
2022-04-28 16:02           ` Andi Kleen
2022-04-28 16:02             ` Andi Kleen
2022-04-28 16:59             ` Robin Murphy
2022-04-28 16:59               ` Robin Murphy
2022-04-28 14:56       ` Robin Murphy
2022-04-28 14:56         ` Robin Murphy
2022-04-28 15:54     ` Tianyu Lan [this message]
2022-04-28 15:54       ` Tianyu Lan
2022-04-29 14:21     ` [RFC PATCH] swiotlb: Add Child IO TLB mem support Tianyu Lan
2022-04-29 14:21       ` Tianyu Lan
2022-04-29 14:25       ` Tianyu Lan
2022-04-29 14:25         ` Tianyu Lan
2022-04-28 14:14 ` [RFC PATCH 2/2] Swiotlb: Add device bounce buffer allocation interface Tianyu Lan
2022-04-28 14:14   ` Tianyu Lan
2022-04-28 15:50   ` Tianyu Lan
2022-04-28 15:50     ` Tianyu Lan
2022-04-28 17:16   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c390129-4fb3-dd7c-cf83-0451c405d0b9@gmail.com \
    --to=ltykernel@gmail.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=ak@linux.intel.com \
    --cc=andi.kleen@intel.com \
    --cc=brijesh.singh@amd.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kirill.shutemov@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=michael.h.kelley@microsoft.com \
    --cc=parri.andrea@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.