* [PATCH] Use direct I/O for loop devices
@ 2022-08-17 20:46 Demi Marie Obenour
2022-08-18 7:02 ` Jan Beulich
2022-10-20 14:34 ` Marek Marczykowski-Górecki
0 siblings, 2 replies; 6+ messages in thread
From: Demi Marie Obenour @ 2022-08-17 20:46 UTC (permalink / raw)
To: Xen developer discussion
Cc: Demi Marie Obenour, Wei Liu, Anthony PERARD,
Marek Marczykowski-Górecki
This is a huge performance improvement for two reasons:
1. It uses the filesystem’s asynchronous I/O support, rather than using
synchronous I/O.
2. It bypasses the page cache, removing a redundant layer of caching and
associated overhead.
---
tools/hotplug/Linux/block | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
index 2691b56951c9b82094471a141b9e0bed04abb929..75785f3a5422c4a5f962a4cd4f6acae5080d036d 100644
--- a/tools/hotplug/Linux/block
+++ b/tools/hotplug/Linux/block
@@ -330,7 +330,7 @@ mount it read-write in a guest domain."
else
roflag=''
fi
- do_or_die losetup $roflag "$loopdev" "$file"
+ do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] Use direct I/O for loop devices
2022-08-17 20:46 [PATCH] Use direct I/O for loop devices Demi Marie Obenour
@ 2022-08-18 7:02 ` Jan Beulich
2022-08-18 14:04 ` Demi Marie Obenour
2022-10-20 14:34 ` Marek Marczykowski-Górecki
1 sibling, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2022-08-18 7:02 UTC (permalink / raw)
To: Demi Marie Obenour
Cc: Wei Liu, Anthony PERARD, Marek Marczykowski-Górecki,
Xen developer discussion
On 17.08.2022 22:46, Demi Marie Obenour wrote:
> This is a huge performance improvement for two reasons:
>
> 1. It uses the filesystem’s asynchronous I/O support, rather than using
> synchronous I/O.
> 2. It bypasses the page cache, removing a redundant layer of caching and
> associated overhead.
> ---
> tools/hotplug/Linux/block | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
> index 2691b56951c9b82094471a141b9e0bed04abb929..75785f3a5422c4a5f962a4cd4f6acae5080d036d 100644
> --- a/tools/hotplug/Linux/block
> +++ b/tools/hotplug/Linux/block
> @@ -330,7 +330,7 @@ mount it read-write in a guest domain."
> else
> roflag=''
> fi
> - do_or_die losetup $roflag "$loopdev" "$file"
> + do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
I guess you want to first check (maybe in tools/configure) that losetup
actually supports that option. The old-ish one I'm looking at doesn't,
according to its --help output at least.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use direct I/O for loop devices
2022-08-18 7:02 ` Jan Beulich
@ 2022-08-18 14:04 ` Demi Marie Obenour
2022-08-18 14:12 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Demi Marie Obenour @ 2022-08-18 14:04 UTC (permalink / raw)
To: Jan Beulich
Cc: Wei Liu, Anthony PERARD, Marek Marczykowski-Górecki,
Xen developer discussion
[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]
On Thu, Aug 18, 2022 at 09:02:11AM +0200, Jan Beulich wrote:
> On 17.08.2022 22:46, Demi Marie Obenour wrote:
> > This is a huge performance improvement for two reasons:
> >
> > 1. It uses the filesystem’s asynchronous I/O support, rather than using
> > synchronous I/O.
> > 2. It bypasses the page cache, removing a redundant layer of caching and
> > associated overhead.
> > ---
> > tools/hotplug/Linux/block | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
> > index 2691b56951c9b82094471a141b9e0bed04abb929..75785f3a5422c4a5f962a4cd4f6acae5080d036d 100644
> > --- a/tools/hotplug/Linux/block
> > +++ b/tools/hotplug/Linux/block
> > @@ -330,7 +330,7 @@ mount it read-write in a guest domain."
> > else
> > roflag=''
> > fi
> > - do_or_die losetup $roflag "$loopdev" "$file"
> > + do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
>
> I guess you want to first check (maybe in tools/configure) that losetup
> actually supports that option. The old-ish one I'm looking at doesn't,
> according to its --help output at least.
What version are you referring to?
In Qubes OS the current plan is to use a block “script” written in C, to
improve performance and (when combined with kernel patches) eliminate
race conditions. This code could be made a wrapper for the C version.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use direct I/O for loop devices
2022-08-18 14:04 ` Demi Marie Obenour
@ 2022-08-18 14:12 ` Jan Beulich
2022-08-18 14:24 ` Demi Marie Obenour
0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2022-08-18 14:12 UTC (permalink / raw)
To: Demi Marie Obenour
Cc: Wei Liu, Anthony PERARD, Marek Marczykowski-Górecki,
Xen developer discussion
On 18.08.2022 16:04, Demi Marie Obenour wrote:
> On Thu, Aug 18, 2022 at 09:02:11AM +0200, Jan Beulich wrote:
>> On 17.08.2022 22:46, Demi Marie Obenour wrote:
>>> --- a/tools/hotplug/Linux/block
>>> +++ b/tools/hotplug/Linux/block
>>> @@ -330,7 +330,7 @@ mount it read-write in a guest domain."
>>> else
>>> roflag=''
>>> fi
>>> - do_or_die losetup $roflag "$loopdev" "$file"
>>> + do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
>>
>> I guess you want to first check (maybe in tools/configure) that losetup
>> actually supports that option. The old-ish one I'm looking at doesn't,
>> according to its --help output at least.
>
> What version are you referring to?
The tool itself doesn't recognize --version. It originates from
util-linux 2.19.1 from all I can tell.
> In Qubes OS the current plan is to use a block “script” written in C, to
> improve performance and (when combined with kernel patches) eliminate
> race conditions. This code could be made a wrapper for the C version.
Is this relevant here in some way I don't recognize, or did you say this
only to provide some further background info?
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use direct I/O for loop devices
2022-08-18 14:12 ` Jan Beulich
@ 2022-08-18 14:24 ` Demi Marie Obenour
0 siblings, 0 replies; 6+ messages in thread
From: Demi Marie Obenour @ 2022-08-18 14:24 UTC (permalink / raw)
To: Jan Beulich
Cc: Wei Liu, Anthony PERARD, Marek Marczykowski-Górecki,
Xen developer discussion
[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]
On Thu, Aug 18, 2022 at 04:12:10PM +0200, Jan Beulich wrote:
> On 18.08.2022 16:04, Demi Marie Obenour wrote:
> > On Thu, Aug 18, 2022 at 09:02:11AM +0200, Jan Beulich wrote:
> >> On 17.08.2022 22:46, Demi Marie Obenour wrote:
> >>> --- a/tools/hotplug/Linux/block
> >>> +++ b/tools/hotplug/Linux/block
> >>> @@ -330,7 +330,7 @@ mount it read-write in a guest domain."
> >>> else
> >>> roflag=''
> >>> fi
> >>> - do_or_die losetup $roflag "$loopdev" "$file"
> >>> + do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
> >>
> >> I guess you want to first check (maybe in tools/configure) that losetup
> >> actually supports that option. The old-ish one I'm looking at doesn't,
> >> according to its --help output at least.
> >
> > What version are you referring to?
>
> The tool itself doesn't recognize --version. It originates from
> util-linux 2.19.1 from all I can tell.
I see. Qubes OS doesn’t need to support such old versions. Are you
referring to
> > In Qubes OS the current plan is to use a block “script” written in C, to
> > improve performance and (when combined with kernel patches) eliminate
> > race conditions. This code could be made a wrapper for the C version.
>
> Is this relevant here in some way I don't recognize, or did you say this
> only to provide some further background info?
If the C code becomes part of the toolstack it would avoid needing to
call into losetup.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use direct I/O for loop devices
2022-08-17 20:46 [PATCH] Use direct I/O for loop devices Demi Marie Obenour
2022-08-18 7:02 ` Jan Beulich
@ 2022-10-20 14:34 ` Marek Marczykowski-Górecki
1 sibling, 0 replies; 6+ messages in thread
From: Marek Marczykowski-Górecki @ 2022-10-20 14:34 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Xen developer discussion, Wei Liu, Anthony PERARD
[-- Attachment #1: Type: text/plain, Size: 1413 bytes --]
On Wed, Aug 17, 2022 at 04:46:34PM -0400, Demi Marie Obenour wrote:
> This is a huge performance improvement for two reasons:
>
> 1. It uses the filesystem’s asynchronous I/O support, rather than using
> synchronous I/O.
> 2. It bypasses the page cache, removing a redundant layer of caching and
> associated overhead.
Cross-posting here just in case: this patch breaks block script on
devices with 4k block size, at least with some util-linux versions.
More details at https://github.com/QubesOS/qubes-issues/issues/7828
> ---
> tools/hotplug/Linux/block | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
> index 2691b56951c9b82094471a141b9e0bed04abb929..75785f3a5422c4a5f962a4cd4f6acae5080d036d 100644
> --- a/tools/hotplug/Linux/block
> +++ b/tools/hotplug/Linux/block
> @@ -330,7 +330,7 @@ mount it read-write in a guest domain."
> else
> roflag=''
> fi
> - do_or_die losetup $roflag "$loopdev" "$file"
> + do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
> xenstore_write "$XENBUS_PATH/node" "$loopdev"
> write_dev "$loopdev"
> release_lock "block"
> --
> Sincerely,
> Demi Marie Obenour (she/her/hers)
> Invisible Things Lab
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-20 14:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-17 20:46 [PATCH] Use direct I/O for loop devices Demi Marie Obenour
2022-08-18 7:02 ` Jan Beulich
2022-08-18 14:04 ` Demi Marie Obenour
2022-08-18 14:12 ` Jan Beulich
2022-08-18 14:24 ` Demi Marie Obenour
2022-10-20 14:34 ` Marek Marczykowski-Górecki
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.