Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Thu, Oct 19, 2017 at 02:58:17PM +0200, Jan Kara wrote: > Signed-off-by: Jan Kara > --- > man2/mmap.2 | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/man2/mmap.2 b/man2/mmap.2 > index 47c3148653be..598ff0c64f7f 100644 > --- a/man2/mmap.2 > +++ b/man2/mmap.2 > @@ -125,6 +125,21 @@ are carried through to the underlying file. > to the underlying file requires the use of > .BR msync (2).) > .TP > +.B MAP_SHARED_VALIDATE > +The same as > +.B MAP_SHARED > +except that > +.B MAP_SHARED > +mappings ignore unknown flags in > +.IR flags . > +In contrast when creating mapping of > +.B MAP_SHARED_VALIDATE > +mapping type, the kernel verifies all passed flags are known and fails the > +mapping with > +.BR EOPNOTSUPP > +otherwise. This mapping type is also required to be able to use some mapping > +flags. > +.TP Some small nits: I think you should maybe include a "(since Linux 4.15)" type note after the MAP_SHARED_VALIDATE header. You also need to update the following line: Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. Which used to refer to MAP_SYNC and MAP_PRIVATE. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Fri 20-10-17 15:47:53, Ross Zwisler wrote: > On Thu, Oct 19, 2017 at 02:58:17PM +0200, Jan Kara wrote: > > Signed-off-by: Jan Kara > > --- > > man2/mmap.2 | 30 ++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/man2/mmap.2 b/man2/mmap.2 > > index 47c3148653be..598ff0c64f7f 100644 > > --- a/man2/mmap.2 > > +++ b/man2/mmap.2 > > @@ -125,6 +125,21 @@ are carried through to the underlying file. > > to the underlying file requires the use of > > .BR msync (2).) > > .TP > > +.B MAP_SHARED_VALIDATE > > +The same as > > +.B MAP_SHARED > > +except that > > +.B MAP_SHARED > > +mappings ignore unknown flags in > > +.IR flags . > > +In contrast when creating mapping of > > +.B MAP_SHARED_VALIDATE > > +mapping type, the kernel verifies all passed flags are known and fails the > > +mapping with > > +.BR EOPNOTSUPP > > +otherwise. This mapping type is also required to be able to use some > > mapping > > +flags. > > +.TP > > Some small nits: > > I think you should maybe include a "(since Linux 4.15)" type note after the > MAP_SHARED_VALIDATE header. You also need to update the following line: > >Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. > > Which used to refer to MAP_SYNC and MAP_PRIVATE. Thanks, I've fixed these. Honza -- Jan Kara SUSE Labs, CR ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Tue, Oct 24, 2017 at 03:27:13PM +0200, Jan Kara wrote: > On Fri 20-10-17 15:47:53, Ross Zwisler wrote: > > On Thu, Oct 19, 2017 at 02:58:17PM +0200, Jan Kara wrote: > > > Signed-off-by: Jan Kara > > > --- > > > man2/mmap.2 | 30 ++ > > > 1 file changed, 30 insertions(+) > > > > > > diff --git a/man2/mmap.2 b/man2/mmap.2 > > > index 47c3148653be..598ff0c64f7f 100644 > > > --- a/man2/mmap.2 > > > +++ b/man2/mmap.2 > > > @@ -125,6 +125,21 @@ are carried through to the underlying file. > > > to the underlying file requires the use of > > > .BR msync (2).) > > > .TP > > > +.B MAP_SHARED_VALIDATE > > > +The same as > > > +.B MAP_SHARED > > > +except that > > > +.B MAP_SHARED > > > +mappings ignore unknown flags in > > > +.IR flags . > > > +In contrast when creating mapping of > > > +.B MAP_SHARED_VALIDATE > > > +mapping type, the kernel verifies all passed flags are known and fails > > > the > > > +mapping with > > > +.BR EOPNOTSUPP > > > +otherwise. This mapping type is also required to be able to use some > > > mapping > > > +flags. > > > +.TP > > > > Some small nits: > > > > I think you should maybe include a "(since Linux 4.15)" type note after the > > MAP_SHARED_VALIDATE header. You also need to update the following line: > > > >Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. > > > > Which used to refer to MAP_SYNC and MAP_PRIVATE. > > Thanks, I've fixed these. Cool, you can add my: Reviewed-by: Ross Zwisler ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Tue, Oct 24, 2017 at 05:24:15PM +0200, Jan Kara wrote: > Signed-off-by: Jan Kara This looks unchanged since the previous version? > --- > man2/mmap.2 | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/man2/mmap.2 b/man2/mmap.2 > index 47c3148653be..598ff0c64f7f 100644 > --- a/man2/mmap.2 > +++ b/man2/mmap.2 > @@ -125,6 +125,21 @@ are carried through to the underlying file. > to the underlying file requires the use of > .BR msync (2).) > .TP > +.B MAP_SHARED_VALIDATE > +The same as > +.B MAP_SHARED > +except that > +.B MAP_SHARED > +mappings ignore unknown flags in > +.IR flags . > +In contrast when creating mapping of > +.B MAP_SHARED_VALIDATE > +mapping type, the kernel verifies all passed flags are known and fails the > +mapping with > +.BR EOPNOTSUPP > +otherwise. This mapping type is also required to be able to use some mapping > +flags. > +.TP > .B MAP_PRIVATE > Create a private copy-on-write mapping. > Updates to the mapping are not visible to other processes > @@ -352,6 +367,21 @@ option. > Because of the security implications, > that option is normally enabled only on embedded devices > (i.e., devices where one has complete control of the contents of user > memory). > +.TP > +.BR MAP_SYNC " (since Linux 4.15)" > +This flags is available only with > +.B MAP_SHARED_VALIDATE > +mapping type. Mappings of > +.B MAP_SHARED > +type will silently ignore this flag. > +This flag is supported only for files supporting DAX (direct mapping of > persistent > +memory). For other files, creating mapping with this flag results in > +.B EOPNOTSUPP > +error. Shared file mappings with this flag provide the guarantee that while > +some memory is writeably mapped in the address space of the process, it will > +be visible in the same file at the same offset even after the system crashes > or > +is rebooted. This allows users of such mappings to make data modifications > +persistent in a more efficient way using appropriate CPU instructions. > .PP > Of the above flags, only > .B MAP_FIXED > -- > 2.12.3 > ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Tue 24-10-17 15:10:07, Ross Zwisler wrote: > On Tue, Oct 24, 2017 at 05:24:15PM +0200, Jan Kara wrote: > > Signed-off-by: Jan Kara > > This looks unchanged since the previous version? Ah, thanks for checking. I forgot to commit modifications. Attached is really updated patch. Honza -- Jan Kara SUSE Labs, CR >From 59eeec2998ed9b3840aab951f213148cb1d053a5 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Thu, 19 Oct 2017 14:44:55 +0200 Subject: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC Signed-off-by: Jan Kara --- man2/mmap.2 | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/man2/mmap.2 b/man2/mmap.2 index 47c3148653be..b38ee6809327 100644 --- a/man2/mmap.2 +++ b/man2/mmap.2 @@ -125,6 +125,21 @@ are carried through to the underlying file. to the underlying file requires the use of .BR msync (2).) .TP +.BR MAP_SHARED_VALIDATE " (since Linux 4.15)" +The same as +.B MAP_SHARED +except that +.B MAP_SHARED +mappings ignore unknown flags in +.IR flags . +In contrast when creating mapping of +.B MAP_SHARED_VALIDATE +mapping type, the kernel verifies all passed flags are known and fails the +mapping with +.BR EOPNOTSUPP +otherwise. This mapping type is also required to be able to use some mapping +flags. +.TP .B MAP_PRIVATE Create a private copy-on-write mapping. Updates to the mapping are not visible to other processes @@ -134,7 +149,10 @@ It is unspecified whether changes made to the file after the .BR mmap () call are visible in the mapped region. .PP -Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. +.B MAP_SHARED +and +.B MAP_PRIVATE +are described in POSIX.1-2001 and POSIX.1-2008. .PP In addition, zero or more of the following values can be ORed in .IR flags : @@ -352,6 +370,21 @@ option. Because of the security implications, that option is normally enabled only on embedded devices (i.e., devices where one has complete control of the contents of user memory). +.TP +.BR MAP_SYNC " (since Linux 4.15)" +This flags is available only with +.B MAP_SHARED_VALIDATE +mapping type. Mappings of +.B MAP_SHARED +type will silently ignore this flag. +This flag is supported only for files supporting DAX (direct mapping of persistent +memory). For other files, creating mapping with this flag results in +.B EOPNOTSUPP +error. Shared file mappings with this flag provide the guarantee that while +some memory is writeably mapped in the address space of the process, it will +be visible in the same file at the same offset even after the system crashes or +is rebooted. This allows users of such mappings to make data modifications +persistent in a more efficient way using appropriate CPU instructions. .PP Of the above flags, only .B MAP_FIXED -- 2.12.3 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Thu, Oct 26, 2017 at 03:24:02PM +0200, Jan Kara wrote: > On Tue 24-10-17 15:10:07, Ross Zwisler wrote: > > On Tue, Oct 24, 2017 at 05:24:15PM +0200, Jan Kara wrote: > > > Signed-off-by: Jan Kara > > > > This looks unchanged since the previous version? > > Ah, thanks for checking. I forgot to commit modifications. Attached is > really updated patch. > > Honza > -- > Jan Kara > SUSE Labs, CR > From 59eeec2998ed9b3840aab951f213148cb1d053a5 Mon Sep 17 00:00:00 2001 > From: Jan Kara > Date: Thu, 19 Oct 2017 14:44:55 +0200 > Subject: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC > > Signed-off-by: Jan Kara Looks good, you can add: Reviewed-by: Ross Zwisler ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
Hello Jan, I have applied your patch, and tweaked the text a little, and pushed the result to the git repo. On 1 November 2017 at 16:36, Jan Kara wrote: > Reviewed-by: Ross Zwisler > Signed-off-by: Jan Kara I have a question below. > --- > man2/mmap.2 | 35 ++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/man2/mmap.2 b/man2/mmap.2 > index 47c3148653be..b38ee6809327 100644 > --- a/man2/mmap.2 > +++ b/man2/mmap.2 > @@ -125,6 +125,21 @@ are carried through to the underlying file. > to the underlying file requires the use of > .BR msync (2).) > .TP > +.BR MAP_SHARED_VALIDATE " (since Linux 4.15)" > +The same as > +.B MAP_SHARED > +except that > +.B MAP_SHARED > +mappings ignore unknown flags in > +.IR flags . > +In contrast when creating mapping of > +.B MAP_SHARED_VALIDATE > +mapping type, the kernel verifies all passed flags are known and fails the > +mapping with > +.BR EOPNOTSUPP > +otherwise. This mapping type is also required to be able to use some mapping > +flags. > +.TP > .B MAP_PRIVATE > Create a private copy-on-write mapping. > Updates to the mapping are not visible to other processes > @@ -134,7 +149,10 @@ It is unspecified whether changes made to the file after > the > .BR mmap () > call are visible in the mapped region. > .PP > -Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. > +.B MAP_SHARED > +and > +.B MAP_PRIVATE > +are described in POSIX.1-2001 and POSIX.1-2008. > .PP > In addition, zero or more of the following values can be ORed in > .IR flags : > @@ -352,6 +370,21 @@ option. > Because of the security implications, > that option is normally enabled only on embedded devices > (i.e., devices where one has complete control of the contents of user > memory). > +.TP > +.BR MAP_SYNC " (since Linux 4.15)" > +This flags is available only with > +.B MAP_SHARED_VALIDATE > +mapping type. Mappings of > +.B MAP_SHARED > +type will silently ignore this flag. > +This flag is supported only for files supporting DAX (direct mapping of > persistent > +memory). For other files, creating mapping with this flag results in > +.B EOPNOTSUPP > +error. Shared file mappings with this flag provide the guarantee that while > +some memory is writeably mapped in the address space of the process, it will > +be visible in the same file at the same offset even after the system crashes > or > +is rebooted. This allows users of such mappings to make data modifications > +persistent in a more efficient way using appropriate CPU instructions. It feels like there's a word missing/unclear wording in the previous line, before "using". Without that word, the sentence feels a bit ambiguous. Should it be: persistent in a more efficient way *through the use of* appropriate CPU instructions. or: persistent in a more efficient way *than using* appropriate CPU instructions. ? Is suspect the first is correct, but need to check. Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Thu, Apr 12, 2018 at 03:00:49PM +0200, Michael Kerrisk (man-pages) wrote: > Hello Jan, > > I have applied your patch, and tweaked the text a little, and pushed > the result to the git repo. > > On 1 November 2017 at 16:36, Jan Kara wrote: > > Reviewed-by: Ross Zwisler > > Signed-off-by: Jan Kara > > I have a question below. > > > --- > > man2/mmap.2 | 35 ++- > > 1 file changed, 34 insertions(+), 1 deletion(-) > > > > diff --git a/man2/mmap.2 b/man2/mmap.2 > > index 47c3148653be..b38ee6809327 100644 > > --- a/man2/mmap.2 > > +++ b/man2/mmap.2 > > @@ -125,6 +125,21 @@ are carried through to the underlying file. > > to the underlying file requires the use of > > .BR msync (2).) > > .TP > > +.BR MAP_SHARED_VALIDATE " (since Linux 4.15)" > > +The same as > > +.B MAP_SHARED > > +except that > > +.B MAP_SHARED > > +mappings ignore unknown flags in > > +.IR flags . > > +In contrast when creating mapping of > > +.B MAP_SHARED_VALIDATE > > +mapping type, the kernel verifies all passed flags are known and fails the > > +mapping with > > +.BR EOPNOTSUPP > > +otherwise. This mapping type is also required to be able to use some > > mapping > > +flags. > > +.TP > > .B MAP_PRIVATE > > Create a private copy-on-write mapping. > > Updates to the mapping are not visible to other processes > > @@ -134,7 +149,10 @@ It is unspecified whether changes made to the file > > after the > > .BR mmap () > > call are visible in the mapped region. > > .PP > > -Both of these flags are described in POSIX.1-2001 and POSIX.1-2008. > > +.B MAP_SHARED > > +and > > +.B MAP_PRIVATE > > +are described in POSIX.1-2001 and POSIX.1-2008. > > .PP > > In addition, zero or more of the following values can be ORed in > > .IR flags : > > @@ -352,6 +370,21 @@ option. > > Because of the security implications, > > that option is normally enabled only on embedded devices > > (i.e., devices where one has complete control of the contents of user > > memory). > > +.TP > > +.BR MAP_SYNC " (since Linux 4.15)" > > +This flags is available only with > > +.B MAP_SHARED_VALIDATE > > +mapping type. Mappings of > > +.B MAP_SHARED > > +type will silently ignore this flag. > > +This flag is supported only for files supporting DAX (direct mapping of > > persistent > > +memory). For other files, creating mapping with this flag results in > > +.B EOPNOTSUPP > > +error. Shared file mappings with this flag provide the guarantee that while > > +some memory is writeably mapped in the address space of the process, it > > will > > +be visible in the same file at the same offset even after the system > > crashes or > > +is rebooted. This allows users of such mappings to make data modifications > > +persistent in a more efficient way using appropriate CPU instructions. > > It feels like there's a word missing/unclear wording in the previous > line, before "using". Without that word, the sentence feels a bit > ambiguous. > > Should it be: > > persistent in a more efficient way *through the use of* appropriate > CPU instructions. > > or: > > persistent in a more efficient way *than using* appropriate CPU instructions. > > ? > > Is suspect the first is correct, but need to check. You're right, the first one is correct. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
Hello Michael! On Thu 12-04-18 15:00:49, Michael Kerrisk (man-pages) wrote: > Hello Jan, > > I have applied your patch, and tweaked the text a little, and pushed > the result to the git repo. Thanks! > > +.B MAP_SHARED > > +type will silently ignore this flag. > > +This flag is supported only for files supporting DAX (direct mapping of > > persistent > > +memory). For other files, creating mapping with this flag results in > > +.B EOPNOTSUPP > > +error. Shared file mappings with this flag provide the guarantee that while > > +some memory is writeably mapped in the address space of the process, it > > will > > +be visible in the same file at the same offset even after the system > > crashes or > > +is rebooted. This allows users of such mappings to make data modifications > > +persistent in a more efficient way using appropriate CPU instructions. > > It feels like there's a word missing/unclear wording in the previous > line, before "using". Without that word, the sentence feels a bit > ambiguous. > > Should it be: > > persistent in a more efficient way *through the use of* appropriate > CPU instructions. > > or: > > persistent in a more efficient way *than using* appropriate CPU instructions. > > ? > > Is suspect the first is correct, but need to check. Yes, the first is correct. Honza -- Jan Kara SUSE Labs, CR ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
Jan, Ross. On 12 April 2018 at 16:22, Jan Kara wrote: > Hello Michael! > > On Thu 12-04-18 15:00:49, Michael Kerrisk (man-pages) wrote: >> Hello Jan, >> >> I have applied your patch, and tweaked the text a little, and pushed >> the result to the git repo. > > Thanks! > >> > +.B MAP_SHARED >> > +type will silently ignore this flag. >> > +This flag is supported only for files supporting DAX (direct mapping of >> > persistent >> > +memory). For other files, creating mapping with this flag results in >> > +.B EOPNOTSUPP >> > +error. Shared file mappings with this flag provide the guarantee that >> > while >> > +some memory is writeably mapped in the address space of the process, it >> > will >> > +be visible in the same file at the same offset even after the system >> > crashes or >> > +is rebooted. This allows users of such mappings to make data modifications >> > +persistent in a more efficient way using appropriate CPU instructions. >> >> It feels like there's a word missing/unclear wording in the previous >> line, before "using". Without that word, the sentence feels a bit >> ambiguous. >> >> Should it be: >> >> persistent in a more efficient way *through the use of* appropriate >> CPU instructions. >> >> or: >> >> persistent in a more efficient way *than using* appropriate CPU instructions. >> >> ? >> >> Is suspect the first is correct, but need to check. > > Yes, the first is correct. Thanks for both checking that phrasing. In the end I decided to reword the sentence a bot more substantially: In conjunction with the use of appropriate CPU instructions, this provides users of such mappings with a more efficient way of making data modifica‐ tions persistent. Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC
On Thu 12-04-18 20:20:12, Michael Kerrisk (man-pages) wrote: > > Thanks for both checking that phrasing. In the end I decided to reword > the sentence a bot more substantially: > > In conjunction with the use of appropriate CPU > instructions, this provides users of such mappings > with a more efficient way of making data modifica‐ > tions persistent. Great, thanks for the improvement! Honza -- Jan Kara SUSE Labs, CR ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm