Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp151497lqp; Fri, 12 Apr 2024 13:17:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEhV2NNtC0M/TicD6/T8cs/SLWQM3fFZeuJ59rWtCnUglP62thf0hRP+qdw8ZoR8A41avV1tHQNWXt2hF3mwbWQ/99N8zf/HtUK7MCJQ== X-Google-Smtp-Source: AGHT+IFc6OAS1sWRH/BcKXei47PCt0k9aeIn0lJRHwzVnlKHl0vTYyV6jstGxc0ibT9+cOz5SRcy X-Received: by 2002:a05:6512:4c7:b0:516:d219:377c with SMTP id w7-20020a05651204c700b00516d219377cmr2685727lfq.69.1712953048377; Fri, 12 Apr 2024 13:17:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712953048; cv=pass; d=google.com; s=arc-20160816; b=gPseo9bGQ4wWIk/thxkPxvHl1BkH86laURFMhqDIA9zNGw15BLoPJB/ZSLSuwY1Xol uofhUuNCaIP43Ls2jQzdDJ1q3F10mefKDXFPgHHaxcWps772BQ8u+sg/jEC3fKcUPIzE MS1AgS9hiqITe3XbrNV8b8JMgr8oXjrATCvatMa6tKtiNuHCiiUwinjwYP4H8QUzBKSG EvVUXLxx48bnPgPSP3taCSB5f5+xJwNYJcqiI/wgNImW2tBlxt4NFcZcalh1lzpvm72e rRyp82hUgnCFkS1zjIt3fJFElzwzTfQVY6L07SjpS93fFU4aouipCQp9UVDsIMTxok+H EDxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=cc/PPKL5TIazlxmqlsjG+bL4tNA+7xzfInQzkErNbQM=; fh=yTZKNjXjrWHrUsV6g3rTjMtrCPDrZm4sjiLU7u8oxlQ=; b=KLhkXRIZI79dzj2vWsAxRulgRm8I4Z/CivjQBcXYRzpyXPAJOc2QcdYu8WS3xss47R K+puG2emTnHYEuf5AZXrbDUZy0+L6H5m6/MQuSgO0QrfzVybfrmnvlEq8LQBJpK7J3Fa Od/1mbfynFLhePb8Ztkxqc0x0JqRXmugawp1Mv0IjirNwo1sCRl2JFKVvh62A3Rj/LD5 iQdf6kwg/qVA91KmWgMDVJ4umxm4w596MaTaBeJTbNSMFVyyVWsfYwQS61D/ByEy3HEl hy1pyKnviZmm5xGs7K7sW0OSzpL4/VeigIJn4yfHR8KZizi2rYgsvUpZ/k8XEZ3AFh+K UQlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d9y+NxBu; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-143292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t16-20020a508d50000000b005700c8f302bsi96603edt.331.2024.04.12.13.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d9y+NxBu; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-143292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 10DA61F25C6E for ; Fri, 12 Apr 2024 20:16:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4CB31509B9; Fri, 12 Apr 2024 20:16:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d9y+NxBu" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E7F643AC1 for ; Fri, 12 Apr 2024 20:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712953000; cv=none; b=nxVTFZYVeNbotra1KY+Dng7Sq7kUlvgqQoZaJgfOfwuwbPE+rqgBb6nCOuFWMH+uWZD8WvcoIOJeqL38JB1hLc9MyYcxClAGfaBFzanr7mI6etu4offVO2A7YAiLHXAFlU/UgJypGxCmwfiux4zlg1sAAZEEqhVwtyMv+iJ8czM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712953000; c=relaxed/simple; bh=Svlt8fuBsrxZhO95FxYXzFmN/4bxERi6CSfq+ayTkNs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gR+4ZqPUBmo8+Xqgm0XTtFegOhdXBh0ilyqLP0W7hXLIkV2n7GXLveay61BdBLCd4JwmjL8Z0w2wn/pe9dz0edQDpPPRKft1xLkD+yJc7wQ3OZeWzN6amNqlYBnnOKLC/cVucR3Kz2w6SrXCvmhDXTzZMMCUEccqtez1nE/vIJ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=d9y+NxBu; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712952997; 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=cc/PPKL5TIazlxmqlsjG+bL4tNA+7xzfInQzkErNbQM=; b=d9y+NxBu2kblDAKcsbRCRvFCnoRf8dIghfj0e1oCNY0XcYPFUwLG90j7HpX5iA84BoFqd2 MbJVp01SSOi+toKMTHuICMe5JNBRZyqR6wvDxjHlDakcB4iWETgmW7RC8f1Px8jF/8Drm4 xVTTUEXf0tS6LPRS9AjBAU2vcqdk5vU= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-307-T_rFyp5ePLOMCjHF1jyAgQ-1; Fri, 12 Apr 2024 16:16:36 -0400 X-MC-Unique: T_rFyp5ePLOMCjHF1jyAgQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-343c86edeb7so781882f8f.1 for ; Fri, 12 Apr 2024 13:16:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712952995; x=1713557795; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=cc/PPKL5TIazlxmqlsjG+bL4tNA+7xzfInQzkErNbQM=; b=E8UO7P9hs4T89fTpzrv5FBf8h9tSOkoLrPbIDfDPZ6TwYSOhRJXNuqgnJOcdbg7Mmk NyJYwGHJBxOXU0wdU5R2psqrMdc6F3NkXFJYOW0mPx+HroOd8QTK46l9I6qFffzWRvF9 E90mw9r/QpthAi6rSJie0svDb1qULhmdZhY49SIVbg2j+eOkAT0DG/B1B93vbE++7hVd XnrY+mMHDemXURPCeLDeO4fZUz0NwPDNW0sZWiFm4f2+tZQlGeuyOzXdos0cca3bxy+g WIOe8DduqRwfsGrahvqYhH761RbLrIru2kETwM+5WOu9Fo1WUhrCaQWVjjMdM9FSaQvV ouMQ== X-Forwarded-Encrypted: i=1; AJvYcCVNjBeNAOL23vZnTUF2+V8mRzYTkUuyhlicplQgtbAsWau0qeZ1irmyOV+e/TEuKLPXTPZHULMGXFEAYyWUq+cNVaph0Uyg8ky6kFvL X-Gm-Message-State: AOJu0YxhQzUwhQo7LRyJhaQzwmuSAzNftRJZM/ny/BaCP77w3phCiwj8 EtZYQa+u6d0weGBQZewJnCrWLVmCXzZwtYo8DhZ6/iA90qaz30UYN+i9k+A0QlNNOQ+gXm/W9Bs Wli0ylPYoMpbEAmAsrJmC8mwdOpUQ1rZxFansE+WZMfhK8cHT3v0aLM0uG/0Ulg== X-Received: by 2002:a05:6000:1ccd:b0:347:1c20:f262 with SMTP id bf13-20020a0560001ccd00b003471c20f262mr1475425wrb.16.1712952995000; Fri, 12 Apr 2024 13:16:35 -0700 (PDT) X-Received: by 2002:a05:6000:1ccd:b0:347:1c20:f262 with SMTP id bf13-20020a0560001ccd00b003471c20f262mr1475416wrb.16.1712952994560; Fri, 12 Apr 2024 13:16:34 -0700 (PDT) Received: from ?IPV6:2003:cb:c730:f600:afa2:4e8a:448a:9831? (p200300cbc730f600afa24e8a448a9831.dip0.t-ipconnect.de. [2003:cb:c730:f600:afa2:4e8a:448a:9831]) by smtp.gmail.com with ESMTPSA id cg14-20020a5d5cce000000b00346d91ddbe3sm3852185wrb.9.2024.04.12.13.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Apr 2024 13:16:34 -0700 (PDT) Message-ID: <70a36403-aefd-4311-b612-84e602465689@redhat.com> Date: Fri, 12 Apr 2024 22:16:32 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 0/4] Reduce cost of ptep_get_lockless on arm64 To: Ryan Roberts , Mark Rutland , Catalin Marinas , Will Deacon , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Andrew Morton , Muchun Song Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240215121756.2734131-1-ryan.roberts@arm.com> <0ae22147-e1a1-4bcb-8a4c-f900f3f8c39e@redhat.com> <374d8500-4625-4bff-a934-77b5f34cf2ec@arm.com> <8bd9e136-8575-4c40-bae2-9b015d823916@redhat.com> <86680856-2532-495b-951a-ea7b2b93872f@arm.com> <35236bbf-3d9a-40e9-84b5-e10e10295c0c@redhat.com> <4fba71aa-8a63-4a27-8eaf-92a69b2cff0d@arm.com> <5a23518b-7974-4b03-bd6e-80ecf6c39484@redhat.com> <81aa23ca-18b1-4430-9ad1-00a2c5af8fc2@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkm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EpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f 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: <81aa23ca-18b1-4430-9ad1-00a2c5af8fc2@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > > Yes agreed - 2 types; "lockless walkers that later recheck under PTL" and > "lockless walkers that never take the PTL". > > Detail: the part about disabling interrupts and TLB flush syncing is > arch-specifc. That's not how arm64 does it (the hw broadcasts the TLBIs). But > you make that clear further down. Yes, but disabling interrupts is also required for RCU-freeing of page tables such that they can be walked safely. The TLB flush IPI is arch-specific and indeed to sync against PTE invalidation (before generic GUP-fast). [...] >>> >>> Could it be this easy? My head is hurting... >> >> I think what has to happen is: >> >> (1) pte_get_lockless() must return the same value as ptep_get() as long as there >> are no races. No removal/addition of access/dirty bits etc. > > Today's arm64 ptep_get() guarantees this. > >> >> (2) Lockless page table walkers that later verify under the PTL can handle >> serious "garbage PTEs". This is our page fault handler. > > This isn't really a property of a ptep_get_lockless(); its a statement about a > class of users. I agree with the statement. Yes. That's a requirement for the user of ptep_get_lockless(), such as page fault handlers. Well, mostly "not GUP". > >> >> (3) Lockless page table walkers that cannot verify under PTL cannot handle >> arbitrary garbage PTEs. This is GUP-fast. Two options: >> >> (3a) pte_get_lockless() can atomically read the PTE: We re-check later if the >> atomically-read PTE is still unchanged (without PTL). No IPI for TLB flushes >> required. This is the common case. HW might concurrently set access/dirty bits, >> so we can race with that. But we don't read garbage. > > Today's arm64 ptep_get() cannot garantee that the access/dirty bits are > consistent for contpte ptes. That's the bit that complicates the current > ptep_get_lockless() implementation. > > But the point I was trying to make is that GUP-fast does not actually care about > *all* the fields being consistent (e.g. access/dirty). So we could spec > pte_get_lockless() to say that "all fields in the returned pte are guarranteed > to be self-consistent except for access and dirty information, which may be > inconsistent if a racing modification occured". We *might* have KVM in the future want to check that a PTE is dirty, such that we can only allow dirty PTEs to be writable in a secondary MMU. That's not there yet, but one thing I was discussing on the list recently. Burried in: https://lkml.kernel.org/r/20240320005024.3216282-1-seanjc@google.com We wouldn't care about racing modifications, as long as MMU notifiers will properly notify us when the PTE would lose its dirty bits. But getting false-positive dirty bits would be problematic. > > This could mean that the access/dirty state *does* change for a given page while > GUP-fast is walking it, but GUP-fast *doesn't* detect that change. I *think* > that failing to detect this is benign. I mean, HW could just set the dirty/access bit immediately after the check. So if HW concurrently sets the bit and we don't observe that change when we recheck, I think that would be perfectly fine. > > Aside: GUP-fast currently rechecks the pte originally obtained with > ptep_get_lockless(), using ptep_get(). Is that correct? ptep_get() must conform > to (1), so either it returns the same pte or it returns a different pte or > garbage. But that garbage could just happen to be the same as the originally > obtained pte. So in that case, it would have a false match. I think this needs > to be changed to ptep_get_lockless()? I *think* it's fine, because the case where it would make a difference (x86-PAE) still requires the TLB flush IPI to sync against PTE changes, and that check would likely be wrong in one way or the other. So for x86-pae, that check is just moot either way. That my theory, at least. (but this "let's fake-read atomically although we don't, but let's do like we could in some specific circumstances" is really hard to get) I was wondering a while ago if we are missing a memory barrier before the checl, but I think the one from obtaining the page reference gets the job done (at least that's what I remember). -- Cheers, David / dhildenb