Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp43337lqd; Tue, 23 Apr 2024 14:03:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnTFV7mOPdP7F6ZBwySJbUE5CaRrG02nLHWmZzz0ti7zpYdm7GR1ME4tFAMtsH8xSDPYzOWGn6dd87FiCZgLFH7rXDxVfiidC4ccNovQ== X-Google-Smtp-Source: AGHT+IHhaXVx8r7ZMxex57JkMZlFCGUkjJ6LfhuyDorl8EottOsnpLqR4MrkG2idbOBEp/C+66uU X-Received: by 2002:a05:620a:2952:b0:790:7354:6500 with SMTP id n18-20020a05620a295200b0079073546500mr889729qkp.31.1713906192822; Tue, 23 Apr 2024 14:03:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713906192; cv=pass; d=google.com; s=arc-20160816; b=W9AdGc4cLlBgRrAlX/+FwLB0NyjU3fMR4s0JQ3qxEeLo0jTkRyOAnCy+VY16/Xs/5t FV4gOKBhnKD9quY2WeOAMC2JKiSJUDEYWX/FEY1ROm7lXRnRG0NKTIqTYF73c1tZOubL gK70oSo1hH/eJH3vyuEJL9WB1qgL6EQwiL1wP3ZhDnmdEbLH+kF84jQ/0YQcN2L7klpi eiHLDxLYAGY/z3DoaDUa5VxVxpJIT/hcl3k79ebV5dmSz2jKDyL/MPSzGKcpj/vfgjTx svT5ZKI0e/NfqvmhIfc/HB+JDccdMHYZB5XRJXbvaf58momMBfxTFatEbR5roYYPzH9b 5Wog== 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=Zxyy28Md6aPh5qs5ewJe58rAyJq1+GKjWz4Z6iDmhPc=; fh=JEQaWhFlYZ2PdixiBRrc0G1/1zIffETtahCGbcbRdLg=; b=KLZ9ycmK24EVMVvcccVKOfCkElXGWetFo6vLbhNCS2O5eZnLJY2roNbSXjPRhn69md 0LJgn1SvH/b78pVlZbWwwKtVTvkp+axAFYAwGzPY8RT4kk/AiOCsCoejLmn8Lktkd7fg brTbldpquDvECH1iDlp3QrMegSrfRVwhnRPOAAXige0K+otYSthNaq/f5e7iDZ4RLMjx wyYsgo4Q3ZKTuyQ6C9t2GxuR/cmF6qT3szFab9P8hX8vnyH4i5h6VsHa1daW8aznvSoS eEOijCyjJ8wTkg/dzlGbtLCDGXSUlPeEpFgQkIshqLiBMtqkzG35ggJeqS6OPN9M9XKM H1aA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BgvAATui; 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-155900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wl23-20020a05620a57d700b0079088fb07besi1133440qkn.154.2024.04.23.14.03.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BgvAATui; 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-155900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155900-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AA8281C22DBE for ; Tue, 23 Apr 2024 21:02:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFBE2143866; Tue, 23 Apr 2024 21:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BgvAATui" 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 4946A142E70 for ; Tue, 23 Apr 2024 21:02:45 +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=1713906167; cv=none; b=cYH1JgIHaEHFaPJGYwUbKOeJDZpSUFEjYePVSvlAzhJWPEEV2bVJz7SeFiwKI0iwJ0R/XBT6nLuTWDk4/LYOhrapxEYgzIfqSnehiBvhN8BwHCH0MeDuyVQ2lQpuFC3ln2tpMVqwGYf30mTB9KzRj8tISrnPxf5VnLhImjmswJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713906167; c=relaxed/simple; bh=42nvruzyY6ImBqfKJnawPKvzV07Fr0CgGhbxyeE6jgA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OLSS4btc38xF8Vp07/GlJyallGcpNYODmBNHO5AroJWrVMB+GQ5Aj7DrNrZypWjAjAosZVXKwKq14fCNaF+7xAoAOJ8nr2uYQNlcwpRladqVflv0C3tGFB7QlVq/mr5Ie76oENQerKYvI5snMfXZzym1nKn04zkNS+KCawbuIWU= 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=BgvAATui; 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=1713906165; 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=Zxyy28Md6aPh5qs5ewJe58rAyJq1+GKjWz4Z6iDmhPc=; b=BgvAATuijUulfsdJCgMtUf8GO0VG+s0wXnVSGSGhTPB7+Fenq5QVi4SLZdKSbAYr/a+PB3 B2MWs+Nly4T6mL6vPzOzJyxURnHTe3Rc2BCBMhrZtt0vmpI/NavDSGsPLrww1tLDpcBjbk B46l7slw3HDXorYLAf08idotjgXhg2E= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-571-ixPxxFIAPhKV_m2L4WzSAQ-1; Tue, 23 Apr 2024 17:02:43 -0400 X-MC-Unique: ixPxxFIAPhKV_m2L4WzSAQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-418df23b51cso25159855e9.1 for ; Tue, 23 Apr 2024 14:02:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713906162; x=1714510962; 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=Zxyy28Md6aPh5qs5ewJe58rAyJq1+GKjWz4Z6iDmhPc=; b=VaTddb8fcPtWqIIXJiE1m+tsf28+5diDUz7E/BretFt6Xd6ra/kaeqTvojgCiEGEat zBrrF80C/TdKheVqRaf/n/Q2WoodUjvOQLeWeQPlf0nNsllQlGbvwtHVVPOB/DR/gtZv tAjeI9HaNBfJPXPB9AAcU3dWRqNWkMfuXnmPp9GvUSF+FQh535xY9V+fyNpYzQIhI+mA NawrER4FiaNHAo2psUK8G9EjfXrF2qvonFiGTebGJXTuVpMtMzHgGIx+XCyN5CIYIFzH nzaOo3flZMd++F61rZ70mXPPU+YlfdszD4zMTdBkjUeMVZ24i3zUqRGvL74na4WvVtGd egNg== X-Forwarded-Encrypted: i=1; AJvYcCXIVF/zjqd1wLMK2UuPuYsodLm9wlL5Qfe8gzBUvuFZTh7OKcBmLiB/zUPT4UNE9vOgHIRMzliehzmABG9QYvSoLSY73WDs3nZXK1mj X-Gm-Message-State: AOJu0Ywd3+u7Bv+/D49GT+67VpeAWNhkrTRsE3TwY6bsn3S6scb+yN07 h2t38g5yv8q6emYtV3jO2cXvE7I02hqg03LgJe49oD0+toaxEZkVO9785NL4gJjJDabZFLJl1Ay uFcd6cj7RZtjaVl8mv0qmEd0+TJSX3w6TM84rHIX2TvURpae3zKyOf1rnZ6YxRw== X-Received: by 2002:a05:600c:154f:b0:418:e08c:817 with SMTP id f15-20020a05600c154f00b00418e08c0817mr261595wmg.32.1713906162424; Tue, 23 Apr 2024 14:02:42 -0700 (PDT) X-Received: by 2002:a05:600c:154f:b0:418:e08c:817 with SMTP id f15-20020a05600c154f00b00418e08c0817mr261583wmg.32.1713906161979; Tue, 23 Apr 2024 14:02:41 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:fd00:fb07:92f8:8f0c:6a08? (p200300cbc706fd00fb0792f88f0c6a08.dip0.t-ipconnect.de. [2003:cb:c706:fd00:fb07:92f8:8f0c:6a08]) by smtp.gmail.com with ESMTPSA id n2-20020a05600c4f8200b0041884b79b81sm21451088wmq.1.2024.04.23.14.02.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 14:02:41 -0700 (PDT) Message-ID: Date: Tue, 23 Apr 2024 23:02:40 +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: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking To: Shivansh Vij , Ryan Roberts , Mike Rapoport Cc: Catalin Marinas , Will Deacon , Andrew Morton , Shuah Khan , Joey Gouly , Ard Biesheuvel , Mark Rutland , Anshuman Khandual , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kselftest@vger.kernel.org" References: <20240419074344.2643212-1-ryan.roberts@arm.com> <24999e38-e4f7-4616-8eae-dfdeba327558@arm.com> <9e73ad2f-198c-4ab5-a462-2e238edd9b34@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8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Ab5eOS8h+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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit >> >> Shivansh, do you speak for CRIU? Are you able to comment on whether CRIU >> supports checkpointing an app that uses uffd? > > I do not speak for CRIU - I'm just a user (and hopefully a future contributor), but not a maintainer or owner. I can however comment on whether CRIU supports checkpointing an app that uses UFFD - it doesn't. Looking through both the implementation of CRIU (specifically how they restore memory [1]), and at recently filed Github issues [2], it's pretty clear that CRIU doesn't support processes using UFFD - that they do not currently have plans to [3]. Thanks for all these pointers! > > [1] https://github.com/checkpoint-restore/criu/blob/criu-2.x-stable/criu/mem.c#L683 > [2] https://github.com/checkpoint-restore/criu/issues/2021 > [3] https://github.com/checkpoint-restore/criu/issues/2021#issuecomment-1346971967 > >>> >>> Further ... isn't CRIU already using uffd in some cases? ...documentation >>> mentions [1] that it is used for "lazy (or post-copy) restore in CRIU". At least >>> if the documentation is correct and its actually implemented. >>> >> >> Shivansh, same question - do you know the current CRIU status/plans for using >> uffd-wp instead of soft-dirty? If CRIU doesn't currently implement it and has no >> current plans to, how can we guage interest in making a plan? >> > > While I cannot gauge whether the maintainers or main contributors of CRIU plan on using uffd-wp instead of soft-dirty in the future, I can tell you that there is no currently open issue to track that work, and whenever anyone in the past has asked about ARM64 pre-dump support to CRIU (which is the feature that uses soft-dirty/would use uffd-wp), they've always just said it's not supported - but that they do want the feature [4]. > > So in summary, they want the feature, but no one is working on implementing it (either with soft-dirty or with uffd-wp). > > I doubt that CRIU would have any issues with adding the feature via soft-dirty (since, as shown in [4] they're interested in it), but as for using uffd-wp they definitely haven't shown any interest thus far. Based on the fact that it would be a very significant amount of work and it would really only be for ARM64 support (which they're already fine without), I'd be very surprised if they were interested in pursuing it. > Of course, nobody wants to do the work. But that doesn't mean that the kernel has to do the work :) If there are some major challenges why it cannot possible be done with uffd-wp (unfixable), that's a different story. > [4] https://github.com/checkpoint-restore/criu/issues/1859#issuecomment-1972674047 > >>> >>>> >>>>> But I'll throw in another idea: do we really need soft-dirty and uffd-wp to >>>>> exist at the same time in the same process (or the VMA?). In theory, we >> >> My instinct is that MUXing a PTE bit like this will lead to some subtle problems >> that won't appear on arches that support either one or both of the features >> independently and unconditionally. Surely better to limit ourselves to either >> "arm64 will only support uffd-wp" or "arm64 will support both uffd-wp and >> soft-dirty". That way, we could move ahead with reviewing/merging the uffd-wp >> support asynchronously to deciding whether we want to support soft-dirty. >> > > My personal preference is having both approaches supported - especially in the context of CRIU since I doubt they'll be willing to rewrite all of the dumping and restore logic just for ARM64 support. Sure, nobody does any work unless they are forced to. But this is something that arm64 maintainers will have to decide. Let's start with uffd-wp that has other well-known users that could benefit (e.g., QEMU background snapshots). -- Cheers, David / dhildenb