All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org, linux-mm@kvack.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 1/3] mm/nvdimm: Add PFN_MIN_VERSION support
Date: Wed, 22 May 2019 12:05:45 +0530	[thread overview]
Message-ID: <27bcf0e4-ba1d-2a7e-c181-ff60a9413bce@linux.ibm.com> (raw)
In-Reply-To: <20190522062057.26581-1-aneesh.kumar@linux.ibm.com>

On 5/22/19 11:50 AM, Aneesh Kumar K.V wrote:
> This allows us to make changes in a backward incompatible way. I have
> kept the PFN_MIN_VERSION in this patch '0' because we are not introducing
> any incompatible changes in this patch. We also may want to backport this
> to older kernels.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   drivers/nvdimm/pfn.h      |  9 ++++++++-
>   drivers/nvdimm/pfn_devs.c |  4 ++++
>   drivers/nvdimm/pmem.c     | 26 ++++++++++++++++++++++----
>   3 files changed, 34 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/nvdimm/pfn.h b/drivers/nvdimm/pfn.h
> index dde9853453d3..1b10ae5773b6 100644
> --- a/drivers/nvdimm/pfn.h
> +++ b/drivers/nvdimm/pfn.h
> @@ -20,6 +20,12 @@
>   #define PFN_SIG_LEN 16
>   #define PFN_SIG "NVDIMM_PFN_INFO\0"
>   #define DAX_SIG "NVDIMM_DAX_INFO\0"
> +/*
> + * increment this when we are making changes such that older
> + * kernel should fail to initialize that namespace.
> + */
> +
> +#define PFN_MIN_VERSION 0
>   
>   struct nd_pfn_sb {
>   	u8 signature[PFN_SIG_LEN];
> @@ -36,7 +42,8 @@ struct nd_pfn_sb {
>   	__le32 end_trunc;
>   	/* minor-version-2 record the base alignment of the mapping */
>   	__le32 align;
> -	u8 padding[4000];
> +	__le16 min_verison;
> +	u8 padding[3998];
>   	__le64 checksum;
>   };
>   
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 01f40672507f..3250de70a7b3 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -439,6 +439,9 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
>   	if (nvdimm_read_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0))
>   		return -ENXIO;
>   
> +	if (le16_to_cpu(pfn_sb->min_version > PFN_MIN_VERSION))
> +		return -EOPNOTSUPP;

+	if (le16_to_cpu(pfn_sb->min_version) > PFN_MIN_VERSION)
+		return -EOPNOTSUPP;



-aneesh

WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	linux-nvdimm@lists.01.org
Subject: Re: [RFC PATCH 1/3] mm/nvdimm: Add PFN_MIN_VERSION support
Date: Wed, 22 May 2019 12:05:45 +0530	[thread overview]
Message-ID: <27bcf0e4-ba1d-2a7e-c181-ff60a9413bce@linux.ibm.com> (raw)
In-Reply-To: <20190522062057.26581-1-aneesh.kumar@linux.ibm.com>

On 5/22/19 11:50 AM, Aneesh Kumar K.V wrote:
> This allows us to make changes in a backward incompatible way. I have
> kept the PFN_MIN_VERSION in this patch '0' because we are not introducing
> any incompatible changes in this patch. We also may want to backport this
> to older kernels.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   drivers/nvdimm/pfn.h      |  9 ++++++++-
>   drivers/nvdimm/pfn_devs.c |  4 ++++
>   drivers/nvdimm/pmem.c     | 26 ++++++++++++++++++++++----
>   3 files changed, 34 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/nvdimm/pfn.h b/drivers/nvdimm/pfn.h
> index dde9853453d3..1b10ae5773b6 100644
> --- a/drivers/nvdimm/pfn.h
> +++ b/drivers/nvdimm/pfn.h
> @@ -20,6 +20,12 @@
>   #define PFN_SIG_LEN 16
>   #define PFN_SIG "NVDIMM_PFN_INFO\0"
>   #define DAX_SIG "NVDIMM_DAX_INFO\0"
> +/*
> + * increment this when we are making changes such that older
> + * kernel should fail to initialize that namespace.
> + */
> +
> +#define PFN_MIN_VERSION 0
>   
>   struct nd_pfn_sb {
>   	u8 signature[PFN_SIG_LEN];
> @@ -36,7 +42,8 @@ struct nd_pfn_sb {
>   	__le32 end_trunc;
>   	/* minor-version-2 record the base alignment of the mapping */
>   	__le32 align;
> -	u8 padding[4000];
> +	__le16 min_verison;
> +	u8 padding[3998];
>   	__le64 checksum;
>   };
>   
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 01f40672507f..3250de70a7b3 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -439,6 +439,9 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
>   	if (nvdimm_read_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0))
>   		return -ENXIO;
>   
> +	if (le16_to_cpu(pfn_sb->min_version > PFN_MIN_VERSION))
> +		return -EOPNOTSUPP;

+	if (le16_to_cpu(pfn_sb->min_version) > PFN_MIN_VERSION)
+		return -EOPNOTSUPP;



-aneesh


  parent reply	other threads:[~2019-05-22  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  6:20 [RFC PATCH 1/3] mm/nvdimm: Add PFN_MIN_VERSION support Aneesh Kumar K.V
2019-05-22  6:20 ` Aneesh Kumar K.V
2019-05-22  6:20 ` [RFC PATCH 2/3] mm/nvdimm: Add page size and struct page size to pfn superblock Aneesh Kumar K.V
2019-05-22  6:20   ` Aneesh Kumar K.V
2019-05-22  6:20   ` Aneesh Kumar K.V
2019-05-22  6:20 ` [RFC PATCH 3/3] mm/nvdimm: Use correct #defines instead of opencoding Aneesh Kumar K.V
2019-05-22  6:20   ` Aneesh Kumar K.V
2019-05-22  6:35 ` Aneesh Kumar K.V [this message]
2019-05-22  6:35   ` [RFC PATCH 1/3] mm/nvdimm: Add PFN_MIN_VERSION support Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27bcf0e4-ba1d-2a7e-c181-ff60a9413bce@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.