All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Baoquan He <bhe@redhat.com>
Cc: kexec@lists.infradead.org, horms@verge.net.au, toshi.kani@hp.com
Subject: Re: [Patch v3] Add persistent memory support
Date: Wed, 19 Aug 2015 17:28:15 +0800	[thread overview]
Message-ID: <20150819092815.GB6130@localhost.localdomain> (raw)
In-Reply-To: <1439975029-25611-1-git-send-email-bhe@redhat.com>

Hi,

On 08/19/15 at 05:03pm, Baoquan He wrote:
> Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device.
> Now support them in kexec too.
> 
> Reported-by: Toshi Kani <toshi.kani@hp.com>
> Tested-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  include/x86/x86-linux.h            |  2 ++
>  kexec/arch/i386/crashdump-x86.c    | 15 ++++++++++++---
>  kexec/arch/i386/kexec-x86-common.c | 10 ++++++++++
>  kexec/arch/i386/x86-linux-setup.c  |  6 ++++++
>  kexec/firmware_memmap.c            |  4 ++++
>  kexec/kexec.h                      |  2 ++
>  6 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> index 50c7324..7834751 100644
> --- a/include/x86/x86-linux.h
> +++ b/include/x86/x86-linux.h
> @@ -21,6 +21,8 @@ struct e820entry {
>  #define E820_RESERVED	2
>  #define E820_ACPI	3 /* usable as RAM once ACPI tables have been read */
>  #define E820_NVS	4
> +#define E820_PMEM       7
> +#define E820_PRAM       12
>  } __attribute__((packed));
>  #endif
>  
> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> index 82bf239..598a78f 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -301,6 +301,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
>  			type = RANGE_ACPI;
>  		} else if(memcmp(str,"ACPI Non-volatile Storage\n",26) == 0 ) {
>  			type = RANGE_ACPI_NVS;
> +		} else if(memcmp(str,"Persistent Memory (legacy)\n",27) == 0 ) {
> +			type = RANGE_PRAM;
> +		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
> +			type = RANGE_PMEM;
>  		} else if(memcmp(str,"reserved\n",9) == 0 ) {
>  			type = RANGE_RESERVED;
>  		} else if (memcmp(str, "GART\n", 5) == 0) {
> @@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
>  		strcat (str_mmap, "K$");
>  	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
>  		strcat (str_mmap, "K#");
> +	else if (type == RANGE_PRAM)
> +		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things
in legacy memmap interface?

>  
>  	ultoa(startk, str_tmp);
>  	strcat (str_mmap, str_tmp);
> @@ -674,10 +680,11 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
>  		endk = (memmap_p[i].end + 1)/1024;
>  		type = memmap_p[i].type;
>  
> -		/* Only adding memory regions of RAM and ACPI */
> +		/* Only adding memory regions of RAM and ACPI and Persistent Mem */
>  		if (type != RANGE_RAM &&
>  		    type != RANGE_ACPI &&
> -		    type != RANGE_ACPI_NVS)
> +		    type != RANGE_ACPI_NVS &&
> +		    type != RANGE_PRAM)
>  			continue;
>  
>  		if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
> @@ -997,7 +1004,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
>  		unsigned long start, end, size, type;
>  		if ( !( mem_range[i].type == RANGE_ACPI
>  			|| mem_range[i].type == RANGE_ACPI_NVS
> -			|| mem_range[i].type == RANGE_RESERVED))
> +			|| mem_range[i].type == RANGE_RESERVED
> +			|| mem_range[i].type == RANGE_PMEM
> +			|| mem_range[i].type == RANGE_PRAM))
>  			continue;
>  		start = mem_range[i].start;
>  		end = mem_range[i].end;
> diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> index 3624192..28e5fc8 100644
> --- a/kexec/arch/i386/kexec-x86-common.c
> +++ b/kexec/arch/i386/kexec-x86-common.c
> @@ -94,6 +94,12 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
>  		else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) {
>  			type = RANGE_ACPI_NVS;
>  		}
> +		else if (memcmp(str, "Persistent Memory (legacy)\n", 27) == 0) {
> +			type = RANGE_PRAM;
> +		}
> +		else if (memcmp(str, "Persistent Memory\n", 18) == 0) {
> +			type = RANGE_PMEM;
> +		}
>  		else {
>  			continue;
>  		}
> @@ -149,6 +155,10 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
>  			return RANGE_ACPI;
>  		case E820_NVS:
>  			return RANGE_ACPI_NVS;
> +		case E820_PMEM:
> +			return RANGE_PMEM;
> +		case E820_PRAM:
> +			return RANGE_PRAM;
>  		case E820_RESERVED:
>  		default:
>  			return RANGE_RESERVED;
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 9271c6c..c75adaa 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -705,6 +705,12 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
>  			case RANGE_ACPI_NVS:
>  				e820[i].type = E820_NVS;
>  				break;
> +			case RANGE_PMEM:
> +				e820[i].type = E820_PMEM;
> +				break;
> +			case RANGE_PRAM:
> +				e820[i].type = E820_PRAM;
> +				break;
>  			default:
>  			case RANGE_RESERVED:
>  				e820[i].type = E820_RESERVED;
> diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> index 6be3c7c..4d84f00 100644
> --- a/kexec/firmware_memmap.c
> +++ b/kexec/firmware_memmap.c
> @@ -168,6 +168,10 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
>  		range->type = RANGE_ACPI_NVS;
>  	else if (strcmp(type, "Uncached RAM") == 0)
>  		range->type = RANGE_UNCACHED;
> +	else if (strcmp(type, "Persistent Memory (legacy)") == 0)
> +		range->type = RANGE_PRAM;
> +	else if (strcmp(type, "Persistent Memory") == 0)
> +		range->type = RANGE_PMEM;
>  	else {
>  		fprintf(stderr, "Unknown type (%s) while parsing %s. Please "
>  			"report this as bug. Using RANGE_RESERVED now.\n",
> diff --git a/kexec/kexec.h b/kexec/kexec.h
> index b129c15..0fa977f 100644
> --- a/kexec/kexec.h
> +++ b/kexec/kexec.h
> @@ -136,6 +136,8 @@ struct memory_range {
>  #define RANGE_ACPI	2
>  #define RANGE_ACPI_NVS	3
>  #define RANGE_UNCACHED	4
> +#define RANGE_PMEM		6
> +#define RANGE_PRAM		11
>  };
>  
>  struct memory_ranges {
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2015-08-19  9:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  9:03 [Patch v3] Add persistent memory support Baoquan He
2015-08-19  9:28 ` Dave Young [this message]
2015-08-19 10:45   ` Baoquan He
2015-08-20  2:38     ` Dave Young
2015-08-20  2:52       ` Baoquan He
2015-08-20  7:42         ` Dave Young
2015-08-24 19:54           ` Toshi Kani
2015-08-25  7:37             ` Dave Young
2015-09-02  1:04               ` Simon Horman
2015-09-23  8:33                 ` Petr Tesarik
2015-09-23  9:16                   ` Baoquan He
2015-09-23  9:23                   ` Baoquan He

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=20150819092815.GB6130@localhost.localdomain \
    --to=dyoung@redhat.com \
    --cc=bhe@redhat.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=toshi.kani@hp.com \
    /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.