Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp745007rwe; Thu, 25 Aug 2022 08:25:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4BHjlCBlSWRaPgE93v65hxrZoABd1nx6k6jTvTZ/z7YjomqWquyEH8ipQHqqIOtqsIP6Fk X-Received: by 2002:a17:906:a0d3:b0:73d:be5b:2b52 with SMTP id bh19-20020a170906a0d300b0073dbe5b2b52mr2825785ejb.727.1661441152523; Thu, 25 Aug 2022 08:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661441152; cv=none; d=google.com; s=arc-20160816; b=gDghhn5H9uDvee7Ndg6fOaKypKQ9i92SmeGcJ3jxYCzStqh8t0edDj4awkxZ9ZLJ1w EQjHhxfv1WXMZtVV+WAtaEnY8iGu0hjM2uhBhR1MydSR3ffhmiSFxVGVLqORGeqOxmh2 bC570Yl7AMkbu0JF+CBMLouiZhBPXEfdQK1pWtpkeJh6RZlmpIPxOt2Bef2nUjop/pll rmYjvNFxObXKiHl+4lZnYvrFqGwxloV8eyv8Mu7IitMtdZ+HTpntRyS1w4Kckpks4TpQ a4BFHWK9kxs6NU7TXobqHrtcS22EJBd/otwwaabQPYmKHPoIsFFIappEpuj0QwMfMty/ zhAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=+70tT39O/g4cm2OFyBx45pLMVC0vjtNLRhDKubtqo/I=; b=CGea91r7SDer1wUU7XrLgRsaZayWf7/WOkEZBtUTFetjjHqYm44sUMqUkG82eKSkev 3EiVvg5hkC/f+rxYYFiCOdTlgSuXRnzEresEtJYzh/yGYlTgsB8VYREnYKsSub081nS1 GnoB4cpiFPURA2SfKVG8OBunH2wdKJRbglNiq72D0ynj+yCZRXRVVnXH9PVs7lBrhMYG s1rPl1F0PYjZzzycQC5HJSKkLlBrUPwA5MpB4ZMl99XOabDdZQjYWWXDu8jtfLfRuybw hSxsXpYc5Nysfz2LTO8AXa7HmeF+o6UzMk81lHoFfgMHGsK3mKyxPoNJ5MnII8kVcJ1l MY2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz16-20020a0564021d5000b00446273b0d6asi7247114edb.572.2022.08.25.08.25.24; Thu, 25 Aug 2022 08:25:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237865AbiHYPUS (ORCPT + 99 others); Thu, 25 Aug 2022 11:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbiHYPUQ (ORCPT ); Thu, 25 Aug 2022 11:20:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3262D2BB2C for ; Thu, 25 Aug 2022 08:20:15 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id C4D88615A7 for ; Thu, 25 Aug 2022 15:20:14 +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> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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