Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp224594yba; Fri, 3 May 2019 00:07:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1y94t4ZwTIVl7ou94mFwpZu6NBsoGpcQ558IUqweAq4l2u0aGL608KWX6aPZKkpLzGhtB X-Received: by 2002:a17:902:8bca:: with SMTP id r10mr8432335plo.67.1556867233581; Fri, 03 May 2019 00:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556867233; cv=none; d=google.com; s=arc-20160816; b=cDqVBjDn8LRhe55gudz2hwwyLugNWJKNrDZqZOIXCD8DOhw3FuzmUVamer5oLuB0c1 TE7Dto+5TQjj5v2n3s3Nyg4ziBVZSLQRc+1yNLLL+k24hFkG1FpNbDXHV6sGWn/XEpPc ajwkUUG4Uvan3dkB4nkcCxLeQtuaFXjn2EORnMaoyf2T6J6Tz+l/15aiIw12Fh6BCqj8 S1v1mPOe4BClhLoMjMWbNtFcq6qQblgyfrjU3G2G+M0othBxNaO0VI87v5G/dbTxmPaK EMaPxtmfeIsIjsuN0z0HV97LDgPNqklSlp0Ov7tXFySsX0Pa+wax6KJXa6bGnXMVVpZZ e9ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=mYfqNFM/TrWf4ZVB+OK+pbOxO5pJW9BGC73Dd0ma49U=; b=v3GOh6AC2j7mC9arPfdXiDLhi9XseO1wFI4gcfL1uoRKdrRIDOiI8BUuqOZNhfhc4M 3kRjSI862nHcD4P7NCNbAr2iwmJmx/qpk86nkDXK5fEI6zVuAB2eYeRNq7HnRLOOjpVv bnppR35sWuWK4yhIiv1QyWLekY9LL5LSXjniwJ2xffLABVuly603tbZMxtZQs/zPyMip RSFM8txTwZJONvtEN+NA7wlJ/h873zoptPj10Z5CAoxGypDpyk+zz60/UdBW+fSXNXxZ FvrPJpEAs0PwiANCR45ZMzfr+Es4w7cYo8OU/rj9w/nJv7d14Hf5kaecLTo9ia4tNoqZ Zozw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si1434334pll.281.2019.05.03.00.06.58; Fri, 03 May 2019 00:07:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726444AbfECHF4 (ORCPT + 99 others); Fri, 3 May 2019 03:05:56 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:48755 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfECHF4 (ORCPT ); Fri, 3 May 2019 03:05:56 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 44wNSw6lq0z9sD4; Fri, 3 May 2019 17:05:52 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 12f363511d47f86c49b7766c349989cb33fd61a8 X-Patchwork-Hint: ignore In-Reply-To: <09733bd9d90f2ab9dfee9838442e0bea01df194d.1556640535.git.christophe.leroy@c-s.fr> To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Serge Belyshev , Segher Boessenkool From: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] powerpc/32s: fix BATs setting with CONFIG_STRICT_KERNEL_RWX Message-Id: <44wNSw6lq0z9sD4@ozlabs.org> Date: Fri, 3 May 2019 17:05:52 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-04-30 at 16:11:59 UTC, Christophe Leroy wrote: > Serge reported some crashes with CONFIG_STRICT_KERNEL_RWX enabled > on a book3s32 machine. > > Analysis shows two issues: > - BATs addresses and sizes are not properly aligned. > - There is a gap between the last address covered by BATs and the > first address covered by pages. > > Memory mapped with DBATs: > 0: 0xc0000000-0xc07fffff 0x00000000 Kernel RO coherent > 1: 0xc0800000-0xc0bfffff 0x00800000 Kernel RO coherent > 2: 0xc0c00000-0xc13fffff 0x00c00000 Kernel RW coherent > 3: 0xc1400000-0xc23fffff 0x01400000 Kernel RW coherent > 4: 0xc2400000-0xc43fffff 0x02400000 Kernel RW coherent > 5: 0xc4400000-0xc83fffff 0x04400000 Kernel RW coherent > 6: 0xc8400000-0xd03fffff 0x08400000 Kernel RW coherent > 7: 0xd0400000-0xe03fffff 0x10400000 Kernel RW coherent > > Memory mapped with pages: > 0xe1000000-0xefffffff 0x21000000 240M rw present dirty accessed > > This patch fixes both issues. With the patch, we get the following > which is as expected: > > Memory mapped with DBATs: > 0: 0xc0000000-0xc07fffff 0x00000000 Kernel RO coherent > 1: 0xc0800000-0xc0bfffff 0x00800000 Kernel RO coherent > 2: 0xc0c00000-0xc0ffffff 0x00c00000 Kernel RW coherent > 3: 0xc1000000-0xc1ffffff 0x01000000 Kernel RW coherent > 4: 0xc2000000-0xc3ffffff 0x02000000 Kernel RW coherent > 5: 0xc4000000-0xc7ffffff 0x04000000 Kernel RW coherent > 6: 0xc8000000-0xcfffffff 0x08000000 Kernel RW coherent > 7: 0xd0000000-0xdfffffff 0x10000000 Kernel RW coherent > > Memory mapped with pages: > 0xe0000000-0xefffffff 0x20000000 256M rw present dirty accessed > > Reported-by: Serge Belyshev > Fixes: 63b2bc619565 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX") > Cc: stable@vger.kernel.org > Acked-by: Segher Boessenkool > Signed-off-by: Christophe Leroy Applied to powerpc fixes, thanks. https://git.kernel.org/powerpc/c/12f363511d47f86c49b7766c349989cb cheers