linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, linuxppc-dev@lists.ozlabs.org
Cc: Balbir Singh <bsingharora@gmail.com>,
	Paul Mackerras <paulus@samba.org>, Greg Kurz <groug@kaod.org>
Subject: Re: [PATCH kernel] powerpc/iommu: Do not call PageTransHuge() on tail pages
Date: Wed, 5 Apr 2017 09:04:43 +0530	[thread overview]
Message-ID: <62c19feb-11a6-573b-6e1e-27aeb3a06fd5@linux.vnet.ibm.com> (raw)
In-Reply-To: <0657df73-b221-2a49-358b-9f0c339cb0be@ozlabs.ru>



On Wednesday 05 April 2017 08:29 AM, Alexey Kardashevskiy wrote:
> On 04/04/17 19:26, Aneesh Kumar K.V wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>
>>> The CMA pages migration code does not support compound pages at
>>> the moment so it performs few tests before proceeding to actual page
>>> migration.
>>>
>>> One of the tests - PageTransHuge() - has VM_BUG_ON_PAGE(PageTail()) as
>>> it should be called on head pages. Since we also test for PageCompound(),
>>> and it contains PageTail(), we can simply move PageCompound() in front
>>> of PageTransHuge() and therefore avoid possible VM_BUG_ON_PAGE.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>>
>>> Some of actual POWER8 systems do crash on that BUG_ON.
>>> ---
>>>  arch/powerpc/mm/mmu_context_iommu.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c
>>> index 497130c5c742..ba7fccf993b3 100644
>>> --- a/arch/powerpc/mm/mmu_context_iommu.c
>>> +++ b/arch/powerpc/mm/mmu_context_iommu.c
>>> @@ -81,7 +81,7 @@ struct page *new_iommu_non_cma_page(struct page *page, unsigned long private,
>>>  	gfp_t gfp_mask = GFP_USER;
>>>  	struct page *new_page;
>>>
>>> -	if (PageHuge(page) || PageTransHuge(page) || PageCompound(page))
>>> +	if (PageCompound(page) || PageHuge(page) || PageTransHuge(page))
>>
>>
>> A checked for compound page should be sufficient here, because a
>> Huge/TransHuge page is also marked compound.
>
>
> But PageCompound() calls PageTail() so PageTail() will be called on a trans
> page which is BUG_ON in PageTransHuge but it is not in PageCompound() -
> this inconsistency is bothering me. Does not this BUG_ON tell us that we
> should not be calling PageTail() on _any_ page?
>
> In other words, should I get a head page (via compound_head()) first and
> only then test the head page if it is thp/huge (as you suggested in a chat)?
>
>
>

I was suggesting to replace that if () condition with just

/* We don't handle hugetlb/THP pages yet */
if (PageCompund(page)) {

}

-aneesh

      reply	other threads:[~2017-04-05  3:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  5:25 [PATCH kernel] powerpc/iommu: Do not call PageTransHuge() on tail pages Alexey Kardashevskiy
2017-03-28 10:45 ` Michael Ellerman
2017-03-28 11:58   ` Alexey Kardashevskiy
2017-04-03  3:27 ` Balbir Singh
2017-04-04  9:26 ` Aneesh Kumar K.V
2017-04-05  2:59   ` Alexey Kardashevskiy
2017-04-05  3:34     ` Aneesh Kumar K.V [this message]

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=62c19feb-11a6-573b-6e1e-27aeb3a06fd5@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=bsingharora@gmail.com \
    --cc=groug@kaod.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).