mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Michael Kelley <mhklinux@outlook.com>,
	Frank Chen <frankchen158@126.com>, "hch@lst.de" <hch@lst.de>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"fan.du@intel.com" <fan.du@intel.com>,
	"jun.miao@intel.com" <jun.miao@intel.com>,
	"chenhgs@chinatelecom.cn" <chenhgs@chinatelecom.cn>
Subject: Re: [PATCH v4] dma/swiotlb: decouple high watermark tracking from CONFIG_DEBUG_FS
Date: Thu, 13 Aug 2026 08:24:18 +0200	[thread overview]
Message-ID: <a35cc67e-5949-4916-8e4c-ea452b2faad4@samsung.com> (raw)
In-Reply-To: <SN6PR02MB4157EA729E64A69A5F41427DD4DC2@SN6PR02MB4157.namprd02.prod.outlook.com>

On 12.08.2026 17:01, Michael Kelley wrote:
> From: Frank Chen <frankchen158@126.com> Sent: Wednesday, August 12, 2026 12:05 AM
>> From: chenhuguanshen <chenhgs@chinatelecom.cn>
>>
>> Under heavy concurrent DMA traffic on CoCo VMs, inc_used_and_hiwater()
>> performs an atomic_long_add_return() plus a CAS loop on the global
>> used_hiwater, and dec_used() performs an atomic_long_sub() on total_used.
>> All CPUs contend on the same cacheline, causing measurable throughput
>> degradation at scale.
>>
>> Historically these counters were only compiled in under CONFIG_DEBUG_FS,
>> which means production kernels with debugfs paid the atomic overhead
>> unconditionally. Make the tracking boot-time opt-in instead so that it
>> is disabled by default with near-zero overhead via static_call, and can
>> be enabled via "swiotlb=track_hiwater" parameter on demand for debugging.
>>
>> Note that when CONFIG_DEBUG_FS is enabled but hiwater tracking is disabled,
>> the "io_tlb_used" metric reports an approximate value rather than an
>> instantaneously exact one.
>>
>> Suggested-by: Fan Du <fan.du@intel.com>
>> Signed-off-by: Jun Miao <jun.miao@intel.com>
>> Co-developed-by: Fan Du <fan.du@intel.com>
>> Signed-off-by: Fan Du <fan.du@intel.com>
>> Tested-by: chenhuguanshen <chenhgs@chinatelecom.cn>
>> Signed-off-by: chenhuguanshen <chenhgs@chinatelecom.cn>
>>
>> ---
>> v1 -> v2:
>>  - Change the patch title.
>>  - Doing the exact hiwater calculation is dynamic and defaults to "off",
>>    dynamic config would replace being under #ifdef CONFIG_DEBUG_FS
>>  - The mechanism used for dynamic config needs to be one that is selectable
>>    on the kernel boot line so that the exact hiwater mark during boot is
>>    easily available.
>>
>> v2 -> v3:
>>  - When track_hiwater is enabled, we keep the original precise hiwater
>>    calculation backed by the global total_used atomic counter. If disabled,
>>    we switch to the approximate approach that sums per-area counters to
>>    derive the total used slot count.
>>
>> v3 -> v4:
>>  - Change commit message and documentation.
> LGTM.
>
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> Tested-by: Michael Kelley <mhklinux@outlook.com> 

Applied to dma-mapping-for-next, thanks!

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


      reply	other threads:[~2026-08-13  6:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260622122114.2563254-1-jun.miao@intel.com>
2026-06-23  2:35 ` [PATCH] swiotlb: eliminate per-map atomic contention on used/hiwater tracking Michael Kelley
2026-06-23 12:22   ` Robin Murphy
2026-06-25  7:30   ` Du, Fan
2026-06-25 15:53     ` Michael Kelley
2026-06-26  3:12       ` Du, Fan
2026-06-26 16:00         ` Michael Kelley
2026-06-27 23:20           ` Du, Fan
2026-06-28  1:30             ` Michael Kelley
2026-07-01  2:53               ` Du, Fan
2026-07-02 16:00                 ` Michael Kelley
2026-07-13  1:18                   ` Du, Fan
2026-07-14  3:25 ` [PATCH] dma/swiotlb: make high watermark tracking boot-time opt-in Frank Chen
2026-07-20 18:30   ` Michael Kelley
2026-08-04 10:55     ` Marek Szyprowski
2026-08-05  2:29 ` [PATCH v3] dma/swiotlb: decouple high watermark tracking from CONFIG_DEBUG_FS Frank Chen
2026-08-09 15:50   ` Michael Kelley
2026-08-12  7:04 ` [PATCH v4] " Frank Chen
2026-08-12 15:01   ` Michael Kelley
2026-08-13  6:24     ` Marek Szyprowski [this message]

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=a35cc67e-5949-4916-8e4c-ea452b2faad4@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=chenhgs@chinatelecom.cn \
    --cc=fan.du@intel.com \
    --cc=frankchen158@126.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=jun.miao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=robin.murphy@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®