Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160703 > unrolled thread

Re: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt()

Started byDan Williams <dan.j.williams@intel.com>
First post2015-06-08 20:30 +0200
Last post2015-06-08 21:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt() Dan Williams <dan.j.williams@intel.com> - 2015-06-08 20:30 +0200
    Re: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt() Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-06-08 21:10 +0200
      Re: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt() Dan Williams <dan.j.williams@intel.com> - 2015-06-08 21:40 +0200

#1160703 — Re: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt()

FromDan Williams <dan.j.williams@intel.com>
Date2015-06-08 20:30 +0200
SubjectRe: [PATCH v3 5/6] arch: introduce memremap_cache() and memremap_wt()
Message-ID<pz9Y6-6UC-1@gated-at.bofh.it>
On Mon, Jun 8, 2015 at 9:27 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Thu, Jun 4, 2015 at 12:34 AM, Dan Williams <dan.j.williams@intel.com> wrote:
>> Existing users of ioremap_cache() are mapping memory that is known in
>> advance to not have i/o side effects.  These users are forced to cast
>> away the __iomem annotation, or otherwise neglect to fix the sparse
>> errors thrown when dereferencing pointers to this memory.  Provide
>> memremap_*() as a non __iomem annotated ioremap_*().
>>
>> The ARCH_HAS_MEMREMAP kconfig symbol is introduced for archs to assert
>> that it is safe to recast / reuse the return value from ioremap as a
>> normal pointer to memory.  In other words, archs that mandate specific
>> accessors for __iomem are not memremap() capable and drivers that care,
>> like pmem, can add a dependency to disable themselves on these archs.
>
> One minor comment. Otherwise looks good for me.
>
> []
>
>> --- a/kernel/resource.c
>> +++ b/kernel/resource.c
>
>> @@ -528,6 +528,45 @@ int region_is_ram(resource_size_t start, unsigned long size)
>>         return ret;
>>  }
>>
>> +#ifdef CONFIG_ARCH_HAS_MEMREMAP
>> +/*
>> + * memremap() is "ioremap" for cases where it is known that the resource
>> + * being mapped does not have i/o side effects and the __iomem
>> + * annotation is not applicable.
>> + */
>> +static bool memremap_valid(resource_size_t offset, size_t size)
>> +{
>> +       if (region_is_ram(offset, size) != 0) {
>> +               WARN_ONCE(1, "memremap attempted on ram %pa size: %zd\n",
>
> %zu

Sure, thanks for taking a look Andy!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1160716

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2015-06-08 21:10 +0200
Message-ID<pzaAN-7UC-11@gated-at.bofh.it>
In reply to#1160703
On Mon, Jun 8, 2015 at 9:25 PM, Dan Williams <dan.j.williams@intel.com> wrote:

>>> +       if (region_is_ram(offset, size) != 0) {
>>> +               WARN_ONCE(1, "memremap attempted on ram %pa size: %zd\n",
>>
>> %zu
>
> Sure, thanks for taking a look Andy!

One more thing, can we do
WARN_ONCE(region_is_ram(offset, size), …); ?

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1160732

FromDan Williams <dan.j.williams@intel.com>
Date2015-06-08 21:40 +0200
Message-ID<pzb3Q-8tx-11@gated-at.bofh.it>
In reply to#1160716
On Mon, Jun 8, 2015 at 12:04 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Jun 8, 2015 at 9:25 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>
>>>> +       if (region_is_ram(offset, size) != 0) {
>>>> +               WARN_ONCE(1, "memremap attempted on ram %pa size: %zd\n",
>>>
>>> %zu
>>
>> Sure, thanks for taking a look Andy!
>
> One more thing, can we do
> WARN_ONCE(region_is_ram(offset, size), …); ?
>

We still want to return false in this case so it would become
"if(WARN_ONCE(...)) return false;".  Neil once made the argument to me
that we should be able to compile all of the asserts out of the
kernel, also "if (WARN_ONCE(...))" is a bit harder to read as you need
to go check the macro to make sure it returns the right status, and
more than once.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web