From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38974C5DF60 for ; Fri, 8 Nov 2019 09:41:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 093BF214DA for ; Fri, 8 Nov 2019 09:41:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UghHiVdj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 093BF214DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5Z0ValP07w8zdyALEuFBN3hMhCwclJym/OD8C/ZOljU=; b=UghHiVdjAbw9Q+ 7cHsXeahn55vI1EntjnHAPp10C3gGm3hineW2NnC+iOi8fTrxxSzBaZmW+cF9sX1RW6fwQ2fRNI5A z2/FiZu1rwP4lJDxinFY8TCZ8W6W6J03WE0RC4lV7Z63eEgUNGtvzoN9OjOUXL2+etv5TcOPeHyQD Wb+yBJ6V2snPLYIg7hMy8VypRiVuwZTBQg8hHvufqQJOY2NKBZY5i7ZKVT+Z0Ik4y71GR/UGQG5CM 4fF0ApOuvHzYnZXho6wOQ1Qiavl8jJLNp01EoYqkxKX09BekVI8OlwGf2//47yV4CFbWvqyA8wjHU vKRtqwTwlHYff4ttm2sg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iT0lG-0006dY-CW; Fri, 08 Nov 2019 09:40:58 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iT0lD-0006cz-EA for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 09:40:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B5C0831B; Fri, 8 Nov 2019 01:40:53 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.197.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E97693F71A; Fri, 8 Nov 2019 01:40:52 -0800 (PST) Date: Fri, 8 Nov 2019 09:40:50 +0000 From: Catalin Marinas To: Steve Capper Subject: Re: [PATCH] arm64: Do not mask out PTE_RDONLY in pte_same() Message-ID: <20191108094050.GN51202@arrakis.emea.arm.com> References: <20191106154105.15176-1-catalin.marinas@arm.com> <20191107114826.GC11587@willie-the-truck> <20191108020854.GA22491@capper-ampere.manchester.arm.com> <20191108023702.GA23577@capper-ampere.manchester.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191108023702.GA23577@capper-ampere.manchester.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191108_014055_519734_B0969590 X-CRM114-Status: GOOD ( 22.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Stultz , nd , Will Deacon , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 08, 2019 at 02:37:04AM +0000, Steve Capper wrote: > On Fri, Nov 08, 2019 at 02:08:56AM +0000, Steve Capper wrote: > > On Thu, Nov 07, 2019 at 11:48:26AM +0000, Will Deacon wrote: > > > On Wed, Nov 06, 2019 at 03:41:05PM +0000, Catalin Marinas wrote: > > > > Following commit 73e86cb03cf2 ("arm64: Move PTE_RDONLY bit handling out > > > > of set_pte_at()"), the PTE_RDONLY bit is no longer managed by > > > > set_pte_at() but built into the PAGE_* attribute definitions. > > > > Consequently, pte_same() must include this bit when checking two PTEs > > > > for equality. > > > > > > > > Remove the arm64-specific pte_same() function, practically reverting > > > > commit 747a70e60b72 ("arm64: Fix copy-on-write referencing in HugeTLB") > > > > > > > > Fixes: 73e86cb03cf2 ("arm64: Move PTE_RDONLY bit handling out of set_pte_at()") > > > > Cc: # 4.14.x- > > > > Cc: Will Deacon > > > > Cc: Steve Capper > > > > Reported-by: John Stultz > > > > Signed-off-by: Catalin Marinas > > > > --- > > > > > > > > Steve, > > > > > > > > Could you please check that the original problem fixed by commit > > > > 747a70e60b72 no longer exists after reverting it in 4.14 onwards? > > > > > > In the meantime, I've pushed this out to for-next/fixes since the CI came > > > back clean and it fixes John's issue (which I've confirmed locally too). > > > Interestingly, I'm not at all sure the problem is related to the Mali > > > driver. Some tracing suggests that the ART JIT thread is stuck on a write > > > fault, which could be explained by a broken pte_same(). > > > > > > Steve -- if you could please run the libhugetlbfs test suite as described > > > in 747a70e60b72 before tomorrow, that would be really great. > > > > > > > Hey Will, Catalin, > > Apologies for my late reply, I've been travelling longer than originally > > planned. > > > > I have tested for-next/fixes (with the pte_same removed), under > > libhugetlbfs and I have been unable to reproduce the original memory > > leak that prompted the pte_same logic in the first place. So this patch > > looks good to me. > > > > Will check this out for 4.14 too now. > > I can confirm that 4.14 with Catalin's patch cherry-picked also passes > the hugetlbfs cow tests. Great. Thanks for testing Steve. The next thing is improving pte_modify() to avoid an unnecessary fault as we can end up with dirty|write|rdonly pte (and subsequently ptep_set_access_flags() bailed out earlier due to broken pte_same()). Anyway, that's not critical now, just minor perf improvement. I'll post a patch along the lines of https://paste.debian.net/hidden/66246019/. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel