All of lore.kernel.org
 help / color / mirror / Atom feed
From: zijun_hu <zijun_hu@zoho.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	zijun_hu@htc.com, Andrew Morton <akpm@linux-foundation.org>,
	tj@kernel.org, mingo@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, mgorman@techsingularity.net
Subject: Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges
Date: Fri, 23 Sep 2016 21:00:18 +0800	[thread overview]
Message-ID: <57E52762.9000702@zoho.com> (raw)
In-Reply-To: <20160923124244.GN4478@dhcp22.suse.cz>

On 09/23/2016 08:42 PM, Michal Hocko wrote:
>>>> no, it don't work for many special case
>>>> for example, provided  PMD_SIZE=2M
>>>> mapping [0x1f8800, 0x208800) virtual range will be split to two ranges
>>>> [0x1f8800, 0x200000) and [0x200000,0x208800) and map them separately
>>>> the first range will cause dead loop
>>>
>>> I am not sure I see your point. How can we deadlock if _both_ addresses
>>> get aligned to the page boundary and how does PMD_SIZE make any
>>> difference.
>>>
>> i will take a example to illustrate my considerations
>> provided PUD_SIZE == 1G, PMD_SIZE == 2M, PAGE_SIZE == 4K
>> it is used by arm64 normally
>>
>> we want to map virtual range [0xffffffff_ffc08800, 0xffffffff_fffff800) by
>> ioremap_page_range(),ioremap_pmd_range() is called to map the range
>> finally, ioremap_pmd_range() will call
>> ioremap_pte_range(pmd, 0xffffffff_ffc08800, 0xffffffff_fffe0000) and
>> ioremap_pte_range(pmd, 0xffffffff_fffe0000, 0xffffffff fffff800) separately
> 
> but those ranges are not aligned and it ioremap_page_range fix them up
> to _be_ aligned then there is no problem, right? So either I am missing
> something or we are talking past each other.
> 
my complementary considerations are show below

why not to round up the range start boundary to page aligned?
1, it don't remain consistent with the original logic
   take map [0x1800, 0x4800) as example
   the original logic map range [0x1000, 0x2000), but rounding up start boundary
   don't mapping the range [0x1000, 0x2000)
2, the rounding up start boundary maybe cause overflow, consider start boundary =
   0xffffffff_fffff800  

--
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: zijun_hu <zijun_hu@zoho.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	zijun_hu@htc.com, Andrew Morton <akpm@linux-foundation.org>,
	tj@kernel.org, mingo@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, mgorman@techsingularity.net
Subject: Re: [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges
Date: Fri, 23 Sep 2016 21:00:18 +0800	[thread overview]
Message-ID: <57E52762.9000702@zoho.com> (raw)
In-Reply-To: <20160923124244.GN4478@dhcp22.suse.cz>

On 09/23/2016 08:42 PM, Michal Hocko wrote:
>>>> no, it don't work for many special case
>>>> for example, provided  PMD_SIZE=2M
>>>> mapping [0x1f8800, 0x208800) virtual range will be split to two ranges
>>>> [0x1f8800, 0x200000) and [0x200000,0x208800) and map them separately
>>>> the first range will cause dead loop
>>>
>>> I am not sure I see your point. How can we deadlock if _both_ addresses
>>> get aligned to the page boundary and how does PMD_SIZE make any
>>> difference.
>>>
>> i will take a example to illustrate my considerations
>> provided PUD_SIZE == 1G, PMD_SIZE == 2M, PAGE_SIZE == 4K
>> it is used by arm64 normally
>>
>> we want to map virtual range [0xffffffff_ffc08800, 0xffffffff_fffff800) by
>> ioremap_page_range(),ioremap_pmd_range() is called to map the range
>> finally, ioremap_pmd_range() will call
>> ioremap_pte_range(pmd, 0xffffffff_ffc08800, 0xffffffff_fffe0000) and
>> ioremap_pte_range(pmd, 0xffffffff_fffe0000, 0xffffffff fffff800) separately
> 
> but those ranges are not aligned and it ioremap_page_range fix them up
> to _be_ aligned then there is no problem, right? So either I am missing
> something or we are talking past each other.
> 
my complementary considerations are show below

why not to round up the range start boundary to page aligned?
1, it don't remain consistent with the original logic
   take map [0x1800, 0x4800) as example
   the original logic map range [0x1000, 0x2000), but rounding up start boundary
   don't mapping the range [0x1000, 0x2000)
2, the rounding up start boundary maybe cause overflow, consider start boundary =
   0xffffffff_fffff800  

  reply	other threads:[~2016-09-23 13:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  4:19 [PATCH 1/1] lib/ioremap.c: avoid endless loop under ioremapping page unaligned ranges zijun_hu
2016-09-21  4:19 ` zijun_hu
2016-09-22 12:47 ` Michal Hocko
2016-09-22 12:47   ` Michal Hocko
2016-09-22 15:13   ` zijun_hu
2016-09-22 15:13     ` zijun_hu
2016-09-23  8:45     ` Michal Hocko
2016-09-23  8:45       ` Michal Hocko
2016-09-23 12:29       ` zijun_hu
2016-09-23 12:29         ` zijun_hu
2016-09-23 12:42         ` Michal Hocko
2016-09-23 12:42           ` Michal Hocko
2016-09-23 13:00           ` zijun_hu [this message]
2016-09-23 13:00             ` zijun_hu
2016-09-23 13:33             ` Michal Hocko
2016-09-23 13:33               ` Michal Hocko
2016-09-23 14:14               ` zijun_hu
2016-09-23 14:14                 ` zijun_hu
2016-09-23 14:27                 ` Michal Hocko
2016-09-23 14:27                   ` Michal Hocko
2016-09-23 14:58                   ` zijun_hu
2016-09-23 14:58                     ` zijun_hu
2016-09-23  5:53 ` [PATCH v2 " zijun_hu
2016-09-23  5:53   ` zijun_hu
2016-09-23 14:42 ` [PATCH " Tejun Heo
2016-09-23 14:42   ` Tejun Heo
2016-09-23 15:41   ` zijun_hu
2016-09-23 15:41     ` zijun_hu
2016-09-23 16:23     ` Tejun Heo
2016-09-23 16:23       ` Tejun Heo

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=57E52762.9000702@zoho.com \
    --to=zijun_hu@zoho.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=mingo@kernel.org \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    --cc=zijun_hu@htc.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.