linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Petr Tesařík" <petr@tesarici.cz>
To: Michael Kelley <mhklinux@outlook.com>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"kys@microsoft.com" <kys@microsoft.com>,
	"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	"decui@microsoft.com" <decui@microsoft.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"hch@lst.de" <hch@lst.de>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>
Subject: Re: [RFC 0/7] Introduce swiotlb throttling
Date: Mon, 26 Aug 2024 21:28:03 +0200	[thread overview]
Message-ID: <20240826212803.3e11d2f9@meshulam.tesarici.cz> (raw)
In-Reply-To: <SN6PR02MB41577933B499309EA3CE4DDBD48B2@SN6PR02MB4157.namprd02.prod.outlook.com>

On Mon, 26 Aug 2024 16:24:53 +0000
Michael Kelley <mhklinux@outlook.com> wrote:

> From: Petr Tesařík <petr@tesarici.cz> Sent: Saturday, August 24, 2024 1:06 PM
> > 
> > On Fri, 23 Aug 2024 20:40:16 +0000
> > Michael Kelley <mhklinux@outlook.com> wrote:
> >   
> > > From: Petr Tesařík <petr@tesarici.cz> Sent: Thursday, August 22, 2024 11:45 PM
> > >[...]  
> > > > > Discussion
> > > > > ==========
> > > > > * Since swiotlb isn't visible to device drivers, I've specifically
> > > > > named the DMA attribute as MAY_BLOCK instead of MAY_THROTTLE or
> > > > > something swiotlb specific. While this patch set consumes MAY_BLOCK
> > > > > only on the DMA direct path to do throttling in the swiotlb code,
> > > > > there might be other uses in the future outside of CoCo VMs, or
> > > > > perhaps on the IOMMU path.  
> > > >
> > > > I once introduced a similar flag and called it MAY_SLEEP. I chose
> > > > MAY_SLEEP, because there is already a might_sleep() annotation, but I
> > > > don't have a strong opinion unless your semantics is supposed to be
> > > > different from might_sleep(). If it is, then I strongly prefer
> > > > MAY_BLOCK to prevent confusing the two.  
> > >
> > > My intent is that the semantics are the same as might_sleep(). I
> > > vacillated between MAY_SLEEP and MAY_BLOCK. The kernel seems
> > > to treat "sleep" and "block" as equivalent, because blk-mq has
> > > the BLK_MQ_F_BLOCKING flag, and SCSI has the
> > > queuecommand_may_block flag that is translated to
> > > BLK_MQ_F_BLOCKING. So I settled on MAY_BLOCK, but as you
> > > point out, that's inconsistent with might_sleep(). Either way will
> > > be inconsistent somewhere, and I don't have a preference.  
> > 
> > Fair enough. Let's stay with MAY_BLOCK then, so you don't have to
> > change it everywhere.
> >   
> > >[...]  
> > > > > Open Topics
> > > > > ===========
> > > > > 1. swiotlb allocations from Xen and the IOMMU code don't make use
> > > > > of throttling. This could be added if beneficial.
> > > > >
> > > > > 2. The throttling values are currently exposed and adjustable in
> > > > > /sys/kernel/debug/swiotlb. Should any of this be moved so it is
> > > > > visible even without CONFIG_DEBUG_FS?  
> > > >
> > > > Yes. It should be possible to control the thresholds through
> > > > sysctl.  
> > >
> > > Good point.  I was thinking about creating /sys/kernel/swiotlb, but
> > > sysctl is better.  
> > 
> > That still leaves the question where it should go.
> > 
> > Under /proc/sys/kernel? Or should we make a /proc/sys/kernel/dma
> > subdirectory to make room for more dma-related controls?  
> 
> I would be good with /proc/sys/kernel/swiotlb (or "dma"). There
> are only two entries (high_throttle and low_throttle), but just
> dumping everything directly in /proc/sys/kernel doesn't seem like
> a good long-term approach.  Even though there are currently a lot
> of direct entries in /proc/sys/kernel, that may be historical, and not
> changeable due to backwards compatibility requirements.

I think SWIOTLB is a bit too narrow. How many controls would we add
under /proc/sys/kernel/swiotlb? The chances seem higher if we call it
/proc/sys/kernel/dma/swiotlb_{low,high}_throttle, and it follows the
paths in source code (which are subject to change any time, however).
Anyway, I don't want to get into bikeshedding; I'm fine with whatever
you send in the end. :-)

BTW those entries directly under /proc/sys/kernel are not all
historical. The io_uring_* controls were added just last year, see
commit 76d3ccecfa18.

Petr T

  reply	other threads:[~2024-08-26 19:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 18:37 [RFC 0/7] Introduce swiotlb throttling mhkelley58
2024-08-22 18:37 ` [RFC 1/7] swiotlb: " mhkelley58
2024-08-23  7:41   ` Petr Tesařík
2024-08-23 20:41     ` Michael Kelley
2024-08-27 15:55       ` Petr Tesařík
2024-08-27 17:30         ` Michael Kelley
2024-08-28  5:15           ` Petr Tesařík
2024-08-28  6:14             ` Michael Kelley
2024-08-22 18:37 ` [RFC 2/7] dma: Handle swiotlb throttling for SGLs mhkelley58
2024-08-23  8:02   ` Petr Tesařík
2024-08-23 20:42     ` Michael Kelley
2024-08-24 19:56       ` Petr Tesařík
2024-08-22 18:37 ` [RFC 3/7] dma: Add function for drivers to know if allowing blocking is useful mhkelley58
2024-08-23  8:07   ` Petr Tesařík
2024-08-22 18:37 ` [RFC 4/7] scsi_lib_dma: Add _attrs variant of scsi_dma_map() mhkelley58
2024-08-23  8:08   ` Petr Tesařík
2024-08-22 18:37 ` [RFC 5/7] scsi: storvsc: Enable swiotlb throttling mhkelley58
2024-08-23  8:19   ` Petr Tesařík
2024-08-23 20:42     ` Michael Kelley
2024-08-22 18:37 ` [RFC 6/7] nvme: Move BLK_MQ_F_BLOCKING indicator to struct nvme_ctrl mhkelley58
2024-08-23  8:22   ` Petr Tesařík
2024-08-22 18:37 ` [RFC 7/7] nvme: Enable swiotlb throttling for NVMe PCI devices mhkelley58
2024-08-23  8:26   ` Petr Tesařík
2024-08-22 19:29 ` [RFC 0/7] Introduce swiotlb throttling Bart Van Assche
2024-08-23  2:20   ` Michael Kelley
2024-08-23  5:46     ` Petr Tesařík
2024-08-24  8:05     ` hch
2024-08-23  6:44 ` Petr Tesařík
2024-08-23 20:40   ` Michael Kelley
2024-08-24 20:05     ` Petr Tesařík
2024-08-26 16:24       ` Michael Kelley
2024-08-26 19:28         ` Petr Tesařík [this message]
2024-08-27  0:26           ` Michael Kelley
2024-08-27  8:00             ` Petr Tesařík
2024-08-24  8:16 ` Christoph Hellwig
2024-08-26 15:27   ` Michael Kelley
2024-08-27  7:14     ` Christoph Hellwig
2024-08-28 12:02 ` Robin Murphy
2024-08-28 13:03   ` Petr Tesařík
2024-08-28 16:30     ` Michael Kelley
2024-08-28 16:41       ` Petr Tesařík
2024-08-28 19:50     ` Robin Murphy
2024-08-30  3:58       ` Michael Kelley

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=20240826212803.3e11d2f9@meshulam.tesarici.cz \
    --to=petr@tesarici.cz \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=kbusch@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=mhklinux@outlook.com \
    --cc=robin.murphy@arm.com \
    --cc=sagi@grimberg.me \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).