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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2F4EC28D13 for ; Thu, 25 Aug 2022 15:20:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BD786B0074; Thu, 25 Aug 2022 11:20:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46D2E940008; Thu, 25 Aug 2022 11:20:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35CFA940007; Thu, 25 Aug 2022 11:20:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 27BF56B0074 for ; Thu, 25 Aug 2022 11:20:18 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 04DC916094C for ; Thu, 25 Aug 2022 15:20:17 +0000 (UTC) X-FDA: 79838476116.17.EA5BB0E Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf16.hostedemail.com (Postfix) with ESMTP id 62C7D180009 for ; Thu, 25 Aug 2022 15:20:17 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 84D3BB82A12; Thu, 25 Aug 2022 15:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E045C433D6; Thu, 25 Aug 2022 15:20:12 +0000 (UTC) Date: Thu, 25 Aug 2022 16:20:08 +0100 From: Catalin Marinas To: Liam Howlett Cc: Mark Brown , Will Deacon , "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , "Matthew Wilcox (Oracle)" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v13 57/70] mm/mlock: use vma iterator and maple state instead of vma linked list Message-ID: References: <20220822150128.1562046-1-Liam.Howlett@oracle.com> <20220822150128.1562046-58-Liam.Howlett@oracle.com> <20220825132054.ymenz4cewiemsxw7@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825132054.ymenz4cewiemsxw7@revolver> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661440817; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+70tT39O/g4cm2OFyBx45pLMVC0vjtNLRhDKubtqo/I=; b=bHdCOF3rvrCZx1u7gIcehnaeKkNrvUKwJkeVLTugE6ZYjBccLII4KIVqbc/c4xd+iK0bbp sceiBR0DbyIjiEto2vW+XgLsqTPAhTd+WrPVe0/wNJuib/X15hSSxlv6Re8ZnnybXR7zOJ PQlFQik4Ng+ObPkU7Mm/50B5yioDb/A= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661440817; a=rsa-sha256; cv=none; b=CttEnZb6od8MT8rlB0KY2vCoZ7lDVdytc8Y6eNXMDJAq0k38W82YLXS5f7+yxk2lWeZj16 wgIVbvDvMxegSYTsvwZhtkNctrjDbdKmPpN8L/GmIDCCeWgRmfGqo3k2B461wA6LfjYZqt VJvrULpr8KyOf1l6anEjkT7c1nW3+WQ= Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) X-Rspam-User: X-Stat-Signature: kdfdwfq7mok6yapjbux1t5xf9bee9jn4 X-Rspamd-Queue-Id: 62C7D180009 X-Rspamd-Server: rspam03 X-HE-Tag: 1661440817-834172 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Aug 25, 2022 at 01:21:01PM +0000, Liam Howlett wrote: > * Mark Brown [220824 20:34]: > > On Mon, Aug 22, 2022 at 03:06:30PM +0000, Liam Howlett wrote: > > > From: "Matthew Wilcox (Oracle)" > > > > > > Handle overflow checking in count_mm_mlocked_page_nr() differently. > > > > Our QA team found that since next-20220823 we're seeing a couple of test > > failures in the check_mmap_options kselftest on arm64 platforms with MTE > > that aren't present in mainline: > > > > # # FAIL: mprotect not ignoring clear PROT_MTE property > > # not ok 21 Check clear PROT_MTE flags with private mapping, sync error mode and mmap memory > > # # FAIL: mprotect not ignoring clear PROT_MTE property > > # not ok 22 Check clear PROT_MTE flags with private mapping and sync error mode and mmap/mprotect memory > > Thanks. > > > I bisected this using qemu[1] which landed on 4ceb4bca479d41a > > ("mm/mprotect: use maple tree navigation instead of vma linked list"), > > though I'm not 100% sure I trust the specific identification of the > > commit I'm pretty confident it's at the very least in this series. I've > > not done any analysis of the failure beyond getting this bisect result. > > > > [1] qemu -smp cpus=4 -cpu max -machine virt,gic-version=3,mte=on > > This helps a lot. I think your bisect is accurate: > > ... > struct mmu_gather tlb; > + MA_STATE(mas, ¤t->mm->mm_mt, start, start); > > start = untagged_addr(start); > ... > > It looks like I search against the tagged address. I should initialize > the state to 0 and mas_set(&mas, start) after untagging the address. > > I'll send out a patch once I have recreated and verified this is the > issue. Thanks. I did a quick test and untagging start seems to fix the issue (I was wondering why mprotect() returned -ENOMEM when failing). -- Catalin