Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp314771rdb; Thu, 30 Nov 2023 05:44:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEd2DQqSrPpwcmQSdVeqpMdbDFvw2PQQQI2jdKhTFasrJ0EKAfIEoQ2ra5WAmZOkW/M/caS X-Received: by 2002:a05:6820:809:b0:58d:a6ed:5601 with SMTP id bg9-20020a056820080900b0058da6ed5601mr11713210oob.1.1701351855271; Thu, 30 Nov 2023 05:44:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701351855; cv=none; d=google.com; s=arc-20160816; b=jnO1YA6GckwYHQ+R4SuDyxfy5aZKQe9BWqh+3sdcZ+6GJKb0VekXNw7E/N4t6h2zAO +dXj43JwsPS/EGPuGDMxDyUJxcuCPnEprhsmwZwdpBnuNAasxvc4oAv8YBJIHicFUGLJ j+mzkDZFKeocYl/TlCwvNwKZZYIww4fzowGAUjPn8qtvBFVozfXUfLoWVX6P1+mHoH7x 4OcHH0ra8xzYUYgqgA9SvYPqeXiEtkPchAgDBZi8U2UGbOR95Qu0WhTzDUw5kR3snALL MVwYBgBJjB5CZuJvQEidMxgyx/w6WVLXFbb1JCrYeDIxiNTZnFgF0soUbYdSlqWg2M+2 lTwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=vXLmPI3YKuWjybHeV+zzmSdSrTMtOftgtk5WyUqCzCo=; fh=C2qC1nYgy4uggpmWFuzeQk9XblOzZlDMkWbGn2+Xz8c=; b=Wzq0nSyoIxSIXd6I6EnRi2rpaYj8W9Y0UHkBOvQ3jR+S8WAU0gGBG3rnLOerhZHxdA XwzdJG7bi53ZtZBn6CxNotaJzT1QSW0PRg4z3kA4QzXyeBjUJXvc5yU+5Btjjadd21C5 cRPe6zXJA27GGREbwF3QDEY4Wji+n4npGoIz+yJa8cZd9b9A/jTkpGlxS8JefMk9OnGC cF4L1DeLYWddNPEBNHDTjo3b4PqspZQ2DWZPXa7vqjO7r4I/3WVzm9Jx91oexaklACZD Ar9GsAwyJ72y235YIfsaT5TX1N09d0yWlaCLDrW6icUnrt5GnFqH0JgLgPJqDp80872i SXUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M3JguiYj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id r14-20020a63ec4e000000b005c5fefca01bsi1338310pgj.770.2023.11.30.05.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 05:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M3JguiYj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3462F80CF552; Thu, 30 Nov 2023 05:44:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345674AbjK3Nnw (ORCPT + 99 others); Thu, 30 Nov 2023 08:43:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345649AbjK3Nns (ORCPT ); Thu, 30 Nov 2023 08:43:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6A06194 for ; Thu, 30 Nov 2023 05:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701351833; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=vXLmPI3YKuWjybHeV+zzmSdSrTMtOftgtk5WyUqCzCo=; b=M3JguiYj/JrTc3QEgd52WCpnSNl3j9jk+C9fDVonEiS46D32sT/Pvnb9Nh1kBF89aXzsbD zSCpuA2KB7lQFlB5d2zohk62oe/azyxTi1oWlS+NPXhIAuQ2so0Rd8BPaVuVMgsH1pcasa 7bVpuZEd+Gync+2VqxerpNnq2en0mBo= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-KQIydSNpM5G-Sd7Q_kv3qg-1; Thu, 30 Nov 2023 08:43:51 -0500 X-MC-Unique: KQIydSNpM5G-Sd7Q_kv3qg-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c993cf572bso10985251fa.3 for ; Thu, 30 Nov 2023 05:43:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701351830; x=1701956630; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vXLmPI3YKuWjybHeV+zzmSdSrTMtOftgtk5WyUqCzCo=; b=wQAvmmsXWE1/GqFoGrO4cTTfYTOQUy4guyigdQPxb3ITqrYZQCtYM2idlK3H7WCDCy lIh6iwSB9JMK7PTR+NFb02HKmlMRtEeAUeLlSGNdDREKFhMtr1hp17XD3xur7tQvk2Gd z3twkqUuMGLHJdsBup3QSFe1kB3qWKkCR/WgodmiLaCaR/uUT5XbC+qfx4E3+raOOdQD srfOIZY6VxiKqzNy4AM21r4jNYuqHYsE0mFQnJkVIO2c/Lu6QEI9bFZfa0RyWpjktduM a3Lo67Yq0s9VccORHe6b5aD3TwyqGhKbhEoVSsCG20CRIGP2TqSj3RpE3ImMy1eCL8to xV0Q== X-Gm-Message-State: AOJu0Yy6ufvY7Yi8vZRQt1NUUEHoIMdYDt0HQdSak3FAFO1thuHFbj5I 3nlin/7Uq2L0YUsALXVufTvIFH2EaBBLu2rH7P3Ygf9M99Kza0YHwrQ0jRPEJTtmZWj6xfAxhAn 7pPqV4mMD1kYMf8qi/QZoRCmz X-Received: by 2002:a2e:9b4d:0:b0:2c9:b4c6:a7ff with SMTP id o13-20020a2e9b4d000000b002c9b4c6a7ffmr5098574ljj.40.1701351830305; Thu, 30 Nov 2023 05:43:50 -0800 (PST) X-Received: by 2002:a2e:9b4d:0:b0:2c9:b4c6:a7ff with SMTP id o13-20020a2e9b4d000000b002c9b4c6a7ffmr5098553ljj.40.1701351829882; Thu, 30 Nov 2023 05:43:49 -0800 (PST) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id s9-20020a05600c45c900b0040b4fca8620sm5777979wmo.37.2023.11.30.05.43.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Nov 2023 05:43:49 -0800 (PST) Message-ID: Date: Thu, 30 Nov 2023 14:43:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC v2 19/27] mm: mprotect: Introduce PAGE_FAULT_ON_ACCESS for mprotect(PROT_MTE) Content-Language: en-US To: Alexandru Elisei Cc: Hyesoo Yu , catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com, pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, eugenis@google.com, kcc@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org References: <20231119165721.9849-1-alexandru.elisei@arm.com> <20231119165721.9849-20-alexandru.elisei@arm.com> <20231129092725.GD2988384@tiffany> <4e7a4054-092c-4e34-ae00-0105d7c9343c@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJI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Tv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 05:44:14 -0800 (PST) On 30.11.23 14:32, Alexandru Elisei wrote: > Hi, > > On Thu, Nov 30, 2023 at 01:49:34PM +0100, David Hildenbrand wrote: >>>>> + >>>>> +out_retry: >>>>> + put_page(page); >>>>> + if (vmf->flags & FAULT_FLAG_VMA_LOCK) >>>>> + vma_end_read(vma); >>>>> + if (fault_flag_allow_retry_first(vmf->flags)) { >>>>> + err = VM_FAULT_RETRY; >>>>> + } else { >>>>> + /* Replay the fault. */ >>>>> + err = 0; >>>> >>>> Hello! >>>> >>>> Unfortunately, if the page continues to be pinned, it seems like fault will continue to occur. >>>> I guess it makes system stability issue. (but I'm not familiar with that, so please let me know if I'm mistaken!) >>>> >>>> How about migrating the page when migration problem repeats. >>> >>> Yes, I had the same though in the previous iteration of the series, the >>> page was migrated out of the VMA if tag storage couldn't be reserved. >>> >>> Only short term pins are allowed on MIGRATE_CMA pages, so I expect that the >>> pin will be released before the fault is replayed. Because of this, and >>> because it makes the code simpler, I chose not to migrate the page if tag >>> storage couldn't be reserved. >> >> There are still some cases that are theoretically problematic: vmsplice() >> can pin pages forever and doesn't use FOLL_LONGTERM yet. >> >> All these things also affect other users that rely on movability (e.g., CMA, >> memory hotunplug). > > I wasn't aware of that, thank you for the information. Then to ensure that the > process doesn't hang by replying the loop indefinitely, I'll migrate the page if > tag storage cannot be reserved. Looking over the code again, I think I can reuse > the same function that migrates tag storage pages out of the MTE VMA (added in > patch #21), so no major changes needed. It's going to be interesting if migrating that page fails because it is pinned :/ -- Cheers, David / dhildenb