linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org
Subject: Re: kernel bug in "Drop WIMG in favour of new constants"?
Date: Thu, 16 Jun 2016 20:01:55 +0530	[thread overview]
Message-ID: <87twgt8ask.fsf@skywalker.in.ibm.com> (raw)
In-Reply-To: <87wplp8kxh.fsf@skywalker.in.ibm.com>

"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>
>> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>>
>>> "Darrick J. Wong" <darrick.wong@oracle.com> writes:
>>>
>>>> On Thu, Jun 16, 2016 at 03:23:47PM +1000, Michael Ellerman wrote:
>>>>> On Wed, 2016-06-15 at 21:33 -0700, Darrick J. Wong wrote:
>>>>> 
>>>>> > Hi Aneesh,
>>>>> > 
>>>>> > I noticed when trying out 4.7-rc3 on qemu-2.5 that the kernel no longer
>>>>> > boots.  4.6 booted just fine, so I bisected the kernel to the commit
>>>>> > 30bda41aba4efb2370c97e2cbe7385de93ccc372, which is "powerpc/mm: Drop WIMG in
>>>>> > favour of new constants".  The changelog suggests that the KVM changes need
>>>>> > closer review, and here's an actual crash:
>>>>> > 
>>>>> > (I can send libvirt's machine xml, .config, and full dmesg if that helps.)
>>>>> 
>>>>> Yes please.
>>>>> 
>>>>> I'm successfully booting 4.7-rc's on qemu (2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.1)).
>>>>
>>>> Ok, see attached.  I also sent along the dpkg --status output for qemu
>>>> and qemu-slof; looks like we're running the same Ubuntu packages...
>>>>
>>>> ...my host kernel is 4.6.0 on x64.
>>>
>>> So this is Qemu TCG mode right ? I will try some test and update later.
>>>
>>
>> I am able to reproduce this with
>>
>> qemu-system-ppc64 -kernel vmlinux -machine
>> type=pseries,usb=off -smp 1 -m 1G  -vga none -nographic    -device
>> usb-ehci -device usb-kbd -device usb-mouse
>>
>> Looks like enabling usb device is the issue.
>>
>
> Hmm Qemu  does
>
>         /* Looks like an IO address */
>         /* FIXME: What WIMG combinations could be sensible for IO?
>          * For now we allow WIMG=010x, but are there others? */
>         /* FIXME: Should we check against registered IO addresses? */
>         if ((ptel & (HPTE64_R_W | HPTE64_R_I | HPTE64_R_M)) != HPTE64_R_I) {
>             return H_PARAMETER;
>         }
>


Can you try this patch ?

Ben,

The pHyp part of the comment was added by you in 
3c726f8dee6f55e96475574e9f645327e461884c ([PATCH] ppc64: support 64k
page) really an old commit. I also remember we having the discussion and
concluding that it should be safe to assume that we can always enable
memory coherence. Should we do the below patch of get Qemu fixed up ?
like below

-        if ((ptel & (HPTE64_R_W | HPTE64_R_I | HPTE64_R_M)) != HPTE64_R_I) {
+        wimg_flags = (ptel & (HPTE64_R_W | HPTE64_R_I | HPTE64_R_M));
+
+        if (wimg_flags != HPTE64_R_I && wimg_flags != (HPTE64_R_I | HPTE64_R_M)) {
             return H_PARAMETER;
         }


commit 58f32706f64ee8fe21bbd7d6c211720cedec1292
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Date:   Thu Jun 16 19:43:39 2016 +0530

    powerpc/mm/hash: Don't add memory coherence if cache inhibited is set
    
    H_ENTER hcall handling in qemu had assumptions that a cache inhibited
    hpte entry won't have memory conference set. Also older kernel
    mentioned that some version of pHyp required this (look at the comment
    removed by the commit mentioned below).
    
    Fixes: commit 30bda41aba4e("powerpc/mm: Drop WIMG in favour of new constant")
    
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index fcf676f7f522..89c2791bc510 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -201,9 +201,8 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
 	/*
 	 * We can't allow hardware to update hpte bits. Hence always
 	 * set 'R' bit and set 'C' if it is a write fault
-	 * Memory coherence is always enabled
 	 */
-	rflags |=  HPTE_R_R | HPTE_R_M;
+	rflags |=  HPTE_R_R;
 
 	if (pteflags & _PAGE_DIRTY)
 		rflags |= HPTE_R_C;
@@ -216,7 +215,12 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
 	if ((pteflags & _PAGE_CACHE_CTL ) == _PAGE_NON_IDEMPOTENT)
 		rflags |= (HPTE_R_I | HPTE_R_G);
 	if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
-		rflags |= (HPTE_R_I | HPTE_R_W);
+		rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);
+	/*
+	 * Add memory coherence if cache inhibited is not set
+	 */
+	if (!(rflags & HPTE_R_I))
+		rflags |= HPTE_R_M;
 
 	return rflags;
 }

  parent reply	other threads:[~2016-06-16 14:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16  4:33 kernel bug in "Drop WIMG in favour of new constants"? Darrick J. Wong
2016-06-16  5:23 ` Michael Ellerman
2016-06-16  5:57   ` Darrick J. Wong
2016-06-16 10:07     ` Aneesh Kumar K.V
2016-06-16 10:46       ` Aneesh Kumar K.V
2016-06-16 10:52         ` Aneesh Kumar K.V
2016-06-16 12:05           ` Benjamin Herrenschmidt
2016-06-16 14:45             ` Aneesh Kumar K.V
2016-06-16 14:31           ` Aneesh Kumar K.V [this message]
2016-06-16 22:30             ` Benjamin Herrenschmidt
2016-06-17  1:49             ` Darrick J. Wong
2016-06-16 16:23         ` Darrick J. Wong
2016-06-16  5:28 ` Balbir Singh

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=87twgt8ask.fsf@skywalker.in.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=darrick.wong@oracle.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).