RE: [PATCH v2 5/7] ACPICA: Integrate package handling with module-level code

2018-04-12 Thread Schmauss, Erik


> -Original Message-
> From: Dan Williams [mailto:dan.j.willi...@intel.com]
> Sent: Thursday, April 12, 2018 5:57 PM
> To: Schmauss, Erik 
> Cc: Linux ACPI ; Rafael J. Wysocki
> ; Moore, Robert ; linux-nvdimm
> 
> Subject: Re: [PATCH v2 5/7] ACPICA: Integrate package handling with module-
> level code
> 
> On Thu, Apr 12, 2018 at 3:50 PM, Dan Williams 
> wrote:
> > [ adding linux-nvdimm ]
> >
> > On Fri, Feb 16, 2018 at 7:20 AM Erik Schmauss
> > 
> > wrote:
> >
> >> ACPICA commit 8faf6fca445eb7219963d80543fb802302a7a8c7
> >
> >> This change completes the integration of the recent changes to
> >> package object handling with the module-level code support.
> >
> >> For acpi_exec, the -ep flag is removed.
> >
> >> This change allows table load to behave as if it were a method
> >> invocation. Before this, the definition block definition below would
> >> have loaded all named objects at the root scope. After loading, it
> >> would execute the if statements at the root scope.
> >
> >> DefinitionBlock (...)
> >> {
> >>Name(OBJ1, 0)
> >
> >>if (1)
> >>{
> >>  Device (DEV1)
> >>  {
> >>Name (_HID,0x0)
> >>  }
> >>}
> >>Scope (DEV1)
> >>{
> >>  Name (OBJ2)
> >>}
> >> }
> >
> >> The above code would load OBJ1 to the namespace, defer the execution
> >> of the if statement and attempt to add OBJ2 within the scope of DEV1.
> >> Since DEV1 is not in scope, this would incur an AE_NOT_FOUND error.
> >> After this error is emitted, the if block is invoked and DEV1 and its
> >> _HID is added to the namespace.
> >
> >> This commit changes the behavior to execute the if block in place
> >> rather than deferring it until all tables are loaded. The new
> >> behavior is as follows: insert OBJ1 in the namespace, invoke the if
> >> statement and add DEV1 and its _HID to the namespace, add OBJ2 to the
> >> scope of DEV1.
> >
> >> Bug report links:
> >> Link: https://bugs.acpica.org/show_bug.cgi?id=963
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=153541
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=196165
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=192621
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=197207
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198051
> >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198515
> >
> >> ACPICA repo:
> >> Link: https://github.com/acpica/acpica/commit/8faf6fca
> >
> >> Tested-by: Kai-Heng Feng 
> >> Signed-off-by: Bob Moore 
> >> Signed-off-by: Erik Schmauss 
> >
> > Hi,
> >
> > This commit 5a8361f7ecce ("ACPICA: Integrate package handling with
> > module-level code") regresses the detection of persistent memory in my
> > qemu-kvm setup.
> >
> 
Hi Dan,

Thanks for figuring this out. Do you think it's possible for you to send me a 
full acpidump or some sort hexdump of the QEMU environment?

> With the following set of clean reverts on top of latest-Linus I'm back to a
> working configuration:
> 
>  Revert "ACPICA: Change a compile-time option to a runtime option"
>  Revert "ACPICA: Cleanup/simplify module-level code support"
>  Revert "ACPICA: Rename a global for clarity, no functional change"
>  Revert "ACPICA: Add option to disable Package object name resolution errors"
>  Revert "ACPICA: Integrate package handling with module-level code"
> 

Rafael, we may want to hold back on the module-level code changes (the patches 
below) for rc1. Between this and the strange _TSS issue, it seems like there 
are a few more things to resolve before this is ready for kernel upstream. If 
this is the case, I wonder if we could change the ACPICA version number so that 
it is one digit lower or append something to the end of the version number. 
This would be helpful in reminding us that it's not the full release in ACPICA 
upstream. Either that or remove the ACPICA release all together for this rc..

Thanks,

Erik
> ...i.e.
> 
> git revert 34f206fd757c
> git revert a406dea82af8
> git revert e7d970f6fca8
> git revert 959c38a7e128
> git revert 5a8361f7ecce
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Returned mail: see transcript for details

2018-04-12 Thread Automatic Email Delivery Software
The original message was included as attachment

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2] ndctl: fix libdaxctl memory leak

2018-04-12 Thread Jiang, Dave


> On Apr 12, 2018, at 7:30 PM, Verma, Vishal L  wrote:
> 
>> On Tue, 2018-04-10 at 10:43 -0700, Dave Jiang wrote:
>> 
>>> On 04/10/2018 10:38 AM, Plewa, Lukasz wrote:
>>> On Tue, Apr 10, 2018 at 7:17 PM, Dave Jiang 
>>> wrote:
 When daxctl_unref is releasing the context, we should make sure that
 the
 regions and devices are also being released. free_region() will free
 all the
 devices under the region.
 
 Signed-off-by: Dave Jiang 
 ---
 
 v2: Use list_for_each_safe() for region removal. (Dan)
 
 daxctl/lib/libdaxctl.c |8 
 1 file changed, 8 insertions(+)
 
 diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c index
 9e503201..22f4210a 100644
 --- a/daxctl/lib/libdaxctl.c
 +++ b/daxctl/lib/libdaxctl.c
 @@ -29,6 +29,8 @@
 
 static const char *attrs = "dax_region";
 
 +static void free_region(struct daxctl_region *region, struct
 list_head
 +*head);
 +
 /**
  * struct daxctl_ctx - library user context to find "nd" instances
  *
 @@ -119,11 +121,17 @@ DAXCTL_EXPORT struct daxctl_ctx
 *daxctl_ref(struct daxctl_ctx *ctx)
  */
 DAXCTL_EXPORT void daxctl_unref(struct daxctl_ctx *ctx)  {
 +struct daxctl_region *region, *_r;
 +
if (ctx == NULL)
return;
ctx->refcount--;
if (ctx->refcount > 0)
return;
 +
 +list_for_each_safe(>regions, region, _r, list)
 +free_region(region, >regions);
 +
info(ctx, "context %p released\n", ctx);
free(ctx);
 }
>>> 
>>> As daxctl_region has its own refcount, you need daxctl_ref() in
>>> add_dax_region() and daxctl_unref() in free_region().( or daxctl_ref()
>>> in daxctl_region_ref() and daxctl_unref() in daxctl_region_unref())
>>> 
>>> Without it, this code will cause segfault:
>>> 
>>> daxctl_new();
>>> region = daxctl_new_region(...);
>>> daxctl_region_ref(region);
>>> daxctl_unref(ctx);
>>> daxctl_region_unref(region);
>> 
>> Shouldn't it go in this order:
>> 
>> daxctl_region_unref(region);
>> daxctl_unref(ctx);
>> 
>> In this case, you won't segfault right? I think ctx should be the very
>> last thing you free.
> 
> Hey Dave, does this need a v3 then?
> 

Depends on Lukasz? I don’t think it’s needed if the contexts are freed in the 
right order. 
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2] ndctl: fix libdaxctl memory leak

2018-04-12 Thread Verma, Vishal L
On Tue, 2018-04-10 at 10:43 -0700, Dave Jiang wrote:
> 
> On 04/10/2018 10:38 AM, Plewa, Lukasz wrote:
> > On Tue, Apr 10, 2018 at 7:17 PM, Dave Jiang 
> > wrote:
> > > When daxctl_unref is releasing the context, we should make sure that
> > > the
> > > regions and devices are also being released. free_region() will free
> > > all the
> > > devices under the region.
> > > 
> > > Signed-off-by: Dave Jiang 
> > > ---
> > > 
> > > v2: Use list_for_each_safe() for region removal. (Dan)
> > > 
> > >  daxctl/lib/libdaxctl.c |8 
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c index
> > > 9e503201..22f4210a 100644
> > > --- a/daxctl/lib/libdaxctl.c
> > > +++ b/daxctl/lib/libdaxctl.c
> > > @@ -29,6 +29,8 @@
> > > 
> > >  static const char *attrs = "dax_region";
> > > 
> > > +static void free_region(struct daxctl_region *region, struct
> > > list_head
> > > +*head);
> > > +
> > >  /**
> > >   * struct daxctl_ctx - library user context to find "nd" instances
> > >   *
> > > @@ -119,11 +121,17 @@ DAXCTL_EXPORT struct daxctl_ctx
> > > *daxctl_ref(struct daxctl_ctx *ctx)
> > >   */
> > >  DAXCTL_EXPORT void daxctl_unref(struct daxctl_ctx *ctx)  {
> > > + struct daxctl_region *region, *_r;
> > > +
> > >   if (ctx == NULL)
> > >   return;
> > >   ctx->refcount--;
> > >   if (ctx->refcount > 0)
> > >   return;
> > > +
> > > + list_for_each_safe(>regions, region, _r, list)
> > > + free_region(region, >regions);
> > > +
> > >   info(ctx, "context %p released\n", ctx);
> > >   free(ctx);
> > >  }
> > 
> > As daxctl_region has its own refcount, you need daxctl_ref() in
> > add_dax_region() and daxctl_unref() in free_region().( or daxctl_ref()
> > in daxctl_region_ref() and daxctl_unref() in daxctl_region_unref())
> > 
> > Without it, this code will cause segfault:
> >  
> > daxctl_new();
> > region = daxctl_new_region(...);
> > daxctl_region_ref(region);
> > daxctl_unref(ctx);
> > daxctl_region_unref(region);
> 
> Shouldn't it go in this order:
> 
> daxctl_region_unref(region);
> daxctl_unref(ctx);
> 
> In this case, you won't segfault right? I think ctx should be the very
> last thing you free.

Hey Dave, does this need a v3 then?

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v3] ndctl: complete move to "fsdax" and "devdax"

2018-04-12 Thread Verma, Vishal L
On Thu, 2018-04-12 at 14:28 -0600, Ross Zwisler wrote:
> Add on to the work started by:
> 
> commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and
> "devdax" modes")
> 
> and change some more user visible places to use "fsdax" and "devdax"
> modes
> instead of "memory" and "dax", respectively.  Having multiple terms for
> the
> same mode is confusing for users.
> 
> We will continue to accept "memory" and "dax" as parameters, but all
> output
> and man pages will now use the updated terms.
> 
> Note that after the above referenced commit we still printed the old
> names
> in the default 'ndctl list' output for backward compatibility with
> scripts.
> This patch intentionally breaks that backward compatibility in favor of
> avoiding confusion and using the new mode names everywhere.
> 
> Signed-off-by: Ross Zwisler 
> ---
> 
> Changes since v2:
>  - Update files in the 'test' directory as well. (Vishal)
> 
> I've executed all the ndctl unit tests in an nfit_test setup and made
> sure everything still passes.
> 

Thanks for the update; Applied.

> ---
>  Documentation/ndctl/ndctl-inject-error.txt |  2 +-
>  Documentation/ndctl/ndctl-list.txt |  6 +++---
>  ndctl/namespace.c  | 16 
>  test/btt-pad-compat.sh |  2 +-
>  test/clear.sh  |  6 +++---
>  test/create.sh |  6 +++---
>  test/dax.sh| 12 ++--
>  test/daxdev-errors.sh  |  8 
>  test/device-dax-fio.sh |  6 +++---
>  test/device-dax.c  | 10 +-
>  test/inject-error.sh   |  2 +-
>  test/libndctl.c|  2 +-
>  test/multi-dax.sh  |  8 
>  test/rescan-partitions.sh  |  2 +-
>  util/json.c| 10 ++
>  15 files changed, 46 insertions(+), 52 deletions(-)
> 
> diff --git a/Documentation/ndctl/ndctl-inject-error.txt
> b/Documentation/ndctl/ndctl-inject-error.txt
> index 01f6c22..94c4e69 100644
> --- a/Documentation/ndctl/ndctl-inject-error.txt
> +++ b/Documentation/ndctl/ndctl-inject-error.txt
> @@ -45,7 +45,7 @@ OPTIONS
>  
>   NOTE: The offset is interpreted in different ways based on the
> "mode"
>   of the namespace. For "raw" mode, the offset is the base
> namespace
> - offset. For "memory" mode (i.e. a "pfn" namespace), the offset
> is
> + offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is
>   relative to the user-visible part of the namespace, and the
> offset
>   introduced by the kernel's metadata will be accounted for. For a
>   "sector" mode namespace (i.e. a "BTT" namespace), the offset is
> diff --git a/Documentation/ndctl/ndctl-list.txt
> b/Documentation/ndctl/ndctl-list.txt
> index 04affc4..2abc572 100644
> --- a/Documentation/ndctl/ndctl-list.txt
> +++ b/Documentation/ndctl/ndctl-list.txt
> @@ -49,7 +49,7 @@ EXAMPLE
>"namespaces":[
>  {
>"dev":"namespace0.0",
> -  "mode":"memory",
> +  "mode":"fsdax",
>"size":8589934592,
>"blockdev":"pmem0"
>  }
> @@ -132,11 +132,11 @@ include::xable-region-options.txt[]
>  -X::
>  --device-dax::
>   Include device-dax ("daxregion") details when a namespace is in
> - "dax" mode.
> + "devdax" mode.
>  [verse]
>  {
>"dev":"namespace0.0",
> -  "mode":"dax",
> +  "mode":"devdax",
>"size":4225761280,
>"uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc",
>"daxregion":{
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index f2c5644..fe86d82 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -103,7 +103,7 @@ OPT_STRING('n', "name", , "name", \
>  OPT_STRING('s', "size", , "size", \
>   "specify the namespace size in bytes (default: available
> capacity)"), \
>  OPT_STRING('m', "mode", , "operation-mode", \
> - "specify a mode for the namespace, 'sector', 'memory', or
> 'raw'"), \
> + "specify a mode for the namespace, 'sector', 'fsdax', 'devdax'
> or 'raw'"), \
>  OPT_STRING('M', "map", , "memmap-location", \
>   "specify 'mem' or 'dev' for the location of the memmap"), \
>  OPT_STRING('l', "sector-size", _size, "lba-size", \
> @@ -533,7 +533,7 @@ static int validate_namespace_options(struct
> ndctl_region *region,
>* supported a 2M default alignment when
>* ndctl_pfn_has_align() returns false.
>*/
> - debug("%s not support 'align' for memory
> mode\n",
> + debug("%s not support 'align' for fsdax mode\n",
>   region_name);
>   return -EAGAIN;
>   } else if (p->mode == NDCTL_NS_MODE_DAX
> @@ -542,7 +542,7 @@ static int validate_namespace_options(struct
> ndctl_region *region,
>

Re: [PATCH ndctl 0/2] Documentation: add asciidoctor support

2018-04-12 Thread Verma, Vishal L
On Thu, 2018-04-12 at 13:07 +0200, Takashi Iwai wrote:
> Hi,
> 
> this is a patchset to add the support for asciidoctor to generate
> documents.  The reason for adding this feature is that the future of
> asciidoc isn't clear as it's written in python2, which is now hated by
> all people out of sudden :)
> 
> The asciidoctor support is enabled via configure option, the default
> is still asciidoc for now.
> 
> 
> thanks,
> 
> Takashi

Hi Takashi,

Thanks for these patches - they look good in general. However since we are
so close to the v60 release, may I ask you to rebase these once v60 is out?
(targeting early next week..)

There will be a few documentation updates in v60, and it would be nice to
get this series applied right after v60 is out.

-Vishal

> 
> ===
> 
> Takashi Iwai (2):
>   Documentation: fix title and section markers
>   Documentation: Add the support for asciidoctor
> 
>  Documentation/asciidoctor-extensions.rb.in  |   28
> 
>  Documentation/daxctl/Makefile.am|   23 -
> --
>  Documentation/daxctl/daxctl-io.txt  |5 +++--
>  Documentation/daxctl/daxctl-list.txt|   13 +++--
>  Documentation/ndctl/Makefile.am |   23 -
> --
>  Documentation/ndctl/ndctl-disable-dimm.txt  |2 +-
>  Documentation/ndctl/ndctl-enable-region.txt |2 +-
>  Documentation/ndctl/ndctl-init-labels.txt   |   15 ++-
>  Documentation/ndctl/ndctl-list.txt  |   13 -
>  configure.ac|   14 --
>  10 files changed, 110 insertions(+), 28 deletions(-)
> ___
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2 5/7] ACPICA: Integrate package handling with module-level code

2018-04-12 Thread Dan Williams
On Thu, Apr 12, 2018 at 3:50 PM, Dan Williams  wrote:
> [ adding linux-nvdimm ]
>
> On Fri, Feb 16, 2018 at 7:20 AM Erik Schmauss 
> wrote:
>
>> ACPICA commit 8faf6fca445eb7219963d80543fb802302a7a8c7
>
>> This change completes the integration of the recent changes to
>> package object handling with the module-level code support.
>
>> For acpi_exec, the -ep flag is removed.
>
>> This change allows table load to behave as if it were a method
>> invocation. Before this, the definition block definition below would
>> have loaded all named objects at the root scope. After loading, it
>> would execute the if statements at the root scope.
>
>> DefinitionBlock (...)
>> {
>>Name(OBJ1, 0)
>
>>if (1)
>>{
>>  Device (DEV1)
>>  {
>>Name (_HID,0x0)
>>  }
>>}
>>Scope (DEV1)
>>{
>>  Name (OBJ2)
>>}
>> }
>
>> The above code would load OBJ1 to the namespace, defer the execution
>> of the if statement and attempt to add OBJ2 within the scope of DEV1.
>> Since DEV1 is not in scope, this would incur an AE_NOT_FOUND error.
>> After this error is emitted, the if block is invoked and DEV1 and its
>> _HID is added to the namespace.
>
>> This commit changes the behavior to execute the if block in place
>> rather than deferring it until all tables are loaded. The new
>> behavior is as follows: insert OBJ1 in the namespace, invoke the if
>> statement and add DEV1 and its _HID to the namespace, add OBJ2 to the
>> scope of DEV1.
>
>> Bug report links:
>> Link: https://bugs.acpica.org/show_bug.cgi?id=963
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=153541
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=196165
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=192621
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=197207
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198051
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198515
>
>> ACPICA repo:
>> Link: https://github.com/acpica/acpica/commit/8faf6fca
>
>> Tested-by: Kai-Heng Feng 
>> Signed-off-by: Bob Moore 
>> Signed-off-by: Erik Schmauss 
>
> Hi,
>
> This commit 5a8361f7ecce ("ACPICA: Integrate package handling with
> module-level code") regresses the detection of persistent memory in my
> qemu-kvm setup.
>

With the following set of clean reverts on top of latest-Linus I'm
back to a working configuration:

 Revert "ACPICA: Change a compile-time option to a runtime option"
 Revert "ACPICA: Cleanup/simplify module-level code support"
 Revert "ACPICA: Rename a global for clarity, no functional change"
 Revert "ACPICA: Add option to disable Package object name resolution errors"
 Revert "ACPICA: Integrate package handling with module-level code"

...i.e.

git revert 34f206fd757c
git revert a406dea82af8
git revert e7d970f6fca8
git revert 959c38a7e128
git revert 5a8361f7ecce
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2 5/7] ACPICA: Integrate package handling with module-level code

2018-04-12 Thread Dan Williams
[ adding linux-nvdimm ]

On Fri, Feb 16, 2018 at 7:20 AM Erik Schmauss 
wrote:

> ACPICA commit 8faf6fca445eb7219963d80543fb802302a7a8c7

> This change completes the integration of the recent changes to
> package object handling with the module-level code support.

> For acpi_exec, the -ep flag is removed.

> This change allows table load to behave as if it were a method
> invocation. Before this, the definition block definition below would
> have loaded all named objects at the root scope. After loading, it
> would execute the if statements at the root scope.

> DefinitionBlock (...)
> {
>Name(OBJ1, 0)

>if (1)
>{
>  Device (DEV1)
>  {
>Name (_HID,0x0)
>  }
>}
>Scope (DEV1)
>{
>  Name (OBJ2)
>}
> }

> The above code would load OBJ1 to the namespace, defer the execution
> of the if statement and attempt to add OBJ2 within the scope of DEV1.
> Since DEV1 is not in scope, this would incur an AE_NOT_FOUND error.
> After this error is emitted, the if block is invoked and DEV1 and its
> _HID is added to the namespace.

> This commit changes the behavior to execute the if block in place
> rather than deferring it until all tables are loaded. The new
> behavior is as follows: insert OBJ1 in the namespace, invoke the if
> statement and add DEV1 and its _HID to the namespace, add OBJ2 to the
> scope of DEV1.

> Bug report links:
> Link: https://bugs.acpica.org/show_bug.cgi?id=963
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=153541
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=196165
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=192621
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=197207
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198051
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198515

> ACPICA repo:
> Link: https://github.com/acpica/acpica/commit/8faf6fca

> Tested-by: Kai-Heng Feng 
> Signed-off-by: Bob Moore 
> Signed-off-by: Erik Schmauss 

Hi,

This commit 5a8361f7ecce ("ACPICA: Integrate package handling with
module-level code") regresses the detection of persistent memory in my
qemu-kvm setup.

Expect:

# ndctl list -BR
[
   {
 "provider":"ACPI.NFIT",
 "dev":"ndbus1",
 "regions":[
   {
 "dev":"region1",
 "size":33285996544,
 "available_size":0,
 "type":"pmem",
 "numa_node":0,
 "iset_id":52512752653219036,
 "persistence_domain":"unknown"
   },
   {
 "dev":"region2",
 "size":33285996544,
 "available_size":0,
 "type":"pmem",
 "numa_node":0,
 "iset_id":52512795602891997,
 "persistence_domain":"unknown"
   }
 ]
   },
   {
 "provider":"e820",
 "dev":"ndbus0",
 "regions":[
   {
 "dev":"region0",
 "size":4294967296,
 "available_size":0,
 "type":"pmem",
 "persistence_domain":"unknown"
   }
 ]
   }
]

Actual:

# ndctl list -BR
{
   "provider":"e820",
   "dev":"ndbus0",
   "regions":[
 {
   "dev":"region0",
   "size":4294967296,
   "available_size":0,
   "type":"pmem",
   "persistence_domain":"unknown"
 }
   ]
}

The immediately preceding commit 7decc66df940 ("ACPICA: Revert "Fix for
implicit result conversion for the To functions"") works fine.

Commit 5a8361f7ecce does not revert cleanly. Here is my qemu-kvm command
line:

label_size=$((128*1024))
mem_size=$((31 << 30))

kvm=(
 $qemu
 -enable-kvm
 -cpu kvm64
 -kernel $kernel
 -initrd $initrd
 -m 16G,slots=4,maxmem=128G

 -machine pc-i440fx-2.4,accel=kvm,usb=off,vmport=off,nvdimm
 -cpu SandyBridge
 -smp 40
 -netdev tap,id=hostnet0,ifname=tap0,script=no,downscript=no
 -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:b7:a1:ad,bus=pci.0,addr=0x7
 -object
memory-backend-file,id=mem1,share,mem-path=${mem}1,size=$((label_size +
mem_size))
 -device nvdimm,memdev=mem1,id=nv1,label-size=${label_size}

 -object
memory-backend-file,id=mem2,share,mem-path=${mem}2,size=$((label_size +
mem_size))
 -device nvdimm,memdev=mem2,id=nv2,label-size=${label_size}
 -numa node
 -numa node
 -device ahci,id=sata0,bus=pci.0,addr=0x8
 -drive file=$IMAGE,if=none,id=drive-sata0-0-0,format=raw
 -device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0
 -boot order=nc
 -no-reboot
 -watchdog i6300esb
 -rtc base=localtime
 -serial stdio
 -display none
 -monitor null
)

...where the important lines that setup the pmem emulation are:

 -object
memory-backend-file,id=mem1,share,mem-path=${mem}1,size=$((label_size +
mem_size))
 -device nvdimm,memdev=mem1,id=nv1,label-size=${label_size}

 -object

Re: [ndctl PATCH v3] ndctl: complete move to "fsdax" and "devdax"

2018-04-12 Thread Dan Williams
On Thu, Apr 12, 2018 at 1:28 PM, Ross Zwisler
 wrote:
> Add on to the work started by:
>
> commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and "devdax" 
> modes")
>
> and change some more user visible places to use "fsdax" and "devdax" modes
> instead of "memory" and "dax", respectively.  Having multiple terms for the
> same mode is confusing for users.
>
> We will continue to accept "memory" and "dax" as parameters, but all output
> and man pages will now use the updated terms.
>
> Note that after the above referenced commit we still printed the old names
> in the default 'ndctl list' output for backward compatibility with scripts.
> This patch intentionally breaks that backward compatibility in favor of
> avoiding confusion and using the new mode names everywhere.
>
> Signed-off-by: Ross Zwisler 

Reviewed-by: Dan Williams 
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[ndctl PATCH v3] ndctl: complete move to "fsdax" and "devdax"

2018-04-12 Thread Ross Zwisler
Add on to the work started by:

commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and "devdax" 
modes")

and change some more user visible places to use "fsdax" and "devdax" modes
instead of "memory" and "dax", respectively.  Having multiple terms for the
same mode is confusing for users.

We will continue to accept "memory" and "dax" as parameters, but all output
and man pages will now use the updated terms.

Note that after the above referenced commit we still printed the old names
in the default 'ndctl list' output for backward compatibility with scripts.
This patch intentionally breaks that backward compatibility in favor of
avoiding confusion and using the new mode names everywhere.

Signed-off-by: Ross Zwisler 
---

Changes since v2:
 - Update files in the 'test' directory as well. (Vishal)

I've executed all the ndctl unit tests in an nfit_test setup and made
sure everything still passes.

---
 Documentation/ndctl/ndctl-inject-error.txt |  2 +-
 Documentation/ndctl/ndctl-list.txt |  6 +++---
 ndctl/namespace.c  | 16 
 test/btt-pad-compat.sh |  2 +-
 test/clear.sh  |  6 +++---
 test/create.sh |  6 +++---
 test/dax.sh| 12 ++--
 test/daxdev-errors.sh  |  8 
 test/device-dax-fio.sh |  6 +++---
 test/device-dax.c  | 10 +-
 test/inject-error.sh   |  2 +-
 test/libndctl.c|  2 +-
 test/multi-dax.sh  |  8 
 test/rescan-partitions.sh  |  2 +-
 util/json.c| 10 ++
 15 files changed, 46 insertions(+), 52 deletions(-)

diff --git a/Documentation/ndctl/ndctl-inject-error.txt 
b/Documentation/ndctl/ndctl-inject-error.txt
index 01f6c22..94c4e69 100644
--- a/Documentation/ndctl/ndctl-inject-error.txt
+++ b/Documentation/ndctl/ndctl-inject-error.txt
@@ -45,7 +45,7 @@ OPTIONS
 
NOTE: The offset is interpreted in different ways based on the "mode"
of the namespace. For "raw" mode, the offset is the base namespace
-   offset. For "memory" mode (i.e. a "pfn" namespace), the offset is
+   offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is
relative to the user-visible part of the namespace, and the offset
introduced by the kernel's metadata will be accounted for. For a
"sector" mode namespace (i.e. a "BTT" namespace), the offset is
diff --git a/Documentation/ndctl/ndctl-list.txt 
b/Documentation/ndctl/ndctl-list.txt
index 04affc4..2abc572 100644
--- a/Documentation/ndctl/ndctl-list.txt
+++ b/Documentation/ndctl/ndctl-list.txt
@@ -49,7 +49,7 @@ EXAMPLE
   "namespaces":[
 {
   "dev":"namespace0.0",
-  "mode":"memory",
+  "mode":"fsdax",
   "size":8589934592,
   "blockdev":"pmem0"
 }
@@ -132,11 +132,11 @@ include::xable-region-options.txt[]
 -X::
 --device-dax::
Include device-dax ("daxregion") details when a namespace is in
-   "dax" mode.
+   "devdax" mode.
 [verse]
 {
   "dev":"namespace0.0",
-  "mode":"dax",
+  "mode":"devdax",
   "size":4225761280,
   "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc",
   "daxregion":{
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index f2c5644..fe86d82 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -103,7 +103,7 @@ OPT_STRING('n', "name", , "name", \
 OPT_STRING('s', "size", , "size", \
"specify the namespace size in bytes (default: available capacity)"), \
 OPT_STRING('m', "mode", , "operation-mode", \
-   "specify a mode for the namespace, 'sector', 'memory', or 'raw'"), \
+   "specify a mode for the namespace, 'sector', 'fsdax', 'devdax' or 
'raw'"), \
 OPT_STRING('M', "map", , "memmap-location", \
"specify 'mem' or 'dev' for the location of the memmap"), \
 OPT_STRING('l', "sector-size", _size, "lba-size", \
@@ -533,7 +533,7 @@ static int validate_namespace_options(struct ndctl_region 
*region,
 * supported a 2M default alignment when
 * ndctl_pfn_has_align() returns false.
 */
-   debug("%s not support 'align' for memory mode\n",
+   debug("%s not support 'align' for fsdax mode\n",
region_name);
return -EAGAIN;
} else if (p->mode == NDCTL_NS_MODE_DAX
@@ -542,7 +542,7 @@ static int validate_namespace_options(struct ndctl_region 
*region,
 * Unlike the pfn case, we require the kernel to
 * have 'align' support for device-dax.
 */
-   debug("%s not support 'align' for dax mode\n",
+   debug("%s not support 'align' for devdax 

Re: [PATCH] mmap.2: Add description of MAP_SHARED_VALIDATE and MAP_SYNC

2018-04-12 Thread Michael Kerrisk (man-pages)
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

2018-04-12 Thread Jan Kara
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

2018-04-12 Thread Ross Zwisler
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

2018-04-12 Thread Michael Kerrisk (man-pages)
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


[PATCH ndctl 1/2] Documentation: fix title and section markers

2018-04-12 Thread Takashi Iwai
The length of the title and section marker has to be aligned with the
previous line.  This was caught when running asciidoctor, which is
more strict than asciidoc.

Also since asciidoctor doesn't like the verse block in some cases,
replace the code examples with simpler markers.

Signed-off-by: Takashi Iwai 

---
 Documentation/daxctl/daxctl-io.txt  |5 +++--
 Documentation/daxctl/daxctl-list.txt|   13 +++--
 Documentation/ndctl/ndctl-disable-dimm.txt  |2 +-
 Documentation/ndctl/ndctl-enable-region.txt |2 +-
 Documentation/ndctl/ndctl-init-labels.txt   |   15 ++-
 Documentation/ndctl/ndctl-list.txt  |   13 -
 6 files changed, 30 insertions(+), 20 deletions(-)

--- a/Documentation/ndctl/ndctl-init-labels.txt
+++ b/Documentation/ndctl/ndctl-init-labels.txt
@@ -24,7 +24,7 @@ the DIMM.
 EXAMPLE
 ---
 Find the DIMMs that comprise a given region:
-[verse]
+
 # ndctl list -RD --region=region1
 {
   "dimms":[
@@ -49,23 +49,28 @@ Find the DIMMs that comprise a given reg
 }
   ]
 }
+
 
 Disable that region so the DIMM label area can be written from
 userspace:
-[verse]
+
 # ndctl disable-region region1
+
 
 Initialize labels:
-[verse]
+
 # ndctl init-labels nmem0
+
 
 Re-enable the region:
-[verse]
+
 # ndctl enable-region region1
+
 
 Create a namespace in that region:
-[verse]
+
 # ndctl create-namespace --region=region1
+
 
 OPTIONS
 ---
--- a/Documentation/ndctl/ndctl-disable-dimm.txt
+++ b/Documentation/ndctl/ndctl-disable-dimm.txt
@@ -1,5 +1,5 @@
 ndctl-disable-dimm(1)
-===
+=
 
 NAME
 
--- a/Documentation/ndctl/ndctl-enable-region.txt
+++ b/Documentation/ndctl/ndctl-enable-region.txt
@@ -1,5 +1,5 @@
 ndctl-enable-region(1)
-
+==
 
 NAME
 
--- a/Documentation/daxctl/daxctl-io.txt
+++ b/Documentation/daxctl/daxctl-io.txt
@@ -1,5 +1,5 @@
 daxctl-io(1)
-===
+
 
 NAME
 
@@ -25,7 +25,7 @@ will be performed.
 
 EXAMPLE
 ---
-[verse]
+
 # daxctl io --zero /dev/dax1.0
 
 # daxctl io --input=/dev/dax1.0 --output=/home/myfile --len=2M --seek=4096
@@ -33,6 +33,7 @@ EXAMPLE
 # cat /dev/zero | daxctl io --output=/dev/dax1.0
 
 # daxctl io --input=/dev/zero --output=/dev/dax1.0 --skip=4096
+
 
 OPTIONS
 ---
--- a/Documentation/daxctl/daxctl-list.txt
+++ b/Documentation/daxctl/daxctl-list.txt
@@ -1,5 +1,5 @@
 daxctl-list(1)
-=
+==
 
 NAME
 
@@ -22,10 +22,9 @@ daxctl list --devices
 
 EXAMPLE
 ---
-[verse]
+
 # daxctl list --regions --devices
 
-["literal"]
 {
   "id":1,
   "devices":[
@@ -35,6 +34,7 @@ EXAMPLE
 }
   ]
 }
+
 
 OPTIONS
 ---
@@ -52,14 +52,14 @@ OPTIONS
tuple, or keyword 'all' to filter the listing. For
example to list the first device instance in region1:
 
-[verse]
+
 # daxctl list --dev=1.0
 
-["literal"]
 {
   "chardev":"dax1.0",
   "size":3233808384
 }
+
 
 -D::
 --devices::
@@ -80,7 +80,7 @@ OPTIONS
will be formatted as human readable strings with units, other
fields are converted to hexadecimal strings.  Example:
 
-[verse]
+
 # daxctl list
 {
   "chardev":"dax1.0",
@@ -92,6 +92,7 @@ OPTIONS
   "chardev":"dax1.0",
   "size":"30.57 GiB (32.83 GB)"
 }
+
 
 COPYRIGHT
 -
--- a/Documentation/ndctl/ndctl-list.txt
+++ b/Documentation/ndctl/ndctl-list.txt
@@ -21,10 +21,9 @@ ndctl list --namespaces --bus=all --regi
 
 EXAMPLE
 ---
-[verse]
+
 # ndctl list --buses --namespaces
 
-["literal"]
 {
   "provider":"nfit_test.1",
   "dev":"ndbus2",
@@ -53,6 +52,7 @@ EXAMPLE
 }
   ]
 }
+
 
 OPTIONS
 ---
@@ -65,8 +65,9 @@ include::xable-region-options.txt[]
An 'nmemX' device name, or dimm id number. Filter listing by
devices that reference the given dimm. For example to see all
namespaces comprised of storage capacity on nmem0:
-[verse]
+
 # ndctl list --dimm=nmem0 --namespaces
+
 
 -n::
 --namespace=::
@@ -182,7 +183,7 @@ include::xable-region-options.txt[]
 
 include::human-option.txt[]
 
-[verse]
+
 # ndctl list --region=7
 {
   "dev":"region7",
@@ -192,8 +193,9 @@ include::human-option.txt[]
   "iset_id":-6382611090938810793,
   "badblock_count":8
 }
+
 
-[verse]
+
 # ndctl list --human --region=7
 {
   "dev":"region7",
@@ -203,6 +205,7 @@ include::human-option.txt[]
   "iset_id":"0xa76c6907811fae57",
   "badblock_count":8
 }
+
 
 COPYRIGHT
 -
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH ndctl 0/2] Documentation: add asciidoctor support

2018-04-12 Thread Takashi Iwai
Hi,

this is a patchset to add the support for asciidoctor to generate
documents.  The reason for adding this feature is that the future of
asciidoc isn't clear as it's written in python2, which is now hated by
all people out of sudden :)

The asciidoctor support is enabled via configure option, the default
is still asciidoc for now.


thanks,

Takashi

===

Takashi Iwai (2):
  Documentation: fix title and section markers
  Documentation: Add the support for asciidoctor

 Documentation/asciidoctor-extensions.rb.in  |   28 
 Documentation/daxctl/Makefile.am|   23 ---
 Documentation/daxctl/daxctl-io.txt  |5 +++--
 Documentation/daxctl/daxctl-list.txt|   13 +++--
 Documentation/ndctl/Makefile.am |   23 ---
 Documentation/ndctl/ndctl-disable-dimm.txt  |2 +-
 Documentation/ndctl/ndctl-enable-region.txt |2 +-
 Documentation/ndctl/ndctl-init-labels.txt   |   15 ++-
 Documentation/ndctl/ndctl-list.txt  |   13 -
 configure.ac|   14 --
 10 files changed, 110 insertions(+), 28 deletions(-)
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH ndctl 2/2] Documentation: Add the support for asciidoctor

2018-04-12 Thread Takashi Iwai
This patch adds the support for asciidoctor to be used for generating
documents instead of asciidoc.  It's enabled via --enable-asciidoctor
configure option while asciidoc is used still as default.

In addition to the configure option, a few other changes were needed:
* some asciidoc.conf python stuff has to be replaced with asciidoctor
  ruby extension; copied mostly from git
* asciidoctor requires slightly different options

Signed-off-by: Takashi Iwai 

---
 Documentation/asciidoctor-extensions.rb.in |   28 
 Documentation/daxctl/Makefile.am   |   23 ---
 Documentation/ndctl/Makefile.am|   23 ---
 configure.ac   |   14 --
 4 files changed, 80 insertions(+), 8 deletions(-)

--- /dev/null
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -0,0 +1,28 @@
+require 'asciidoctor'
+require 'asciidoctor/extensions'
+
+module @Utility@
+  module Documentation
+class Link@Utility@Processor < 
Asciidoctor::Extensions::InlineMacroProcessor
+  use_dsl
+
+  named :chrome
+
+  def process(parent, target, attrs)
+if parent.document.basebackend? 'html'
+  prefix = parent.document.attr('@utility@-relative-html-prefix')
+  %(#{target}(#{attrs[1]})\n)
+elsif parent.document.basebackend? 'docbook'
+  "\n" \
+"#{target}" \
+"#{attrs[1]}\n" \
+  "\n"
+end
+  end
+end
+  end
+end
+
+Asciidoctor::Extensions.register do
+  inline_macro @Utility@::Documentation::Link@Utility@Processor, :link@utility@
+end
--- a/Documentation/daxctl/Makefile.am
+++ b/Documentation/daxctl/Makefile.am
@@ -9,11 +9,28 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
 
+if USE_ASCIIDOCTOR
+
+do_subst = sed -e 's,@Utility@,Daxctl,g' -e's,@utility@,daxctl,g'
+do_asciidoc = $(ASCIIDOC) -acompat-mode \
+   -amansource=daxctl -amanmanual="daxctl Manual"
+
+XMLTO += --skip-validation
+CONFFILE = asciidoctor-extensions.rb
+asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in
+   $(AM_V_GEN) $(do_subst) < $< > $@
+
+else
+
 do_subst = sed -e 's,UTILITY,daxctl,g'
+do_asciidoc = $(ASCIIDOC) -f asciidoc.conf --unsafe
 
+CONFFILE = asciidoc.conf
 asciidoc.conf: ../asciidoc.conf.in
$(AM_V_GEN) $(do_subst) < $< > $@
 
+endif
+
 man1_MANS = \
daxctl.1 \
daxctl-list.1 \
@@ -24,14 +41,14 @@ CLEANFILES = $(man1_MANS)
 XML_DEPS = \
../../version.m4 \
Makefile \
-   asciidoc.conf
+   $(CONFFILE)
 
 RM ?= rm -f
 
 %.xml: %.txt $(XML_DEPS)
$(AM_V_GEN)$(RM) $@+ $@ && \
-   $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-   --unsafe -adaxctl_version=$(VERSION) -o $@+ $< && \
+   $(do_asciidoc) -b docbook -d manpage \
+   -adaxctl_version=$(VERSION) -o $@+ $< && \
mv $@+ $@
 
 %.1: %.xml
--- a/Documentation/ndctl/Makefile.am
+++ b/Documentation/ndctl/Makefile.am
@@ -9,11 +9,28 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
 
+if USE_ASCIIDOCTOR
+
+do_subst = sed -e 's,@Utility@,Ndctl,g' -e's,@utility@,ndctl,g'
+do_asciidoc = $(ASCIIDOC) -acompat-mode \
+   -amansource=ndctl -amanmanual="ndctl Manual"
+
+XMLTO += --skip-validation
+CONFFILE = asciidoctor-extensions.rb
+asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in
+   $(AM_V_GEN) $(do_subst) < $< > $@
+
+else
+
 do_subst = sed -e 's,UTILITY,ndctl,g'
+do_asciidoc = $(ASCIIDOC) -f asciidoc.conf --unsafe
 
+CONFFILE = asciidoc.conf
 asciidoc.conf: ../asciidoc.conf.in
$(AM_V_GEN) $(do_subst) < $< > $@
 
+endif
+
 man1_MANS = \
ndctl.1 \
ndctl-zero-labels.1 \
@@ -39,7 +56,7 @@ CLEANFILES = $(man1_MANS)
 XML_DEPS = \
../../version.m4 \
Makefile \
-   asciidoc.conf \
+   $(CONFFILE) \
region-description.txt \
xable-region-options.txt \
dimm-description.txt \
@@ -52,8 +69,8 @@ RM ?= rm -f
 
 %.xml: %.txt $(XML_DEPS)
$(AM_V_GEN)$(RM) $@+ $@ && \
-   $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-   --unsafe -andctl_version=$(VERSION) -o $@+ $< && \
+   $(ASCIIDOC) -b docbook -d manpage \
+   -andctl_version=$(VERSION) -o $@+ $< && \
mv $@+ $@
 
 %.1: %.xml
--- a/configure.ac
+++ b/configure.ac
@@ -42,9 +42,19 @@ AS_IF([test "x$enable_docs" = "xyes"], [
 ])
 AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" = "xyes"])
 
-AC_CHECK_PROG(ASCIIDOC, [asciidoc], [$(which asciidoc)], [missing])
+AC_ARG_ENABLE([asciidoctor],
+   AS_HELP_STRING([--enable-asciidoctor],
+   [use asciidoctor for documentation build]),
+   [], enable_asciidoctor=no)
+AM_CONDITIONAL([USE_ASCIIDOCTOR], [test "x$enable_asciidoctor" = "xyes"])
+if test "x$enable_asciidoctor"