All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	ross.zwisler@linux.intel.com, Jens Axboe <axboe@kernel.dk>,
	boaz@plexistor.com
Subject: Re: [PATCH 2/3] x86: add a is_e820_ram() helper
Date: Thu, 26 Mar 2015 15:59:28 -0700	[thread overview]
Message-ID: <CAE9FiQUcESZOzLW7Jcc-g5xUMfxx-kJqgbOzyD4jA7QVDg7+=Q@mail.gmail.com> (raw)
In-Reply-To: <20150326093424.GA28217@lst.de>

On Thu, Mar 26, 2015 at 2:34 AM, Christoph Hellwig <hch@lst.de> wrote:
> On Thu, Mar 26, 2015 at 10:02:15AM +0100, Ingo Molnar wrote:
>> This is_e820_ram() factoring out becomes really messy in patch #3.
...
> Does this patch (replaces patches 2 and 3) look better to you?
>
> ---
> From 4a6fdc8433559d649d7bf707f72aafa4488f2d23 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Wed, 25 Mar 2015 12:24:11 +0100
> Subject: x86: add support for the non-standard protected e820 type
>
> Various recent BIOSes support NVDIMMs or ADR using a non-standard
> e820 memory type, and Intel supplied reference Linux code using this
> type to various vendors.
>
> Wire this e820 table type up to export platform devices for the pmem
> driver so that we can use it in Linux, and also provide a memmap=
> argument to manually tag memory as protected, which can be used
> if the BIOSs doesn't use the standard nonstandard interface, or
> we just want to test the pmem driver with regular memory.
>
> Based on an earlier patch from Dave Jiang <dave.jiang@intel.com>
>
...
> diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c
> new file mode 100644
> index 0000000..f970048
> --- /dev/null
> +++ b/arch/x86/kernel/pmem.c
...
> +
> +void __init reserve_pmem(void)
> +{
> +       int i;
> +
> +       for (i = 0; i < e820.nr_map; i++) {
> +               struct e820entry *ei = &e820.map[i];
> +
> +               if (ei->type != E820_PRAM)
> +                       continue;
> +
> +               memblock_reserve(ei->addr, ei->addr + ei->size);
> +               max_pfn_mapped = init_memory_mapping(
> +                               ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
> +                               ei->addr + ei->size);
> +       }
> +}

What do you want to get here?

You did not modify memblock_x86_fill() to treat
E820_PRAM as E820_RAM, so memblock will not have any
entry for E820_PRAM, so you do not need to call memblock_reserve
there.

And the same time,  init_memory_mapping() will call
init_range_memory_mapping/for_each_mem_pfn_range() to
set kernel mapping for memory range in memblock only.
So here calling init_memory_mapping will not do anything.
then just drop calling to that init_memory_mapping.
--- so will not kernel mapping pmem, is that what you intended to have?

After those two changes, You do not need this reserve_pmem at all.
Just drop it.


> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 0a2421c..f2bed2b 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1158,6 +1158,8 @@ void __init setup_arch(char **cmdline_p)
>
>         early_acpi_boot_init();
>
> +       reserve_pmem();
> +

Not needed.

>         initmem_init();
>         dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);

Thanks

Yinghai

  parent reply	other threads:[~2015-03-26 22:59 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26  8:32 another pmem variant V2 Christoph Hellwig
2015-03-26  8:32 ` [PATCH 1/3] pmem: Initial version of persistent memory driver Christoph Hellwig
2015-03-26 14:12   ` [Linux-nvdimm] " Dan Williams
2015-03-26 14:35     ` Christoph Hellwig
2015-03-26 21:37       ` Ross Zwisler
2015-03-26 14:52     ` Boaz Harrosh
2015-03-26 15:59       ` Dan Williams
2015-03-26  8:32 ` [PATCH 2/3] x86: add a is_e820_ram() helper Christoph Hellwig
2015-03-26  9:02   ` Ingo Molnar
2015-03-26  9:34     ` Christoph Hellwig
2015-03-26 10:04       ` Ingo Molnar
2015-03-26 10:19         ` Christoph Hellwig
2015-03-26 10:28           ` Ingo Molnar
2015-03-26 10:29             ` Christoph Hellwig
2015-03-26 15:49       ` Boaz Harrosh
2015-03-26 16:02         ` [Linux-nvdimm] " Dan Williams
2015-03-26 16:07           ` Boaz Harrosh
2015-03-26 16:43         ` Christoph Hellwig
2015-03-26 18:46           ` Elliott, Robert (Server Storage)
2015-03-26 19:25             ` [Linux-nvdimm] " Dan Williams
2015-03-26 20:53           ` Ross Zwisler
2015-03-26 22:59       ` Yinghai Lu [this message]
2015-03-27  8:10         ` Christoph Hellwig
2015-03-26  8:32 ` [PATCH 3/3] x86: add support for the non-standard protected e820 type Christoph Hellwig
2015-03-26 16:57 ` another pmem variant V2 Boaz Harrosh
2015-03-26 17:02   ` [PATCH] SQUASHME: Streamline pmem.c Boaz Harrosh
2015-03-26 17:23     ` Christoph Hellwig
2015-03-26 22:17     ` Ross Zwisler
2015-03-26 22:22     ` Ross Zwisler
2015-03-26 23:31     ` [Linux-nvdimm] " Dan Williams
2015-03-31 13:44       ` Boaz Harrosh
2015-03-26 17:18   ` another pmem variant V2 Christoph Hellwig
2015-03-26 17:31     ` Boaz Harrosh
2015-03-26 18:38       ` Christoph Hellwig
2015-03-31  9:25   ` Christoph Hellwig
2015-03-31 10:25     ` Boaz Harrosh
2015-03-31 10:31       ` Boaz Harrosh
2015-03-31 14:21       ` [RFC] SQUASHME: pmem: Split up pmem_probe from pmem_alloc Boaz Harrosh
2015-03-31 16:10         ` Christoph Hellwig
2015-03-31 16:08       ` another pmem variant V2 Christoph Hellwig
2015-03-31 13:18     ` [SQUASHME 0/6] Streamline of Initial pmem submission Boaz Harrosh
2015-03-31 13:23       ` [PATCH 1/6] SQUASHME: Don't let e820_PMEM sections Boaz Harrosh
2015-03-31 17:16         ` [Linux-nvdimm] " Brooks, Adam J
2015-03-31 13:24       ` [PATCH 2/6] SQUASHME: pmem: Remove getgeo Boaz Harrosh
2015-03-31 13:25       ` [PATCH 3/6] SQUASHME: pmem: Streamline pmem driver Boaz Harrosh
2015-03-31 13:27       ` [PATCH 4/6] SQUSHME: pmem: Micro cleaning Boaz Harrosh
2015-03-31 15:17         ` [Linux-nvdimm] " Dan Williams
2015-03-31 15:24           ` Boaz Harrosh
2015-03-31 15:30             ` Dan Williams
2015-03-31 15:43               ` Boaz Harrosh
2015-03-31 19:40                 ` Matthew Wilcox
2015-03-31 13:28       ` [PATCH 5/6] SQUASHME: pmem: Remove SECTOR_SHIFT Boaz Harrosh
2015-03-31 13:33       ` [PATCH 6/6] SQUASHME: pmem: Remove "... based on brd.c" + Copyright Boaz Harrosh
2015-03-31 15:14     ` another pmem variant V2 Boaz Harrosh
2015-03-31 16:16       ` Christoph Hellwig
2015-03-31 16:44         ` Ingo Molnar
2015-03-31 17:24           ` Christoph Hellwig
2015-03-31 17:33             ` [Linux-nvdimm] " Dan Williams
2015-04-01  7:50               ` Ingo Molnar
2015-04-01  8:06                 ` Boaz Harrosh
2015-04-01 12:49         ` Boaz Harrosh
2015-03-31 22:11 ` Elliott, Robert (Server Storage)
2015-04-01  7:26   ` Christoph Hellwig
2015-04-02 15:11     ` Elliott, Robert (Server Storage)
2015-04-02 16:41       ` Christoph Hellwig
2015-04-02 18:03         ` Ingo Molnar
2015-04-02 18:03           ` Ingo Molnar
2015-04-01 19:33 ` Elliott, Robert (Server Storage)
2015-04-02  9:37   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2015-03-25 16:04 another pmem variant Christoph Hellwig
2015-03-25 16:04 ` [PATCH 2/3] x86: add a is_e820_ram() helper Christoph Hellwig

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='CAE9FiQUcESZOzLW7Jcc-g5xUMfxx-kJqgbOzyD4jA7QVDg7+=Q@mail.gmail.com' \
    --to=yinghai@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=boaz@plexistor.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=mingo@kernel.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=x86@kernel.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.