All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnvdimm: clean up command definitions
@ 2017-08-28 15:45 ` Dan Williams
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-28 15:45 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Yasunori Goto, linux-kernel

Remove the command payloads that do not have an associated libnvdimm
ioctl. I.e. remove the payloads that would only ever be carried in the
ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
dependencies on this kernel header when userspace already has everything
it needs to craft and send these commands.

Cc: Jerry Hoemann <jerry.hoemann@hpe.com>
Reported-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 include/uapi/linux/ndctl.h |   37 -------------------------------------
 1 file changed, 37 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 6d3c54264d8e..3f03567631cb 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
 	__u64 cleared;
 } __packed;
 
-struct nd_cmd_trans_spa {
-	__u64 spa;
-	__u32 status;
-	__u8  flags;
-	__u8  _reserved[3];
-	__u64 trans_length;
-	__u32 num_nvdimms;
-	struct nd_nvdimm_device {
-		__u32 nfit_device_handle;
-		__u32 _reserved;
-		__u64 dpa;
-	} __packed devices[0];
-
-} __packed;
-
-struct nd_cmd_ars_err_inj {
-	__u64 err_inj_spa_range_base;
-	__u64 err_inj_spa_range_length;
-	__u8  err_inj_options;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_clr {
-	__u64 err_inj_clr_spa_range_base;
-	__u64 err_inj_clr_spa_range_length;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_stat {
-	__u32 status;
-	__u32 inj_err_rec_count;
-	struct nd_error_stat_query_record {
-		__u64 err_inj_stat_spa_range_base;
-		__u64 err_inj_stat_spa_range_length;
-	} __packed record[0];
-} __packed;
-
 enum {
 	ND_CMD_IMPLEMENTED = 0,
 

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] libnvdimm: clean up command definitions
@ 2017-08-28 15:45 ` Dan Williams
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-28 15:45 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Yasunori Goto, Jerry Hoemann, linux-kernel

Remove the command payloads that do not have an associated libnvdimm
ioctl. I.e. remove the payloads that would only ever be carried in the
ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
dependencies on this kernel header when userspace already has everything
it needs to craft and send these commands.

Cc: Jerry Hoemann <jerry.hoemann@hpe.com>
Reported-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 include/uapi/linux/ndctl.h |   37 -------------------------------------
 1 file changed, 37 deletions(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 6d3c54264d8e..3f03567631cb 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
 	__u64 cleared;
 } __packed;
 
-struct nd_cmd_trans_spa {
-	__u64 spa;
-	__u32 status;
-	__u8  flags;
-	__u8  _reserved[3];
-	__u64 trans_length;
-	__u32 num_nvdimms;
-	struct nd_nvdimm_device {
-		__u32 nfit_device_handle;
-		__u32 _reserved;
-		__u64 dpa;
-	} __packed devices[0];
-
-} __packed;
-
-struct nd_cmd_ars_err_inj {
-	__u64 err_inj_spa_range_base;
-	__u64 err_inj_spa_range_length;
-	__u8  err_inj_options;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_clr {
-	__u64 err_inj_clr_spa_range_base;
-	__u64 err_inj_clr_spa_range_length;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_stat {
-	__u32 status;
-	__u32 inj_err_rec_count;
-	struct nd_error_stat_query_record {
-		__u64 err_inj_stat_spa_range_base;
-		__u64 err_inj_stat_spa_range_length;
-	} __packed record[0];
-} __packed;
-
 enum {
 	ND_CMD_IMPLEMENTED = 0,
 

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-28 15:45 ` Dan Williams
@ 2017-08-28 20:50   ` Jerry Hoemann
  -1 siblings, 0 replies; 16+ messages in thread
From: Jerry Hoemann @ 2017-08-28 20:50 UTC (permalink / raw)
  To: Dan Williams; +Cc: Yasunori Goto, linux-kernel, linux-nvdimm


On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> Remove the command payloads that do not have an associated libnvdimm
> ioctl. I.e. remove the payloads that would only ever be carried in the
> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> dependencies on this kernel header when userspace already has everything
> it needs to craft and send these commands.

Userspace needs to include linux/ndctl.h to make the call as
that is where nd_cmd_pkg is defined.

So you want to have some structures defined in ndctl.h and other
defined in the to be created libndctl-nfit.h?  Plus a third header
file for the HPE non-root calls?

Will libndctl-nfit.h be generally available and installed?
Will it be clean so that other applications can use it to get these
definitions?  Or will it be loaded w/ a bunch of stuff only useful
to your ndctl command?


> 
> Cc: Jerry Hoemann <jerry.hoemann@hpe.com>
> Reported-by: Yasunori Goto <y-goto@jp.fujitsu.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  include/uapi/linux/ndctl.h |   37 -------------------------------------
>  1 file changed, 37 deletions(-)
> 
> diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
> index 6d3c54264d8e..3f03567631cb 100644
> --- a/include/uapi/linux/ndctl.h
> +++ b/include/uapi/linux/ndctl.h
> @@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
>  	__u64 cleared;
>  } __packed;
>  
> -struct nd_cmd_trans_spa {
> -	__u64 spa;
> -	__u32 status;
> -	__u8  flags;
> -	__u8  _reserved[3];
> -	__u64 trans_length;
> -	__u32 num_nvdimms;
> -	struct nd_nvdimm_device {
> -		__u32 nfit_device_handle;
> -		__u32 _reserved;
> -		__u64 dpa;
> -	} __packed devices[0];
> -
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj {
> -	__u64 err_inj_spa_range_base;
> -	__u64 err_inj_spa_range_length;
> -	__u8  err_inj_options;
> -	__u32 status;
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj_clr {
> -	__u64 err_inj_clr_spa_range_base;
> -	__u64 err_inj_clr_spa_range_length;
> -	__u32 status;
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj_stat {
> -	__u32 status;
> -	__u32 inj_err_rec_count;
> -	struct nd_error_stat_query_record {
> -		__u64 err_inj_stat_spa_range_base;
> -		__u64 err_inj_stat_spa_range_length;
> -	} __packed record[0];
> -} __packed;
> -
>  enum {
>  	ND_CMD_IMPLEMENTED = 0,
>  

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-28 20:50   ` Jerry Hoemann
  0 siblings, 0 replies; 16+ messages in thread
From: Jerry Hoemann @ 2017-08-28 20:50 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm, Yasunori Goto, linux-kernel


On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> Remove the command payloads that do not have an associated libnvdimm
> ioctl. I.e. remove the payloads that would only ever be carried in the
> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> dependencies on this kernel header when userspace already has everything
> it needs to craft and send these commands.

Userspace needs to include linux/ndctl.h to make the call as
that is where nd_cmd_pkg is defined.

So you want to have some structures defined in ndctl.h and other
defined in the to be created libndctl-nfit.h?  Plus a third header
file for the HPE non-root calls?

Will libndctl-nfit.h be generally available and installed?
Will it be clean so that other applications can use it to get these
definitions?  Or will it be loaded w/ a bunch of stuff only useful
to your ndctl command?


> 
> Cc: Jerry Hoemann <jerry.hoemann@hpe.com>
> Reported-by: Yasunori Goto <y-goto@jp.fujitsu.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  include/uapi/linux/ndctl.h |   37 -------------------------------------
>  1 file changed, 37 deletions(-)
> 
> diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
> index 6d3c54264d8e..3f03567631cb 100644
> --- a/include/uapi/linux/ndctl.h
> +++ b/include/uapi/linux/ndctl.h
> @@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
>  	__u64 cleared;
>  } __packed;
>  
> -struct nd_cmd_trans_spa {
> -	__u64 spa;
> -	__u32 status;
> -	__u8  flags;
> -	__u8  _reserved[3];
> -	__u64 trans_length;
> -	__u32 num_nvdimms;
> -	struct nd_nvdimm_device {
> -		__u32 nfit_device_handle;
> -		__u32 _reserved;
> -		__u64 dpa;
> -	} __packed devices[0];
> -
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj {
> -	__u64 err_inj_spa_range_base;
> -	__u64 err_inj_spa_range_length;
> -	__u8  err_inj_options;
> -	__u32 status;
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj_clr {
> -	__u64 err_inj_clr_spa_range_base;
> -	__u64 err_inj_clr_spa_range_length;
> -	__u32 status;
> -} __packed;
> -
> -struct nd_cmd_ars_err_inj_stat {
> -	__u32 status;
> -	__u32 inj_err_rec_count;
> -	struct nd_error_stat_query_record {
> -		__u64 err_inj_stat_spa_range_base;
> -		__u64 err_inj_stat_spa_range_length;
> -	} __packed record[0];
> -} __packed;
> -
>  enum {
>  	ND_CMD_IMPLEMENTED = 0,
>  

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-28 20:50   ` Jerry Hoemann
@ 2017-08-28 21:06     ` Dan Williams
  -1 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-28 21:06 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: Yasunori Goto, linux-kernel, linux-nvdimm

On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>
> On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> Remove the command payloads that do not have an associated libnvdimm
>> ioctl. I.e. remove the payloads that would only ever be carried in the
>> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> dependencies on this kernel header when userspace already has everything
>> it needs to craft and send these commands.
>
> Userspace needs to include linux/ndctl.h to make the call as
> that is where nd_cmd_pkg is defined.
>
> So you want to have some structures defined in ndctl.h and other
> defined in the to be created libndctl-nfit.h?  Plus a third header
> file for the HPE non-root calls?

Yes. ndctl.h exports the ioctl command payloads, everything that goes
inside of ND_CMD_CALL is defined by userspace headers. The
libndctl-nfit.h header is proposed as a place to land vendor agnostic
NFIT-defined payloads, and any vendor specific definitions would
remain internal to libndctl as they are today.

> Will libndctl-nfit.h be generally available and installed?

Yes, that's the plan.

> Will it be clean so that other applications can use it to get these
> definitions?  Or will it be loaded w/ a bunch of stuff only useful
> to your ndctl command?

Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
clean for issuing the NFIT root device commands via some ND_CMD_CALL
helpers from the base libndctl library.

In other words libndctl-nfit.h defines the payload and libndctl
defines some general helpers for issuing commands.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-28 21:06     ` Dan Williams
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-28 21:06 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, Yasunori Goto, linux-kernel

On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>
> On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> Remove the command payloads that do not have an associated libnvdimm
>> ioctl. I.e. remove the payloads that would only ever be carried in the
>> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> dependencies on this kernel header when userspace already has everything
>> it needs to craft and send these commands.
>
> Userspace needs to include linux/ndctl.h to make the call as
> that is where nd_cmd_pkg is defined.
>
> So you want to have some structures defined in ndctl.h and other
> defined in the to be created libndctl-nfit.h?  Plus a third header
> file for the HPE non-root calls?

Yes. ndctl.h exports the ioctl command payloads, everything that goes
inside of ND_CMD_CALL is defined by userspace headers. The
libndctl-nfit.h header is proposed as a place to land vendor agnostic
NFIT-defined payloads, and any vendor specific definitions would
remain internal to libndctl as they are today.

> Will libndctl-nfit.h be generally available and installed?

Yes, that's the plan.

> Will it be clean so that other applications can use it to get these
> definitions?  Or will it be loaded w/ a bunch of stuff only useful
> to your ndctl command?

Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
clean for issuing the NFIT root device commands via some ND_CMD_CALL
helpers from the base libndctl library.

In other words libndctl-nfit.h defines the payload and libndctl
defines some general helpers for issuing commands.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-28 21:06     ` Dan Williams
@ 2017-08-29  1:03       ` Yasunori Goto
  -1 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-29  1:03 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-nvdimm

> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >
> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> Remove the command payloads that do not have an associated libnvdimm
> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> dependencies on this kernel header when userspace already has everything
> >> it needs to craft and send these commands.
> >
> > Userspace needs to include linux/ndctl.h to make the call as
> > that is where nd_cmd_pkg is defined.
> >
> > So you want to have some structures defined in ndctl.h and other
> > defined in the to be created libndctl-nfit.h?  Plus a third header
> > file for the HPE non-root calls?
> 
> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> inside of ND_CMD_CALL is defined by userspace headers. The
> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> NFIT-defined payloads, and any vendor specific definitions would
> remain internal to libndctl as they are today.
> 
> > Will libndctl-nfit.h be generally available and installed?
> 
> Yes, that's the plan.
> 
> > Will it be clean so that other applications can use it to get these
> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> > to your ndctl command?
> 
> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> helpers from the base libndctl library.
> 
> In other words libndctl-nfit.h defines the payload and libndctl
> defines some general helpers for issuing commands.

Maybe I don't understand your idea yet, let me confirm it.

Certainly, current acpi driver does not need these definitions.
But, I think nfit_test.ko will need them to emulate these features.

Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
directory?
Otherwise, it should be defined at "tools/testing/nvdimm/" or 
"tools/testing/nvdimm/test" ?

Thanks,
---
Yasunori Goto


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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-29  1:03       ` Yasunori Goto
  0 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-29  1:03 UTC (permalink / raw)
  To: Dan Williams; +Cc: Jerry Hoemann, linux-nvdimm, linux-kernel

> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >
> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> Remove the command payloads that do not have an associated libnvdimm
> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> dependencies on this kernel header when userspace already has everything
> >> it needs to craft and send these commands.
> >
> > Userspace needs to include linux/ndctl.h to make the call as
> > that is where nd_cmd_pkg is defined.
> >
> > So you want to have some structures defined in ndctl.h and other
> > defined in the to be created libndctl-nfit.h?  Plus a third header
> > file for the HPE non-root calls?
> 
> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> inside of ND_CMD_CALL is defined by userspace headers. The
> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> NFIT-defined payloads, and any vendor specific definitions would
> remain internal to libndctl as they are today.
> 
> > Will libndctl-nfit.h be generally available and installed?
> 
> Yes, that's the plan.
> 
> > Will it be clean so that other applications can use it to get these
> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> > to your ndctl command?
> 
> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> helpers from the base libndctl library.
> 
> In other words libndctl-nfit.h defines the payload and libndctl
> defines some general helpers for issuing commands.

Maybe I don't understand your idea yet, let me confirm it.

Certainly, current acpi driver does not need these definitions.
But, I think nfit_test.ko will need them to emulate these features.

Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
directory?
Otherwise, it should be defined at "tools/testing/nvdimm/" or 
"tools/testing/nvdimm/test" ?

Thanks,
---
Yasunori Goto

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-29  1:03       ` Yasunori Goto
@ 2017-08-29  3:22         ` Dan Williams
  -1 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-29  3:22 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: linux-kernel, linux-nvdimm

On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> >
>> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> >> Remove the command payloads that do not have an associated libnvdimm
>> >> ioctl. I.e. remove the payloads that would only ever be carried in the
>> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> >> dependencies on this kernel header when userspace already has everything
>> >> it needs to craft and send these commands.
>> >
>> > Userspace needs to include linux/ndctl.h to make the call as
>> > that is where nd_cmd_pkg is defined.
>> >
>> > So you want to have some structures defined in ndctl.h and other
>> > defined in the to be created libndctl-nfit.h?  Plus a third header
>> > file for the HPE non-root calls?
>>
>> Yes. ndctl.h exports the ioctl command payloads, everything that goes
>> inside of ND_CMD_CALL is defined by userspace headers. The
>> libndctl-nfit.h header is proposed as a place to land vendor agnostic
>> NFIT-defined payloads, and any vendor specific definitions would
>> remain internal to libndctl as they are today.
>>
>> > Will libndctl-nfit.h be generally available and installed?
>>
>> Yes, that's the plan.
>>
>> > Will it be clean so that other applications can use it to get these
>> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
>> > to your ndctl command?
>>
>> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
>> clean for issuing the NFIT root device commands via some ND_CMD_CALL
>> helpers from the base libndctl library.
>>
>> In other words libndctl-nfit.h defines the payload and libndctl
>> defines some general helpers for issuing commands.
>
> Maybe I don't understand your idea yet, let me confirm it.
>
> Certainly, current acpi driver does not need these definitions.
> But, I think nfit_test.ko will need them to emulate these features.
>
> Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> directory?
> Otherwise, it should be defined at "tools/testing/nvdimm/" or
> "tools/testing/nvdimm/test" ?

nfit_test will need its own internal / private copy of these payloads
in tools/testing/nvdimm/test so it can emulate how the bios behaves.
The include/uapi/linux directory is for user to kernel interface
definitions and these command payloads are purely an interface to bios
/ firmware.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-29  3:22         ` Dan Williams
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-29  3:22 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: Jerry Hoemann, linux-nvdimm, linux-kernel

On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> >
>> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> >> Remove the command payloads that do not have an associated libnvdimm
>> >> ioctl. I.e. remove the payloads that would only ever be carried in the
>> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> >> dependencies on this kernel header when userspace already has everything
>> >> it needs to craft and send these commands.
>> >
>> > Userspace needs to include linux/ndctl.h to make the call as
>> > that is where nd_cmd_pkg is defined.
>> >
>> > So you want to have some structures defined in ndctl.h and other
>> > defined in the to be created libndctl-nfit.h?  Plus a third header
>> > file for the HPE non-root calls?
>>
>> Yes. ndctl.h exports the ioctl command payloads, everything that goes
>> inside of ND_CMD_CALL is defined by userspace headers. The
>> libndctl-nfit.h header is proposed as a place to land vendor agnostic
>> NFIT-defined payloads, and any vendor specific definitions would
>> remain internal to libndctl as they are today.
>>
>> > Will libndctl-nfit.h be generally available and installed?
>>
>> Yes, that's the plan.
>>
>> > Will it be clean so that other applications can use it to get these
>> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
>> > to your ndctl command?
>>
>> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
>> clean for issuing the NFIT root device commands via some ND_CMD_CALL
>> helpers from the base libndctl library.
>>
>> In other words libndctl-nfit.h defines the payload and libndctl
>> defines some general helpers for issuing commands.
>
> Maybe I don't understand your idea yet, let me confirm it.
>
> Certainly, current acpi driver does not need these definitions.
> But, I think nfit_test.ko will need them to emulate these features.
>
> Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> directory?
> Otherwise, it should be defined at "tools/testing/nvdimm/" or
> "tools/testing/nvdimm/test" ?

nfit_test will need its own internal / private copy of these payloads
in tools/testing/nvdimm/test so it can emulate how the bios behaves.
The include/uapi/linux directory is for user to kernel interface
definitions and these command payloads are purely an interface to bios
/ firmware.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-29  3:22         ` Dan Williams
@ 2017-08-29 10:09           ` Yasunori Goto
  -1 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-29 10:09 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-nvdimm

> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >> >
> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> >> Remove the command payloads that do not have an associated libnvdimm
> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> >> dependencies on this kernel header when userspace already has everything
> >> >> it needs to craft and send these commands.
> >> >
> >> > Userspace needs to include linux/ndctl.h to make the call as
> >> > that is where nd_cmd_pkg is defined.
> >> >
> >> > So you want to have some structures defined in ndctl.h and other
> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
> >> > file for the HPE non-root calls?
> >>
> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> >> inside of ND_CMD_CALL is defined by userspace headers. The
> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> >> NFIT-defined payloads, and any vendor specific definitions would
> >> remain internal to libndctl as they are today.
> >>
> >> > Will libndctl-nfit.h be generally available and installed?
> >>
> >> Yes, that's the plan.
> >>
> >> > Will it be clean so that other applications can use it to get these
> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> >> > to your ndctl command?
> >>
> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> >> helpers from the base libndctl library.
> >>
> >> In other words libndctl-nfit.h defines the payload and libndctl
> >> defines some general helpers for issuing commands.
> >
> > Maybe I don't understand your idea yet, let me confirm it.
> >
> > Certainly, current acpi driver does not need these definitions.
> > But, I think nfit_test.ko will need them to emulate these features.
> >
> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> > directory?
> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
> > "tools/testing/nvdimm/test" ?
> 
> nfit_test will need its own internal / private copy of these payloads
> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
> The include/uapi/linux directory is for user to kernel interface
> definitions and these command payloads are purely an interface to bios
> / firmware.
> 

Hmm,

I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.

But I noticed that drivers/acpi/nfit/core.c still uses the definition
in acpi_nfit_init_dsms().

----
static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
{
        struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
        const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);

        :

        dsm_mask =
                (1 << ND_CMD_ARS_CAP) |
                (1 << ND_CMD_ARS_START) |
                (1 << ND_CMD_ARS_STATUS) |
                (1 << ND_CMD_CLEAR_ERROR) |
                (1 << NFIT_CMD_TRANSLATE_SPA) |
                (1 << NFIT_CMD_ARS_INJECT_SET) |
                (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
                (1 << NFIT_CMD_ARS_INJECT_GET);
        for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
                if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
                        set_bit(i, &nd_desc->bus_dsm_mask);
---

Though it seems to be necessary yet,
do you have any idea to remove it?

Bye,



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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-29 10:09           ` Yasunori Goto
  0 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-29 10:09 UTC (permalink / raw)
  To: Dan Williams; +Cc: Jerry Hoemann, linux-nvdimm, linux-kernel

> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >> >
> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> >> Remove the command payloads that do not have an associated libnvdimm
> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> >> dependencies on this kernel header when userspace already has everything
> >> >> it needs to craft and send these commands.
> >> >
> >> > Userspace needs to include linux/ndctl.h to make the call as
> >> > that is where nd_cmd_pkg is defined.
> >> >
> >> > So you want to have some structures defined in ndctl.h and other
> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
> >> > file for the HPE non-root calls?
> >>
> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> >> inside of ND_CMD_CALL is defined by userspace headers. The
> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> >> NFIT-defined payloads, and any vendor specific definitions would
> >> remain internal to libndctl as they are today.
> >>
> >> > Will libndctl-nfit.h be generally available and installed?
> >>
> >> Yes, that's the plan.
> >>
> >> > Will it be clean so that other applications can use it to get these
> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> >> > to your ndctl command?
> >>
> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> >> helpers from the base libndctl library.
> >>
> >> In other words libndctl-nfit.h defines the payload and libndctl
> >> defines some general helpers for issuing commands.
> >
> > Maybe I don't understand your idea yet, let me confirm it.
> >
> > Certainly, current acpi driver does not need these definitions.
> > But, I think nfit_test.ko will need them to emulate these features.
> >
> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> > directory?
> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
> > "tools/testing/nvdimm/test" ?
> 
> nfit_test will need its own internal / private copy of these payloads
> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
> The include/uapi/linux directory is for user to kernel interface
> definitions and these command payloads are purely an interface to bios
> / firmware.
> 

Hmm,

I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.

But I noticed that drivers/acpi/nfit/core.c still uses the definition
in acpi_nfit_init_dsms().

----
static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
{
        struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
        const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);

        :

        dsm_mask =
                (1 << ND_CMD_ARS_CAP) |
                (1 << ND_CMD_ARS_START) |
                (1 << ND_CMD_ARS_STATUS) |
                (1 << ND_CMD_CLEAR_ERROR) |
                (1 << NFIT_CMD_TRANSLATE_SPA) |
                (1 << NFIT_CMD_ARS_INJECT_SET) |
                (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
                (1 << NFIT_CMD_ARS_INJECT_GET);
        for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
                if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
                        set_bit(i, &nd_desc->bus_dsm_mask);
---

Though it seems to be necessary yet,
do you have any idea to remove it?

Bye,

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-29 10:09           ` Yasunori Goto
@ 2017-08-29 16:26             ` Dan Williams
  -1 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-29 16:26 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: linux-kernel, linux-nvdimm

On Tue, Aug 29, 2017 at 3:09 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> >> >
>> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> >> >> Remove the command payloads that do not have an associated libnvdimm
>> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
>> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> >> >> dependencies on this kernel header when userspace already has everything
>> >> >> it needs to craft and send these commands.
>> >> >
>> >> > Userspace needs to include linux/ndctl.h to make the call as
>> >> > that is where nd_cmd_pkg is defined.
>> >> >
>> >> > So you want to have some structures defined in ndctl.h and other
>> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
>> >> > file for the HPE non-root calls?
>> >>
>> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
>> >> inside of ND_CMD_CALL is defined by userspace headers. The
>> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
>> >> NFIT-defined payloads, and any vendor specific definitions would
>> >> remain internal to libndctl as they are today.
>> >>
>> >> > Will libndctl-nfit.h be generally available and installed?
>> >>
>> >> Yes, that's the plan.
>> >>
>> >> > Will it be clean so that other applications can use it to get these
>> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
>> >> > to your ndctl command?
>> >>
>> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
>> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
>> >> helpers from the base libndctl library.
>> >>
>> >> In other words libndctl-nfit.h defines the payload and libndctl
>> >> defines some general helpers for issuing commands.
>> >
>> > Maybe I don't understand your idea yet, let me confirm it.
>> >
>> > Certainly, current acpi driver does not need these definitions.
>> > But, I think nfit_test.ko will need them to emulate these features.
>> >
>> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
>> > directory?
>> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
>> > "tools/testing/nvdimm/test" ?
>>
>> nfit_test will need its own internal / private copy of these payloads
>> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
>> The include/uapi/linux directory is for user to kernel interface
>> definitions and these command payloads are purely an interface to bios
>> / firmware.
>>
>
> Hmm,
>
> I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
> and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.
>
> But I noticed that drivers/acpi/nfit/core.c still uses the definition
> in acpi_nfit_init_dsms().
>
> ----
> static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
> {
>         struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
>         const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);
>
>         :
>
>         dsm_mask =
>                 (1 << ND_CMD_ARS_CAP) |
>                 (1 << ND_CMD_ARS_START) |
>                 (1 << ND_CMD_ARS_STATUS) |
>                 (1 << ND_CMD_CLEAR_ERROR) |
>                 (1 << NFIT_CMD_TRANSLATE_SPA) |
>                 (1 << NFIT_CMD_ARS_INJECT_SET) |
>                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
>                 (1 << NFIT_CMD_ARS_INJECT_GET);
>         for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
>                 if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
>                         set_bit(i, &nd_desc->bus_dsm_mask);
> ---
>
> Though it seems to be necessary yet,
> do you have any idea to remove it?

Here's the end state I'm looking for...

1/ drivers/acpi/nfit/core.c keeps its current definitions of the
NFIT_CMD_ numbers since it needs to validate the DSM command number
mask

2/ tools/testing/nvdimm/test/nfit.h grows private definitions of only
the command payloads that it emulates

3/ ndctl in userspace grows a new ndctl/libndctl-nfit.h with all the
payloads defined in ACPI. Ideally we can deprecate all the payload
definitions in ndctl.h and only use the ND_CMD_CALL ioctl plus the
ndctl/libndctl-nfit.h definitions. Although, since label reading has
moved away from DSMs we'll always need the separate
ND_CMD_{GET,SET}_CONFIG_DATA ioctls. The libndctl-nfit.h header should
be listed in pkginclude_HEADERS.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-29 16:26             ` Dan Williams
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2017-08-29 16:26 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: Jerry Hoemann, linux-nvdimm, linux-kernel

On Tue, Aug 29, 2017 at 3:09 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> >> >
>> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
>> >> >> Remove the command payloads that do not have an associated libnvdimm
>> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
>> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
>> >> >> dependencies on this kernel header when userspace already has everything
>> >> >> it needs to craft and send these commands.
>> >> >
>> >> > Userspace needs to include linux/ndctl.h to make the call as
>> >> > that is where nd_cmd_pkg is defined.
>> >> >
>> >> > So you want to have some structures defined in ndctl.h and other
>> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
>> >> > file for the HPE non-root calls?
>> >>
>> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
>> >> inside of ND_CMD_CALL is defined by userspace headers. The
>> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
>> >> NFIT-defined payloads, and any vendor specific definitions would
>> >> remain internal to libndctl as they are today.
>> >>
>> >> > Will libndctl-nfit.h be generally available and installed?
>> >>
>> >> Yes, that's the plan.
>> >>
>> >> > Will it be clean so that other applications can use it to get these
>> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
>> >> > to your ndctl command?
>> >>
>> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
>> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
>> >> helpers from the base libndctl library.
>> >>
>> >> In other words libndctl-nfit.h defines the payload and libndctl
>> >> defines some general helpers for issuing commands.
>> >
>> > Maybe I don't understand your idea yet, let me confirm it.
>> >
>> > Certainly, current acpi driver does not need these definitions.
>> > But, I think nfit_test.ko will need them to emulate these features.
>> >
>> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
>> > directory?
>> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
>> > "tools/testing/nvdimm/test" ?
>>
>> nfit_test will need its own internal / private copy of these payloads
>> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
>> The include/uapi/linux directory is for user to kernel interface
>> definitions and these command payloads are purely an interface to bios
>> / firmware.
>>
>
> Hmm,
>
> I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
> and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.
>
> But I noticed that drivers/acpi/nfit/core.c still uses the definition
> in acpi_nfit_init_dsms().
>
> ----
> static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
> {
>         struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
>         const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);
>
>         :
>
>         dsm_mask =
>                 (1 << ND_CMD_ARS_CAP) |
>                 (1 << ND_CMD_ARS_START) |
>                 (1 << ND_CMD_ARS_STATUS) |
>                 (1 << ND_CMD_CLEAR_ERROR) |
>                 (1 << NFIT_CMD_TRANSLATE_SPA) |
>                 (1 << NFIT_CMD_ARS_INJECT_SET) |
>                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
>                 (1 << NFIT_CMD_ARS_INJECT_GET);
>         for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
>                 if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
>                         set_bit(i, &nd_desc->bus_dsm_mask);
> ---
>
> Though it seems to be necessary yet,
> do you have any idea to remove it?

Here's the end state I'm looking for...

1/ drivers/acpi/nfit/core.c keeps its current definitions of the
NFIT_CMD_ numbers since it needs to validate the DSM command number
mask

2/ tools/testing/nvdimm/test/nfit.h grows private definitions of only
the command payloads that it emulates

3/ ndctl in userspace grows a new ndctl/libndctl-nfit.h with all the
payloads defined in ACPI. Ideally we can deprecate all the payload
definitions in ndctl.h and only use the ND_CMD_CALL ioctl plus the
ndctl/libndctl-nfit.h definitions. Although, since label reading has
moved away from DSMs we'll always need the separate
ND_CMD_{GET,SET}_CONFIG_DATA ioctls. The libndctl-nfit.h header should
be listed in pkginclude_HEADERS.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
  2017-08-29 16:26             ` Dan Williams
@ 2017-08-30  0:23               ` Yasunori Goto
  -1 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-30  0:23 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-nvdimm

> On Tue, Aug 29, 2017 at 3:09 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >> >> >
> >> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> >> >> Remove the command payloads that do not have an associated libnvdimm
> >> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> >> >> dependencies on this kernel header when userspace already has everything
> >> >> >> it needs to craft and send these commands.
> >> >> >
> >> >> > Userspace needs to include linux/ndctl.h to make the call as
> >> >> > that is where nd_cmd_pkg is defined.
> >> >> >
> >> >> > So you want to have some structures defined in ndctl.h and other
> >> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
> >> >> > file for the HPE non-root calls?
> >> >>
> >> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> >> >> inside of ND_CMD_CALL is defined by userspace headers. The
> >> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> >> >> NFIT-defined payloads, and any vendor specific definitions would
> >> >> remain internal to libndctl as they are today.
> >> >>
> >> >> > Will libndctl-nfit.h be generally available and installed?
> >> >>
> >> >> Yes, that's the plan.
> >> >>
> >> >> > Will it be clean so that other applications can use it to get these
> >> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> >> >> > to your ndctl command?
> >> >>
> >> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> >> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> >> >> helpers from the base libndctl library.
> >> >>
> >> >> In other words libndctl-nfit.h defines the payload and libndctl
> >> >> defines some general helpers for issuing commands.
> >> >
> >> > Maybe I don't understand your idea yet, let me confirm it.
> >> >
> >> > Certainly, current acpi driver does not need these definitions.
> >> > But, I think nfit_test.ko will need them to emulate these features.
> >> >
> >> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> >> > directory?
> >> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
> >> > "tools/testing/nvdimm/test" ?
> >>
> >> nfit_test will need its own internal / private copy of these payloads
> >> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
> >> The include/uapi/linux directory is for user to kernel interface
> >> definitions and these command payloads are purely an interface to bios
> >> / firmware.
> >>
> >
> > Hmm,
> >
> > I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
> > and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.
> >
> > But I noticed that drivers/acpi/nfit/core.c still uses the definition
> > in acpi_nfit_init_dsms().
> >
> > ----
> > static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
> > {
> >         struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
> >         const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);
> >
> >         :
> >
> >         dsm_mask =
> >                 (1 << ND_CMD_ARS_CAP) |
> >                 (1 << ND_CMD_ARS_START) |
> >                 (1 << ND_CMD_ARS_STATUS) |
> >                 (1 << ND_CMD_CLEAR_ERROR) |
> >                 (1 << NFIT_CMD_TRANSLATE_SPA) |
> >                 (1 << NFIT_CMD_ARS_INJECT_SET) |
> >                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
> >                 (1 << NFIT_CMD_ARS_INJECT_GET);
> >         for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
> >                 if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
> >                         set_bit(i, &nd_desc->bus_dsm_mask);
> > ---
> >
> > Though it seems to be necessary yet,
> > do you have any idea to remove it?
> 
> Here's the end state I'm looking for...
> 
> 1/ drivers/acpi/nfit/core.c keeps its current definitions of the
> NFIT_CMD_ numbers since it needs to validate the DSM command number
> mask
> 
> 2/ tools/testing/nvdimm/test/nfit.h grows private definitions of only
> the command payloads that it emulates
> 
> 3/ ndctl in userspace grows a new ndctl/libndctl-nfit.h with all the
> payloads defined in ACPI. Ideally we can deprecate all the payload
> definitions in ndctl.h and only use the ND_CMD_CALL ioctl plus the
> ndctl/libndctl-nfit.h definitions. Although, since label reading has
> moved away from DSMs we'll always need the separate
> ND_CMD_{GET,SET}_CONFIG_DATA ioctls. The libndctl-nfit.h header should
> be listed in pkginclude_HEADERS.

Hmm, Ok. I'll try.

Thanks for your explanation.



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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libnvdimm: clean up command definitions
@ 2017-08-30  0:23               ` Yasunori Goto
  0 siblings, 0 replies; 16+ messages in thread
From: Yasunori Goto @ 2017-08-30  0:23 UTC (permalink / raw)
  To: Dan Williams; +Cc: Jerry Hoemann, linux-nvdimm, linux-kernel

> On Tue, Aug 29, 2017 at 3:09 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> On Mon, Aug 28, 2017 at 6:03 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >> >> On Mon, Aug 28, 2017 at 1:50 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >> >> >
> >> >> > On Mon, Aug 28, 2017 at 08:45:32AM -0700, Dan Williams wrote:
> >> >> >> Remove the command payloads that do not have an associated libnvdimm
> >> >> >> ioctl. I.e. remove the payloads that would only ever be carried in the
> >> >> >> ND_CMD_CALL envelope. This prevents userspace from growing unnecessary
> >> >> >> dependencies on this kernel header when userspace already has everything
> >> >> >> it needs to craft and send these commands.
> >> >> >
> >> >> > Userspace needs to include linux/ndctl.h to make the call as
> >> >> > that is where nd_cmd_pkg is defined.
> >> >> >
> >> >> > So you want to have some structures defined in ndctl.h and other
> >> >> > defined in the to be created libndctl-nfit.h?  Plus a third header
> >> >> > file for the HPE non-root calls?
> >> >>
> >> >> Yes. ndctl.h exports the ioctl command payloads, everything that goes
> >> >> inside of ND_CMD_CALL is defined by userspace headers. The
> >> >> libndctl-nfit.h header is proposed as a place to land vendor agnostic
> >> >> NFIT-defined payloads, and any vendor specific definitions would
> >> >> remain internal to libndctl as they are today.
> >> >>
> >> >> > Will libndctl-nfit.h be generally available and installed?
> >> >>
> >> >> Yes, that's the plan.
> >> >>
> >> >> > Will it be clean so that other applications can use it to get these
> >> >> > definitions?  Or will it be loaded w/ a bunch of stuff only useful
> >> >> > to your ndctl command?
> >> >>
> >> >> Yes, that's the plan. It's a bug if libndctl-nfit.h is not generically
> >> >> clean for issuing the NFIT root device commands via some ND_CMD_CALL
> >> >> helpers from the base libndctl library.
> >> >>
> >> >> In other words libndctl-nfit.h defines the payload and libndctl
> >> >> defines some general helpers for issuing commands.
> >> >
> >> > Maybe I don't understand your idea yet, let me confirm it.
> >> >
> >> > Certainly, current acpi driver does not need these definitions.
> >> > But, I think nfit_test.ko will need them to emulate these features.
> >> >
> >> > Do you intend that libndctl-nfit.h should be defined at "include/uapi/linux/"
> >> > directory?
> >> > Otherwise, it should be defined at "tools/testing/nvdimm/" or
> >> > "tools/testing/nvdimm/test" ?
> >>
> >> nfit_test will need its own internal / private copy of these payloads
> >> in tools/testing/nvdimm/test so it can emulate how the bios behaves.
> >> The include/uapi/linux directory is for user to kernel interface
> >> definitions and these command payloads are purely an interface to bios
> >> / firmware.
> >>
> >
> > Hmm,
> >
> > I'm trying to make libndctl-nfit.h under tools/testing/nvdimm/nfit/,
> > and trying to move NFIT_CMD_TRANSLATE_SPA from drivers/acpi/nfit/core.c to it.
> >
> > But I noticed that drivers/acpi/nfit/core.c still uses the definition
> > in acpi_nfit_init_dsms().
> >
> > ----
> > static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
> > {
> >         struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
> >         const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);
> >
> >         :
> >
> >         dsm_mask =
> >                 (1 << ND_CMD_ARS_CAP) |
> >                 (1 << ND_CMD_ARS_START) |
> >                 (1 << ND_CMD_ARS_STATUS) |
> >                 (1 << ND_CMD_CLEAR_ERROR) |
> >                 (1 << NFIT_CMD_TRANSLATE_SPA) |
> >                 (1 << NFIT_CMD_ARS_INJECT_SET) |
> >                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
> >                 (1 << NFIT_CMD_ARS_INJECT_GET);
> >         for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
> >                 if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
> >                         set_bit(i, &nd_desc->bus_dsm_mask);
> > ---
> >
> > Though it seems to be necessary yet,
> > do you have any idea to remove it?
> 
> Here's the end state I'm looking for...
> 
> 1/ drivers/acpi/nfit/core.c keeps its current definitions of the
> NFIT_CMD_ numbers since it needs to validate the DSM command number
> mask
> 
> 2/ tools/testing/nvdimm/test/nfit.h grows private definitions of only
> the command payloads that it emulates
> 
> 3/ ndctl in userspace grows a new ndctl/libndctl-nfit.h with all the
> payloads defined in ACPI. Ideally we can deprecate all the payload
> definitions in ndctl.h and only use the ND_CMD_CALL ioctl plus the
> ndctl/libndctl-nfit.h definitions. Although, since label reading has
> moved away from DSMs we'll always need the separate
> ND_CMD_{GET,SET}_CONFIG_DATA ioctls. The libndctl-nfit.h header should
> be listed in pkginclude_HEADERS.

Hmm, Ok. I'll try.

Thanks for your explanation.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-08-30  0:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 15:45 [PATCH] libnvdimm: clean up command definitions Dan Williams
2017-08-28 15:45 ` Dan Williams
2017-08-28 20:50 ` Jerry Hoemann
2017-08-28 20:50   ` Jerry Hoemann
2017-08-28 21:06   ` Dan Williams
2017-08-28 21:06     ` Dan Williams
2017-08-29  1:03     ` Yasunori Goto
2017-08-29  1:03       ` Yasunori Goto
2017-08-29  3:22       ` Dan Williams
2017-08-29  3:22         ` Dan Williams
2017-08-29 10:09         ` Yasunori Goto
2017-08-29 10:09           ` Yasunori Goto
2017-08-29 16:26           ` Dan Williams
2017-08-29 16:26             ` Dan Williams
2017-08-30  0:23             ` Yasunori Goto
2017-08-30  0:23               ` Yasunori Goto

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.