Message ID | 20241108193629.3817619-1-kbusch@meta.com (mailing list archive) |
---|---|
Headers | show |
Series | write hints with nvme fdp and scsi streams | expand |
On Fri, Nov 08, 2024 at 11:36:20AM -0800, Keith Busch wrote: > Default partition split so partition one gets all the write hints > exclusively I still don't think this actually works as expected, as the user interface says the write streams are contigous, and with the bitmap they aren't. As I seem to have a really hard time to get my point across, I instead spent this morning doing a POC of what I mean, and pushed it here: http://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/block-write-streams The big differences are: - there is a separate write_stream value now instead of overloading the write hint. For now it is an 8-bit field for the internal data structures so that we don't have to grow the bio, but all the user interfaces are kept at 16 bits (or in case of statx reduced to it). If this becomes now enough because we need to support devices with multiple reclaim groups we'll have to find some space by using unions or growing structures - block/fops.c is the place to map the existing write hints into the write streams instead of the driver - the stream granularity is added, because adding it to statx at a later time would be nasty. Getting it in nvme is actually amazingly cumbersome so I gave up on that and just fed a dummy value for testing, though - the partitions remapping is now done using an offset into the global write stream space so that the there is a contiguous number space. The interface for this is rather hacky, so only treat it as a start for interface and use case discussions. - the generic stack limits code stopped stacking the max write streams. While it does the right thing for simple things like multipath and mirroring/striping is is wrong for anything non-trivial like parity raid. I've left this as a separate fold patch for the discussion.
On Mon, Nov 11, 2024 at 11:29:14AM +0100, Christoph Hellwig wrote: > On Fri, Nov 08, 2024 at 11:36:20AM -0800, Keith Busch wrote: > > Default partition split so partition one gets all the write hints > > exclusively > > I still don't think this actually works as expected, as the user > interface says the write streams are contigous, and with the bitmap > they aren't. > > As I seem to have a really hard time to get my point across, I instead > spent this morning doing a POC of what I mean, and pushed it here: > > http://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/block-write-streams Just purely for backward compatibility, I don't think you can have the nvme driver error out if a stream is too large. The fcntl lifetime hint never errored out before, which gets set unconditionally from the file_inode without considering the block device's max write stream. > The big differences are: > > - there is a separate write_stream value now instead of overloading > the write hint. For now it is an 8-bit field for the internal > data structures so that we don't have to grow the bio, but all the > user interfaces are kept at 16 bits (or in case of statx reduced to > it). If this becomes now enough because we need to support devices > with multiple reclaim groups we'll have to find some space by using > unions or growing structures As far as I know, 255 possible streams exceeds any use case I know about. > - block/fops.c is the place to map the existing write hints into > the write streams instead of the driver I might be something here, but that part sure looks the same as what's in this series. > - the stream granularity is added, because adding it to statx at a > later time would be nasty. Getting it in nvme is actually amazingly > cumbersome so I gave up on that and just fed a dummy value for > testing, though Just regarding the documentation on the write_stream_granularity, you don't need to discard the entire RU in a single command. You can invalidate the RU simply by overwriting the LBAs without ever issuing any discard commands. If you really want to treat it this way, you need to ensure the first LBA written to an RU is always aligned to NPDA/NPDAL. If this is really what you require to move this forward, though, that's fine with me. > - the partitions remapping is now done using an offset into the global > write stream space so that the there is a contiguous number space. > The interface for this is rather hacky, so only treat it as a start > for interface and use case discussions. > - the generic stack limits code stopped stacking the max write > streams. While it does the right thing for simple things like > multipath and mirroring/striping is is wrong for anything non-trivial > like parity raid. I've left this as a separate fold patch for the > discussion.
On Mon, Nov 11, 2024 at 09:27:33AM -0700, Keith Busch wrote: > Just purely for backward compatibility, I don't think you can have the > nvme driver error out if a stream is too large. The fcntl lifetime hint > never errored out before, which gets set unconditionally from the > file_inode without considering the block device's max write stream. True. But block/fops.c should simply not the write hint in that case (or even do a bit of folding if we care enough). > > - block/fops.c is the place to map the existing write hints into > > the write streams instead of the driver > > I might be something here, but that part sure looks the same as what's > in this series. Your series simply mixes up the existing write (temperature) hint and the write stream, including for file system use. This version does something very similar, but only for block devices. > > > - the stream granularity is added, because adding it to statx at a > > later time would be nasty. Getting it in nvme is actually amazingly > > cumbersome so I gave up on that and just fed a dummy value for > > testing, though > > Just regarding the documentation on the write_stream_granularity, you > don't need to discard the entire RU in a single command. You can > invalidate the RU simply by overwriting the LBAs without ever issuing > any discard commands. True. Did I managed this was a quick hack job? > If you really want to treat it this way, you need to ensure the first > LBA written to an RU is always aligned to NPDA/NPDAL. Those are just hints as well, but I agree you probably get much better results if they do. > If this is really what you require to move this forward, though, that's > fine with me. I could move it forward, but right now I'm more than over subsribed. If someone actually pushing for this work could put more effort into it it will surely be faster.
On 11/11/2024 3:59 PM, Christoph Hellwig wrote: > - there is a separate write_stream value now instead of overloading > the write hint. For now it is an 8-bit field for the internal > data structures so that we don't have to grow the bio, but all the > user interfaces are kept at 16 bits (or in case of statx reduced to > it). If this becomes now enough because we need to support devices > with multiple reclaim groups we'll have to find some space by using > unions or growing structures > - block/fops.c is the place to map the existing write hints into > the write streams instead of the driver Last time when I attempted this separation between temperature and placement hints, it required adding a new fcntl[*] too because per-inode/file hints continues to be useful even when they are treated as passthrough by FS. Applications are able to use temperature hints to group multiple files on device regardless of the logical placement made by FS. The same ability is useful for write-streams/placement-hints too. But these patches reduce the scope to only block device. IMO, passthrough propagation of hints/streams should continue to remain the default behavior as it applies on multiple filesystems. And more active placement by FS should rather be enabled by some opt in (e.g., mount option). Such opt in will anyway be needed for other reasons (like regression avoidance on a broken device). [*] https://lore.kernel.org/linux-nvme/20240910150200.6589-4-joshi.k@samsung.com/
On Tue, Nov 12, 2024 at 06:56:25PM +0530, Kanchan Joshi wrote: > IMO, passthrough propagation of hints/streams should continue to remain > the default behavior as it applies on multiple filesystems. And more > active placement by FS should rather be enabled by some opt in (e.g., > mount option). Such opt in will anyway be needed for other reasons (like > regression avoidance on a broken device). I feel like banging my head against the wall. No, passing through write streams is simply not acceptable without the file system being in control. I've said and explained this in detail about a dozend times and the file system actually needing to do data separation for it's own purpose doesn't go away by ignoring it.
On Tue, Nov 12, 2024 at 02:34:39PM +0100, Christoph Hellwig wrote: > On Tue, Nov 12, 2024 at 06:56:25PM +0530, Kanchan Joshi wrote: > > IMO, passthrough propagation of hints/streams should continue to remain > > the default behavior as it applies on multiple filesystems. And more > > active placement by FS should rather be enabled by some opt in (e.g., > > mount option). Such opt in will anyway be needed for other reasons (like > > regression avoidance on a broken device). > > I feel like banging my head against the wall. No, passing through write > streams is simply not acceptable without the file system being in > control. I've said and explained this in detail about a dozend times > and the file system actually needing to do data separation for it's own > purpose doesn't go away by ignoring it. But that's just an ideological decision that doesn't jive with how people use these. The applications know how they use their data better than the filesystem, so putting the filesystem in the way to force streams look like zones is just a unnecessary layer of indirection getting in the way.
On Tue, Nov 12, 2024 at 07:25:45AM -0700, Keith Busch wrote: > > I feel like banging my head against the wall. No, passing through write > > streams is simply not acceptable without the file system being in > > control. I've said and explained this in detail about a dozend times > > and the file system actually needing to do data separation for it's own > > purpose doesn't go away by ignoring it. > > But that's just an ideological decision that doesn't jive with how > people use these. Sorry, but no it is not. The file system is the entity that owns the block device, and it is the layer that manages the block device. Bypassing it is an layering violation that creates a lot of problems and solves none at all. > The applications know how they use their data better > than the filesystem, That is a very bold assumption, and a clear indication that you are actually approaching this with a rather idiological hat. If your specific application actually thinks it knows the storage better than the file system that you are using you probably should not be using that file system. Use a raw block device or even better passthrough or spdk if you really know what you are doing (or at least thing so). Otherwise you need to agree that the file system is the final arbiter of the underlying device resource. Hint: if you have an application that knows that it is doing (there actually are a few of those) it's usually not hard to actually work with file system people to create abstractions that don't poke holes into layering but still give the applications what you want. There's also the third option of doing something like what Damien did with zonefs and actually create an abstraction for what what your are doing. > so putting the filesystem in the way to force > streams look like zones is just a unnecessary layer of indirection > getting in the way. Can you please stop this BS? Even if a file system doesn't treat write streams like zones keeps LBA space and physical allocation units entirely separate (for which I see no good reason, but others might disagree) you still need the file system in control of the hardware resources.
On Tue, Nov 12, 2024 at 05:50:54PM +0100, Christoph Hellwig wrote: > > so putting the filesystem in the way to force > > streams look like zones is just a unnecessary layer of indirection > > getting in the way. > > Can you please stop this BS? Even if a file system doesn't treat > write streams like zones keeps LBA space and physical allocation units > entirely separate (for which I see no good reason, but others might > disagree) you still need the file system in control of the hardware > resources. And in case this wasn't clear enough. Let's assume you want to write a low write amp flash optimized file system similar to say the storage layers of the all flash arrays of the last 10-15 years. You really want to avoid device GC. You'd better group your data to the reclaim unit / erase block / insert name here. So you need file system control of the write streams, you need to know their size, you need to be able to query how much your wrote after a power faŃ–l. Totally independent of how you organize your LBA space. Mapping it linearly might be the easier options without major downside, but you could also allocate them randomly for that matter. > ---end quoted text---
My 2 cents. Overall, it seems to me that the difficulty here comes from 2 things: 1) The write hints may have different semantics (temperature, FDP placement, and whatever will come next). 2) Different software layers may want to use the hints, and if several do that at the same time on the same storage that may result in a mess. About 1) Seems to me that having a different interface for each semantic is an overkill, extra code to maintain. And extra work when a new semantic comes along. To keep things simple, keep one set of interfaces (per IO interface, per file interface) for all write hints semantics, and carry the difference in semantic in the hint itself. For example, with 32 bits hints, store the semantic in 8 bits and the use the rest in the context of that semantic. The storage transport driver (nvme driver for ex), based on the 8 bits semantic in the write hint, translates adequately the write hint for the storage device. The storage driver can support several translations, one for each semantics supported. Linux doesn't need to yank out a translation to replace it with a another/new one. About 2) Provide a simple way to the user to decide which layer generate write hints. As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. Both use cases are legit, I think. To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS? In the case of an application not needing/wanting to use write hints on its own, the user would mount the filesystem enabling generation of write hints. That could be the default. On the contrary if the user decides it is best for one application to directly generate write hints to get the best performance, then mount the filesystem disabling the generation of write hints by the FS. The FS act as a passthrough regarding write hints. Regards, Pierre > -----Original Message----- > From: Keith Busch <kbusch@kernel.org> > Sent: Tuesday, November 12, 2024 6:26 AM > To: Christoph Hellwig <hch@lst.de> > Cc: Kanchan Joshi <joshi.k@samsung.com>; Keith Busch > <kbusch@meta.com>; linux-block@vger.kernel.org; linux- > nvme@lists.infradead.org; linux-scsi@vger.kernel.org; linux- > fsdevel@vger.kernel.org; io-uring@vger.kernel.org; axboe@kernel.dk; > martin.petersen@oracle.com; asml.silence@gmail.com; > javier.gonz@samsung.com > Subject: [EXT] Re: [PATCHv11 0/9] write hints with nvme fdp and scsi streams > > CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you > recognize the sender and were expecting this message. > > > On Tue, Nov 12, 2024 at 02:34:39PM +0100, Christoph Hellwig wrote: > > On Tue, Nov 12, 2024 at 06:56:25PM +0530, Kanchan Joshi wrote: > > > IMO, passthrough propagation of hints/streams should continue to > > > remain the default behavior as it applies on multiple filesystems. > > > And more active placement by FS should rather be enabled by some opt > > > in (e.g., mount option). Such opt in will anyway be needed for other > > > reasons (like regression avoidance on a broken device). > > > > I feel like banging my head against the wall. No, passing through > > write streams is simply not acceptable without the file system being > > in control. I've said and explained this in detail about a dozend > > times and the file system actually needing to do data separation for > > it's own purpose doesn't go away by ignoring it. > > But that's just an ideological decision that doesn't jive with how people use > these. The applications know how they use their data better than the > filesystem, so putting the filesystem in the way to force streams look like zones > is just a unnecessary layer of indirection getting in the way.
On Tue, Nov 12, 2024 at 06:18:21PM +0000, Pierre Labat wrote: > Overall, it seems to me that the difficulty here comes from 2 things: > 1) The write hints may have different semantics (temperature, FDP placement, and whatever will come next). Or rather trying to claim all these are "write hints" is simply the wrong approach :) > 2) Different software layers may want to use the hints, and if several do that at the same time on the same storage that may result in a mess. That's a very nice but almost to harmless way to phrase it. > About 1) > Seems to me that having a different interface for each semantic is an overkill, extra code to maintain. And extra work when a new semantic comes along. > To keep things simple, keep one set of interfaces (per IO interface, per file interface) for all write hints semantics, and carry the difference in semantic in the hint itself. > For example, with 32 bits hints, store the semantic in 8 bits and the use the rest in the context of that semantic. This is very similar to what the never followed up upon Kanchan did. I think this is a lot better than blindly overloading a generic "write hint", but still suffers from problems: a) the code is a lot more complex and harder to maintain than just two different values b) it still keeps the idea that a simple temperature hint and write stream or placement identifiers are someting comparable, which they really aren't. > About 2) > Provide a simple way to the user to decide which layer generate write hints. > As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. > Both use cases are legit, I think. > To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS? The file system is, and always has been, the entity in charge of resource allocation of the underlying device. Bypassing it will get you in trouble, and a simple mount option isn't really changing that (it's also not exactly a scalable interface). If an application wants to micro-manage placement decisions it should not use a file system, or at least not a normal one with Posix semantics. That being said we'd demonstrated that applications using proper grouping of data by file and the simple temperature hints can get very good result from file systems that can interpret them, without a lot of work in the file system. I suspect for most applications that actually want files that is actually going to give better results than trying to do the micro-management that tries to bypass the file system. I'm not sure if Keith was just ranting last night, but IFF the assumption here is that file systems are just used as dumb containers and applications manage device level placement inside them we have a much deeper problem than just interface semantics.
On Wed, Nov 13, 2024 at 05:47:36AM +0100, Christoph Hellwig wrote: > On Tue, Nov 12, 2024 at 06:18:21PM +0000, Pierre Labat wrote: > > About 2) > > Provide a simple way to the user to decide which layer generate write hints. > > As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. > > Both use cases are legit, I think. > > To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS? > > The file system is, and always has been, the entity in charge of > resource allocation of the underlying device. Bypassing it will get > you in trouble, and a simple mount option isn't really changing that > (it's also not exactly a scalable interface). > > If an application wants to micro-manage placement decisions it should not > use a file system, or at least not a normal one with Posix semantics. > That being said we'd demonstrated that applications using proper grouping > of data by file and the simple temperature hints can get very good result > from file systems that can interpret them, without a lot of work in the > file system. I suspect for most applications that actually want files > that is actually going to give better results than trying to do the > micro-management that tries to bypass the file system. This. The most important thing that filesystems do behind the scenes is manage -data locality-. XFS has thousands of lines of code to manage and control data locality - the allocation policy API itself has a *dozens* control parameters. We have 2 separate allocation architectures (one btree based, one bitmap based) and multiple locality policy algorithms. These juggled physical alignment, size granularity, size limits, data type being allocated for, desired locality targets, different search algorithms (e.g. first fit, best fit, exact fit by size or location, etc), multiple fallback strategies when the initial target cannot be met, etc. Allocation policy management is the core of every block based filesystem that has ever been written. Specifically to this "stream hint" discussion: go look at the XFS filestreams allocator. SGI wrote an entirely new allocator for XFS whose only purpose in life is to automatically separate individual streams of user data into physically separate regions of LBA space. This was written to optimise realtime ingest and playback of multiple uncompressed 4k and 8k video data streams from big isochronous SAN storage arrays back in ~2005. Each stream could be up to 1.2GB/s of data. If the data for each IO was not exactly placed in alignment with the storage array stripe cache granularity (2MB, IIRC), then a cache miss would occur and the IO latency would be too high and frames of data would be missed/dropped. IOWs, we have an allocator in XFS that specifically designed to separate indepedent streams of data to independent regions of the filesystem LBA space to effcient support data IO rates in the order of tens of GB/s. What are we talking about now? Storage hardware that might be able to do 10-15GB/s of IO that needs stream separation for efficient management of the internal storage resources. The fact we have previously solved this class of stream separation problem at the filesystem level *without needing a user-controlled API at all* is probably the most relevant fact missing from this discussion. As to the concern about stream/temp/hint translation consistency across different hardware: the filesystem is the perfect place to provide this abstraction to users. The block device can expose what it supports, the user API can be fixed, and the filesystem can provide the mapping between the two that won't change for the life of the filesystem... Long story short: Christoph is right. The OS hints/streams API needs to be aligned to the capabilities that filesystems already provide *as a primary design goal*. What the new hardware might support is a secondary concern. i.e. hardware driven software design is almost always a mistake: define the user API and abstractions first, then the OS can reduce it sanely down to what the specific hardware present is capable of supporting. -Dave.
Dave, > The OS hints/streams API needs to be aligned to the capabilities that > filesystems already provide *as a primary design goal*. What the new > hardware might support is a secondary concern. i.e. hardware driven > software design is almost always a mistake: define the user API and > abstractions first, then the OS can reduce it sanely down to what the > specific hardware present is capable of supporting. I agree completely.
On Thu, Nov 14, 2024 at 10:51:09AM +1100, Dave Chinner wrote: > Specifically to this "stream hint" discussion: go look at the XFS > filestreams allocator. Those are rally two different things - file streams is about how to locate data into a single hardware write streams. SCSI/NVMe streams including streams 2.0 (FDP) that this thread is about is about telling the hardware about these streams, and also about allowing the file systems (or other user of the storage) to pack into the actual underlying hardware boundaries that matter for deleting/overwriting this data. Funnily enough Hans and I were just recently brainstorming on how to tie both together for the zoned xfs work. > SGI wrote an entirely new allocator for XFS whose only purpose in > life is to automatically separate individual streams of user data > into physically separate regions of LBA space. One of the interesting quirks of streams/FDP is that they they operate on (semi-)physical data placement that is completely decoupled from LBA space. So if a file system or application really wants to track LBA vs physical allocations separately it gives them a way to do that. I don't really know what the advantage of having to track both is, but people smarted than me might have good uses for it.
On Thu, Nov 14, 2024 at 07:07:10AM +0100, Christoph Hellwig wrote: > On Thu, Nov 14, 2024 at 10:51:09AM +1100, Dave Chinner wrote: > > SGI wrote an entirely new allocator for XFS whose only purpose in > > life is to automatically separate individual streams of user data > > into physically separate regions of LBA space. > > One of the interesting quirks of streams/FDP is that they they operate > on (semi-)physical data placement that is completely decoupled from LBA > space. That's not particularly interesting about FDP. All conventional NAND SSDs operates that way. FDP just reports more stuff because that's what people kept asking for. But it doesn't require you fundamentally change how you acces it. You've singled out FDP to force a sequential write requirement that that requires unique support from every filesystem despite the feature not needing that. We have demonstrated 40% reduction in write amplifcation from doing the most simplist possible thing that doesn't require any filesystem or kernel-user ABI changes at all. You might think that's not significant enough to let people realize those gains without more invasive block stack changes, but you may not buying NAND in bulk if that's the case.
On Fri, Nov 15, 2024 at 09:28:05AM -0700, Keith Busch wrote: > SSDs operates that way. FDP just reports more stuff because that's what > people kept asking for. But it doesn't require you fundamentally change > how you acces it. You've singled out FDP to force a sequential write > requirement that that requires unique support from every filesystem > despite the feature not needing that. No I haven't. If you think so you are fundamentally misunderstanding what I'm saying. > We have demonstrated 40% reduction in write amplifcation from doing the > most simplist possible thing that doesn't require any filesystem or > kernel-user ABI changes at all. You might think that's not significant > enough to let people realize those gains without more invasive block > stack changes, but you may not buying NAND in bulk if that's the case. And as iterared multiple times you are doing that by bypassing the file system layer in a forceful way that breaks all abstractions and makes your feature unavailabe for file systems. I've also thrown your a nugget by first explaining and then even writing protype code to show how you get what you want while using the proper abstractions. But instead of a picking up on that you just whine like this. Either spend a little bit of effort to actually get the interface right or just shut up.
On Fri, Nov 15, 2024 at 05:53:48PM +0100, Christoph Hellwig wrote: > On Fri, Nov 15, 2024 at 09:28:05AM -0700, Keith Busch wrote: > > SSDs operates that way. FDP just reports more stuff because that's what > > people kept asking for. But it doesn't require you fundamentally change > > how you acces it. You've singled out FDP to force a sequential write > > requirement that that requires unique support from every filesystem > > despite the feature not needing that. > > No I haven't. If you think so you are fundamentally misunderstanding > what I'm saying. We have an API that has existed for 10+ years. You are gatekeeping that interface by declaring NVMe's FDP is not allowed to use it. Do I have that wrong? You initially blocked this because you didn't like how the spec committe worked. Now you've shifted to trying to pretend FDP devices require explicit filesystem handholding that was explicely NOT part of that protocol. > > We have demonstrated 40% reduction in write amplifcation from doing the > > most simplist possible thing that doesn't require any filesystem or > > kernel-user ABI changes at all. You might think that's not significant > > enough to let people realize those gains without more invasive block > > stack changes, but you may not buying NAND in bulk if that's the case. > > And as iterared multiple times you are doing that by bypassing the > file system layer in a forceful way that breaks all abstractions and > makes your feature unavailabe for file systems. Your filesystem layering breaks the abstraction and capabilities the drives are providing. You're doing more harm than good trying to game how the media works here. > I've also thrown your a nugget by first explaining and then even writing > protype code to show how you get what you want while using the proper > abstractions. Oh, the untested prototype that wasn't posted to any mailing list for a serious review? The one that forces FDP to subscribe to the zoned interface only for XFS, despite these devices being squarly in the "conventional" SSD catagory and absolutely NOT zone devices? Despite I have other users using other filesystems successfuly using the existing interfaces that your prototype doesn't do a thing for? Yah, thanks... I appreciate you put the time into getting your thoughts into actual code and it does look very valuable for ACTUAL ZONE block devices. But it seems to have missed the entire point of what this hardware feature does. If you're doing low level media garbage collection with FDP and tracking fake media write pointers, then you're doing it wrong. Please use Open Channel and ZNS SSDs if you want that interface and stop gatekeeping the EXISTING interface that has proven value in production software today. > But instead of a picking up on that you just whine like > this. Either spend a little bit of effort to actually get the interface > right or just shut up. Why the fuck should I make an effort to do improve your pet project that I don't have a customer for? They want to use the interface that was created 10 years ago, exactly for the reason it was created, and no one wants to introduce the risks of an untested and unproven major and invasive filesystem and block stack change in the kernel in the near term!
On Mon, Nov 18, 2024 at 04:37:08PM -0700, Keith Busch wrote: > We have an API that has existed for 10+ years. You are gatekeeping that > interface by declaring NVMe's FDP is not allowed to use it. Do I have > that wrong? You initially blocked this because you didn't like how the > spec committe worked. Now you've shifted to trying to pretend FDP > devices require explicit filesystem handholding that was explicely NOT > part of that protocol. I'm not fucking gate keeping anything, I'm really tired of this claim with absolutely no facts backing it up. > > And as iterared multiple times you are doing that by bypassing the > > file system layer in a forceful way that breaks all abstractions and > > makes your feature unavailabe for file systems. > > Your filesystem layering breaks the abstraction and capabilities the > drives are providing. You're doing more harm than good trying to game > how the media works here. How so? > > I've also thrown your a nugget by first explaining and then even writing > > protype code to show how you get what you want while using the proper > > abstractions. > > Oh, the untested prototype that wasn't posted to any mailing list for > a serious review? The one that forces FDP to subscribe to the zoned > interface only for XFS, despite these devices being squarly in the > "conventional" SSD catagory and absolutely NOT zone devices? Despite I > have other users using other filesystems successfuly using the existing > interfaces that your prototype doesn't do a thing for? Yah, thanks... What zoned interface to FDP? The exposed interface is to: a) pick a write stream b) expose the size of the reclaim unit not done yet, but needed for good operation: c) expose how much capacity in a reclaim unit has been written This is about as good as it gets to map the FDP (and to a lesser extent streams) interface to an abstract block layer API. If you have a better suggestion to actually expose these capabilities I'm all ears. Now _my_ preferred use of that interface is a write out of place, map LBA regions to physical reclaim blocks file system. On the hand hand because it actually fits the file system I'm writing, on the other hand because industry experience has shown that this is a very good fit to flash storage (even without any explicit placement). If you think that's all wrong that fine, despite claims to the contrary from you absolutely nothing in the interface forced you to do that. You can roll the dice for your LBA allocations and write them using a secure random number generator. The interface allows for all of that, but I doubt your results will all that great. Not my business. > I appreciate you put the time into getting your thoughts into actual > code and it does look very valuable for ACTUAL ZONE block devices. But > it seems to have missed the entire point of what this hardware feature > does. If you're doing low level media garbage collection with FDP and > tracking fake media write pointers, then you're doing it wrong. Please > use Open Channel and ZNS SSDs if you want that interface and stop > gatekeeping the EXISTING interface that has proven value in production > software today. Hey, feel free to come up with a better design. The whole point of a proper block layer design is that you actually can do that! > > But instead of a picking up on that you just whine like > > this. Either spend a little bit of effort to actually get the interface > > right or just shut up. > > Why the fuck should I make an effort to do improve your pet project that > I don't have a customer for? They want to use the interface that was > created 10 years ago, exactly for the reason it was created, and no one > wants to introduce the risks of an untested and unproven major and > invasive filesystem and block stack change in the kernel in the near > term! Because you apparently want an interface to FDP in the block layer. And if you want that you need to stop bypassing the file systems as pointed out not just by me but also at least one other file system maintainer and the maintainer of the most used block subsystem. I've thrown you some bones how that can be done while doing everything else you did before (at least assuming you get the fs side past the fs maintainers), but the only thanks for that is bullshit attacks at a personal level.
On Tue, Nov 19, 2024 at 08:15:56AM +0100, Christoph Hellwig wrote: > On Mon, Nov 18, 2024 at 04:37:08PM -0700, Keith Busch wrote: > > We have an API that has existed for 10+ years. You are gatekeeping that > > interface by declaring NVMe's FDP is not allowed to use it. Do I have > > that wrong? You initially blocked this because you didn't like how the > > spec committe worked. Now you've shifted to trying to pretend FDP > > devices require explicit filesystem handholding that was explicely NOT > > part of that protocol. > > I'm not fucking gate keeping anything, I'm really tired of this claim > with absolutely no facts backing it up. > > > > And as iterared multiple times you are doing that by bypassing the > > > file system layer in a forceful way that breaks all abstractions and > > > makes your feature unavailabe for file systems. > > > > Your filesystem layering breaks the abstraction and capabilities the > > drives are providing. You're doing more harm than good trying to game > > how the media works here. > > How so? > > > > I've also thrown your a nugget by first explaining and then even writing > > > protype code to show how you get what you want while using the proper > > > abstractions. > > > > Oh, the untested prototype that wasn't posted to any mailing list for > > a serious review? The one that forces FDP to subscribe to the zoned > > interface only for XFS, despite these devices being squarly in the > > "conventional" SSD catagory and absolutely NOT zone devices? Despite I > > have other users using other filesystems successfuly using the existing > > interfaces that your prototype doesn't do a thing for? Yah, thanks... > > What zoned interface to FDP? > > The exposed interface is to: > > a) pick a write stream How do filesystem users pick a write stream? I get a pretty strong sense that you're aiming to provide the ability for application software to group together a bunch of (potentially arbitrary) files in a cohort. Then (maybe?) you can say "This cohort of files are all expected to have data blocks related to each other in some fashion, so put them together so that the storage doesn't have to work so hard". Part of my comprehension problem here (and probably why few fs people commented on this thread) is that I have no idea what FDP is, or what the write lifetime hints in scsi were/are, or what the current "hinting" scheme is. Is this what we're arguing about? enum rw_hint { WRITE_LIFE_NOT_SET = RWH_WRITE_LIFE_NOT_SET, WRITE_LIFE_NONE = RWH_WRITE_LIFE_NONE, WRITE_LIFE_SHORT = RWH_WRITE_LIFE_SHORT, WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM, WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG, WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME, } __packed; (What happens if you have two disjoint sets of files, both of which are MEDIUM, but they shouldn't be intertwined?) Or are these new fdp hint things an overload of the existing write hint fields in the iocb/inode/bio? With a totally different meaning from anticipated lifetime of the data blocks? If Christoph is going where I think he's going with xfs, then maybe the idea here is to map allocation groups on the realtime volume (i.e. rtgroups) to a zone (or a flash channel?), along with the ability for user programs to say "allocations to this cohort of files should all come from the same rtgroup". But. The cohort associations exist entirely in the filesystem, so the filesystem gets to figure out the association between rtgroup and whatever scsi/nvme/fdp/whatever hints it sends the hardware. The mappings will all be to the same LBA space, but that's the filesystem's quirk, not necessarily a signal to the storage. Writes within a cohort will target a single rtgroup until it fills up, at which point we pick another rtgroup and start filling that. Eventually something comes along to gc the surviving allocations in the old rtgroups. (Aside: the xfs filestreams thing that Dave mentioned upthread does something kind of like this, except that user programs cannot convey cohort associations to the filesystem.) AFAICT the cohort associations are a file property, which the filesystem can persist in whatever way it wants -- e.g. (ab)using the u32 xfs project id. Is there any use using a different cohort id for a specific IO? I don't think there are any. I suppose if your application wants to talk directly to a block device then I could see why you'd want to be able to send write hints or fdp placement whatevers directly to the storage, but I don't think that's the majority of application programs. Or to put it another way -- you can plumb in a blockdev-only direct interface to the storage hints, but us filesystem folks will design whatever makes the most sense for us, and will not probably not provide direct access to those hints. After all, the whole point of xfs is to virtualize a block device. <shrug> Just my ignorant 2c. Did that help, or did I just pour gasoline on a flamewar? --D > b) expose the size of the reclaim unit > > not done yet, but needed for good operation: > > c) expose how much capacity in a reclaim unit has been written > > This is about as good as it gets to map the FDP (and to a lesser extent > streams) interface to an abstract block layer API. If you have a better > suggestion to actually expose these capabilities I'm all ears. > > Now _my_ preferred use of that interface is a write out of place, > map LBA regions to physical reclaim blocks file system. On the hand > hand because it actually fits the file system I'm writing, on the other > hand because industry experience has shown that this is a very good > fit to flash storage (even without any explicit placement). If you > think that's all wrong that fine, despite claims to the contrary from > you absolutely nothing in the interface forced you to do that. > > You can roll the dice for your LBA allocations and write them using > a secure random number generator. The interface allows for all of that, > but I doubt your results will all that great. Not my business. > > > I appreciate you put the time into getting your thoughts into actual > > code and it does look very valuable for ACTUAL ZONE block devices. But > > it seems to have missed the entire point of what this hardware feature > > does. If you're doing low level media garbage collection with FDP and > > tracking fake media write pointers, then you're doing it wrong. Please > > use Open Channel and ZNS SSDs if you want that interface and stop > > gatekeeping the EXISTING interface that has proven value in production > > software today. > > Hey, feel free to come up with a better design. The whole point of a > proper block layer design is that you actually can do that! > > > > But instead of a picking up on that you just whine like > > > this. Either spend a little bit of effort to actually get the interface > > > right or just shut up. > > > > Why the fuck should I make an effort to do improve your pet project that > > I don't have a customer for? They want to use the interface that was > > created 10 years ago, exactly for the reason it was created, and no one > > wants to introduce the risks of an untested and unproven major and > > invasive filesystem and block stack change in the kernel in the near > > term! > > Because you apparently want an interface to FDP in the block layer. And > if you want that you need to stop bypassing the file systems as pointed > out not just by me but also at least one other file system maintainer > and the maintainer of the most used block subsystem. I've thrown you > some bones how that can be done while doing everything else you did > before (at least assuming you get the fs side past the fs maintainers), > but the only thanks for that is bullshit attacks at a personal level. >
On Wed, Nov 20, 2024 at 09:21:58AM -0800, Darrick J. Wong wrote: > > How do filesystem users pick a write stream? I get a pretty strong > sense that you're aiming to provide the ability for application software > to group together a bunch of (potentially arbitrary) files in a cohort. > Then (maybe?) you can say "This cohort of files are all expected to have > data blocks related to each other in some fashion, so put them together > so that the storage doesn't have to work so hard". > > Part of my comprehension problem here (and probably why few fs people > commented on this thread) is that I have no idea what FDP is, or what > the write lifetime hints in scsi were/are, or what the current "hinting" > scheme is. FDP is just the "new" version of NVMe's streams. Support for its predecessor was added in commit f5d118406247acf ("nvme: add support for streams") https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f5d118406247acfc4fc481e441e01ea4d6318fdc Various applications were written to that interface and showed initial promise, but production quality hardware never materialized. Some of these applications are still setting the write hints today, and the filesystems are all passing through the block stack, but there's just currently no nvme driver listening on the other side. Contrast to the older nvme streams, capable hardware subscribing to this newer FDP scheme have been developed, and so people want to use those same applications using those same hints in the exact same way that it was originally designed. Enabling them could be just be a simple driver patch like the above without bothering the filesystem people :) > Is this what we're arguing about? > > enum rw_hint { > WRITE_LIFE_NOT_SET = RWH_WRITE_LIFE_NOT_SET, > WRITE_LIFE_NONE = RWH_WRITE_LIFE_NONE, > WRITE_LIFE_SHORT = RWH_WRITE_LIFE_SHORT, > WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM, > WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG, > WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME, > } __packed; > > (What happens if you have two disjoint sets of files, both of which are > MEDIUM, but they shouldn't be intertwined?) It's not going to perform as well. You'd be advised against over subscribing the hint value among applications with different relative expectations, but it generally (but not always) should be no worse than if you hadn't given any hints at all. > Or are these new fdp hint things an overload of the existing write hint > fields in the iocb/inode/bio? With a totally different meaning from > anticipated lifetime of the data blocks? The meaning assigned to an FDP stream is whatever the user wants it to mean. It's not strictly a lifetime hint, but that is certainly a valid way to use them. The contract on the device's side is that writes to one stream won't create media interfere or contention with writes to other streams. This is the same as nvme's original streams, which for some reason did not carry any of this controversy.
On Wed, Nov 20, 2024 at 11:11:12AM -0700, Keith Busch wrote: > Various applications were written to that interface and showed initial > promise, but production quality hardware never materialized. FYI, production grade NVMe streams hardware did materialize and is still is shipped and used by multiple storage OEMS. Like most things in enterprise storage you're unlikely to see it outside the firmware builds for those few customers that actually require and QAed it. > Some of > these applications are still setting the write hints today, and the > filesystems are all passing through the block stack, but there's just > currently no nvme driver listening on the other side. The only source available application we could fine that is using these hints is rocksb, which got the fcntl interface wrong so that it did not have a chance to actually work until Hans fixed it recently. Once he fixed it, it shows great results when using file system based hinting, although it still needs tuning to align it's internal file size to the hardware reclaim unit size, i.e. it either needs behind the scenes knowledge or an improved interface to be properly optimized. > The meaning assigned to an FDP stream is whatever the user wants it to > mean. It's not strictly a lifetime hint, but that is certainly a valid > way to use them. The contract on the device's side is that writes to > one stream won't create media interfere or contention with writes to > other streams. This is the same as nvme's original streams, which for > some reason did not carry any of this controversy. Maybe people realized how badly that works outside a few very special purpose uses? I've said it before, but if you really do want to bypass the file systems (and there's very good reasons for that for some workloads), bypass it entirely. Don't try to micro-manage the layer below the file system from the application without any chance for the file system to even be in the known. The entire discussion also seems to treat file systems as simple containers for blocks that are static. While that is roughly true for a lot of older file system designs, once you implement things like snapshots, data checksums, data journalling or in general flash friendly metadata write patterns that is very wrong, and the file systems will want to be able to separate write streams independently of the pure application write streams.
From: Keith Busch <kbusch@kernel.org> Changes from v10: Fixed FDP max handle size calculations (wrong type) Defined and used FDP constants instead of literal numbers Moved io_uring write_hint to the end of the SQE so as not to overlap with other defined fields except uring_cmd Default partition split so partition one gets all the write hints exclusively Folded in the fix for stacking block stream feature for nvme-multipath (from hch xfs-zoned-streams branch) Kanchan Joshi (2): io_uring: enable per-io hinting capability nvme: enable FDP support Keith Busch (7): block: use generic u16 for write hints block: introduce max_write_hints queue limit statx: add write hint information block: allow ability to limit partition write hints block, fs: add write hint to kiocb block: export placement hint feature scsi: set permanent stream count in block limits Documentation/ABI/stable/sysfs-block | 14 ++++++ block/bdev.c | 22 +++++++++ block/blk-settings.c | 5 ++ block/blk-sysfs.c | 6 +++ block/fops.c | 31 +++++++++++-- block/partitions/core.c | 45 +++++++++++++++++- drivers/nvme/host/core.c | 69 ++++++++++++++++++++++++++++ drivers/nvme/host/multipath.c | 3 +- drivers/nvme/host/nvme.h | 5 ++ drivers/scsi/sd.c | 2 + fs/stat.c | 1 + include/linux/blk-mq.h | 3 +- include/linux/blk_types.h | 4 +- include/linux/blkdev.h | 15 ++++++ include/linux/fs.h | 1 + include/linux/nvme.h | 37 +++++++++++++++ include/linux/stat.h | 1 + include/uapi/linux/io_uring.h | 4 ++ include/uapi/linux/stat.h | 3 +- io_uring/io_uring.c | 2 + io_uring/rw.c | 2 +- 21 files changed, 263 insertions(+), 12 deletions(-)