All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 1/3] resource: Add @flags to region_intersects()
Date: Wed, 09 Dec 2015 14:44:15 -0700	[thread overview]
Message-ID: <1449697455.29051.6.camel@hpe.com> (raw)
In-Reply-To: <CAA9_cmeDbpQg3XmsKaEb1f+hSVxq5+3DpLm004wiagf_uwbFMw@mail.gmail.com>

On Wed, 2015-12-09 at 08:25 -0800, Dan Williams wrote:
> On Thu, Dec 3, 2015 at 12:35 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Thu, 2015-12-03 at 11:01 -0800, Linus Torvalds wrote:
> > > On Thu, Dec 3, 2015 at 10:40 AM, Borislav Petkov <bp@alien8.de>
> > > wrote:
> > > > On Thu, Dec 03, 2015 at 11:54:19AM -0700, Toshi Kani wrote:
> > > > > Adding a new type for regular memory will require inspecting the
> > > > > codes using IORESOURCE_MEM currently, and modify them to use the 
> > > > > new type if their target ranges are regular memory.  There are 
> > > > > many references to this type across multiple architectures and
> > > > > drivers, which make this inspection and testing challenging.
> > > > 
> > > > What's wrong with adding a new type_flags to struct resource and 
> > > > not touching IORESOURCE_* at all?
> > > 
> > > Bah. Both of these ideas are bogus.
> > > 
> > > Just add a new flag. The bits are already modifiers that you can
> > > *combine* to show what kind of resource it is, and we already have
> > > things like IORESOURCE_PREFETCH etc, that are in *addition* to the
> > > normal IORESOURCE_MEM bit.
> > > 
> > > Just add another modifier: IORESOURCE_RAM.
> > > 
> > > So it would still show up as IORESOURCE_MEM, but it would have
> > > additional information specifying that it's actually RAM.
> > > 
> > > If somebody does something like
> > > 
> > >      if (res->flags == IORESOURCE_MEM)
> > > 
> > > then they are already completely broken and won't work *anyway*. It's
> > > a bitmask, bit a set of values.
> > 
> > Yes, if we can assign new modifiers, that will be quite simple. :-)  I
> > assume we can allocate new bits from the remaining free bits as
> > follows.
> > 
> > +#define IORESOURCE_SYSTEM_RAM  0x01000000      /* System RAM */
> > +#define IORESOURCE_PMEM        0x02000000      /* Persistent memory */
> >  #define IORESOURCE_EXCLUSIVE   0x08000000      /* Userland may not map
> > this resource */
> > 
> > Note, SYSTEM_RAM represents the OS memory, i.e. "System RAM", not any 
> > RAM ranges.
> > 
> > With the new modifiers, region_intersect() can check these ranges.  One
> > caveat is that the modifiers are not very extensible for new types as 
> > they are bit maps.  region_intersect() will no longer be capable of 
> > checking any regions with any given name.  I think this is OK since 
> > this function was introduced recently, and is only used for checking 
> > "System RAM" and "Persistent Memory" (with this patch series).
> 
> IORESOURCE_PMEM is not descriptive enough for the two different types
> of pmem in the kernel.  How about we go with just
> IORESOURCE_SYSTEM_RAM for now since "is_ram()" checks are common.  Let
> the rest continue to be checked by strcmp().
> 
> For example the nvdimm-e820 driver cares about "Persistent Memory
> (legacy)", while other forms of pmem may just be "reserved" and only
> the driver knows that it is pmem.  An IORESOURCE_PMEM would not be
> reliable nor descriptive enough.

Agreed.  I will introduce a new type for System RAM, and leave the strcmp
check for other types.

Thanks,
-Toshi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 1/3] resource: Add @flags to region_intersects()
Date: Wed, 09 Dec 2015 14:44:15 -0700	[thread overview]
Message-ID: <1449697455.29051.6.camel@hpe.com> (raw)
In-Reply-To: <CAA9_cmeDbpQg3XmsKaEb1f+hSVxq5+3DpLm004wiagf_uwbFMw@mail.gmail.com>

On Wed, 2015-12-09 at 08:25 -0800, Dan Williams wrote:
> On Thu, Dec 3, 2015 at 12:35 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Thu, 2015-12-03 at 11:01 -0800, Linus Torvalds wrote:
> > > On Thu, Dec 3, 2015 at 10:40 AM, Borislav Petkov <bp@alien8.de>
> > > wrote:
> > > > On Thu, Dec 03, 2015 at 11:54:19AM -0700, Toshi Kani wrote:
> > > > > Adding a new type for regular memory will require inspecting the
> > > > > codes using IORESOURCE_MEM currently, and modify them to use the 
> > > > > new type if their target ranges are regular memory.  There are 
> > > > > many references to this type across multiple architectures and
> > > > > drivers, which make this inspection and testing challenging.
> > > > 
> > > > What's wrong with adding a new type_flags to struct resource and 
> > > > not touching IORESOURCE_* at all?
> > > 
> > > Bah. Both of these ideas are bogus.
> > > 
> > > Just add a new flag. The bits are already modifiers that you can
> > > *combine* to show what kind of resource it is, and we already have
> > > things like IORESOURCE_PREFETCH etc, that are in *addition* to the
> > > normal IORESOURCE_MEM bit.
> > > 
> > > Just add another modifier: IORESOURCE_RAM.
> > > 
> > > So it would still show up as IORESOURCE_MEM, but it would have
> > > additional information specifying that it's actually RAM.
> > > 
> > > If somebody does something like
> > > 
> > >      if (res->flags == IORESOURCE_MEM)
> > > 
> > > then they are already completely broken and won't work *anyway*. It's
> > > a bitmask, bit a set of values.
> > 
> > Yes, if we can assign new modifiers, that will be quite simple. :-)  I
> > assume we can allocate new bits from the remaining free bits as
> > follows.
> > 
> > +#define IORESOURCE_SYSTEM_RAM  0x01000000      /* System RAM */
> > +#define IORESOURCE_PMEM        0x02000000      /* Persistent memory */
> >  #define IORESOURCE_EXCLUSIVE   0x08000000      /* Userland may not map
> > this resource */
> > 
> > Note, SYSTEM_RAM represents the OS memory, i.e. "System RAM", not any 
> > RAM ranges.
> > 
> > With the new modifiers, region_intersect() can check these ranges.  One
> > caveat is that the modifiers are not very extensible for new types as 
> > they are bit maps.  region_intersect() will no longer be capable of 
> > checking any regions with any given name.  I think this is OK since 
> > this function was introduced recently, and is only used for checking 
> > "System RAM" and "Persistent Memory" (with this patch series).
> 
> IORESOURCE_PMEM is not descriptive enough for the two different types
> of pmem in the kernel.  How about we go with just
> IORESOURCE_SYSTEM_RAM for now since "is_ram()" checks are common.  Let
> the rest continue to be checked by strcmp().
> 
> For example the nvdimm-e820 driver cares about "Persistent Memory
> (legacy)", while other forms of pmem may just be "reserved" and only
> the driver knows that it is pmem.  An IORESOURCE_PMEM would not be
> reliable nor descriptive enough.

Agreed.  I will introduce a new type for System RAM, and leave the strcmp
check for other types.

Thanks,
-Toshi

  reply	other threads:[~2015-12-09 21:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 22:33 [PATCH v3 0/3] Allow EINJ to inject memory error to NVDIMM Toshi Kani
2015-11-24 22:33 ` Toshi Kani
2015-11-24 22:33 ` [PATCH v3 1/3] resource: Add @flags to region_intersects() Toshi Kani
2015-11-24 22:33   ` Toshi Kani
2015-12-01 13:50   ` Borislav Petkov
2015-12-01 13:50     ` Borislav Petkov
2015-12-01 16:54     ` Dan Williams
2015-12-01 16:54       ` Dan Williams
2015-12-01 16:54       ` Dan Williams
2015-12-01 17:02       ` Jeff Moyer
2015-12-01 17:02         ` Jeff Moyer
2015-12-01 17:02         ` Jeff Moyer
2015-12-01 17:13       ` Borislav Petkov
2015-12-01 17:13         ` Borislav Petkov
2015-12-01 17:19         ` Linus Torvalds
2015-12-01 17:19           ` Linus Torvalds
2015-12-01 17:19           ` Linus Torvalds
2015-12-03 18:54           ` Toshi Kani
2015-12-03 18:54             ` Toshi Kani
2015-12-03 18:40             ` Borislav Petkov
2015-12-03 18:40               ` Borislav Petkov
2015-12-03 19:01               ` Linus Torvalds
2015-12-03 19:01                 ` Linus Torvalds
2015-12-03 19:01                 ` Linus Torvalds
2015-12-03 20:35                 ` Toshi Kani
2015-12-03 20:35                   ` Toshi Kani
2015-12-09 16:25                   ` Dan Williams
2015-12-09 16:25                     ` Dan Williams
2015-12-09 16:25                     ` Dan Williams
2015-12-09 21:44                     ` Toshi Kani [this message]
2015-12-09 21:44                       ` Toshi Kani
2015-11-24 22:33 ` [PATCH v3 2/3] resource: Add region_intersects_pmem() Toshi Kani
2015-11-24 22:33   ` Toshi Kani
2015-11-24 22:33 ` [PATCH v3 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM Toshi Kani
2015-11-24 22:33   ` Toshi Kani

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=1449697455.29051.6.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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.