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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8ED0FCC9A8 for ; Tue, 10 Mar 2026 00:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To: Subject:MIME-Version:Date:Message-ID:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VnuBcNj8anj4K3FWJNbuJRdCYOOHJKGbPVbN4rxvT08=; b=feEnSKHjXxFcRj 4XuJCYqGtxCnJh+mYS+yKbi9kFTXf3MOqIVgt+rGPYvPt0q1HSfT9LLkABKfKj0WW83N0Z1GmJz1h GR+LKUPh4wSk0lfgzLQXiiBTo+19CSpGy8RJD2sN9CePiXqRMr7mnBAZf4TzDJWgGwKKbGZy23xVg 8XivFKMzHA86rToPtlpDGqgY0Ns8RYOEkbA2WfGl1BG2FWqolb8Vmuq0LPWeZtqUvgQ03B0PJ8TUp x8+hPaUofPfaKV8WO352pk81+ep/0/1qxbiaoM7lT9i1Bl8V1Xe2PuhLprZj4YFZVKC+KF5cVSq/7 7w7U3YFupuuhezjkidLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vzkWa-00000008Kaw-3jUj; Tue, 10 Mar 2026 00:00:36 +0000 Received: from fra-out-003.esa.eu-central-1.outbound.mail-perimeter.amazon.com ([3.72.182.33]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vyXJe-000000043Ws-2LEB; Fri, 06 Mar 2026 15:42:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1772811734; x=1804347734; h=message-id:date:mime-version:reply-to:subject:to:cc: references:from:in-reply-to:content-transfer-encoding; bh=zlv5A21skW2cpWW+wfG6AmLOagqEDkrIsCoF7K54pBc=; b=HjUgjvU3l8JCmKgYUMw4Ygy9Aim7IUwMscTQgjIYKFQOxN1QCQi3LM9K ZpvWbKNZzIlzvT0SdXoAxPhz2h3U5its1gk5MKhPEVO4j73IR3gwDdtjg 1uZxF5FQ+pFTnSOHUSDJN3ygVO+NjEGkVOix0IHzWSti39+6hNK1dMHNj F3ut/ITRAQ+fP58I3H1ZLkMGiesjuWqoQ4KQAqDxH8CL6S5U03xBYX5iH W8FB3OMlqyDjhNo0KEmoVJgZTMVnRYBZxP8vjqcU2KZHyLbA0KKtx0H74 xDYhnx+0vn7TqhzNYwbV5V80J6xqT09R+yok7M0sTV820BeTY8XCFor66 A==; X-CSE-ConnectionGUID: /M9OfjBRTeKqpDhCE8ldMA== X-CSE-MsgGUID: 0Bb6xkULS3yW60j2eb25+A== X-IronPort-AV: E=Sophos;i="6.23,105,1770595200"; d="scan'208";a="10435125" Received: from ip-10-6-6-97.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.6.97]) by internal-fra-out-003.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2026 15:42:09 +0000 Received: from EX19MTAEUB001.ant.amazon.com [54.240.197.226:28153] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.5.165:2525] with esmtp (Farcaster) id 8290e714-6a53-45c7-af32-ec04f3406384; Fri, 6 Mar 2026 15:42:09 +0000 (UTC) X-Farcaster-Flow-ID: 8290e714-6a53-45c7-af32-ec04f3406384 Received: from EX19D005EUB003.ant.amazon.com (10.252.51.31) by EX19MTAEUB001.ant.amazon.com (10.252.51.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Fri, 6 Mar 2026 15:42:07 +0000 Received: from [192.168.2.180] (10.106.83.26) by EX19D005EUB003.ant.amazon.com (10.252.51.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Fri, 6 Mar 2026 15:42:02 +0000 Message-ID: <6dcbcdcb-bfdd-43a3-b724-599a717c1054@amazon.com> Date: Fri, 6 Mar 2026 15:42:01 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 09/15] KVM: guest_memfd: Add flag to remove from direct map To: "David Hildenbrand (Arm)" , "Kalyazin, Nikita" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "bpf@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "kernel@xen0n.name" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "loongarch@lists.linux.dev" CC: "pbonzini@redhat.com" , "corbet@lwn.net" , "maz@kernel.org" , "oupton@kernel.org" , "joey.gouly@arm.com" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "catalin.marinas@arm.com" , "will@kernel.org" , "seanjc@google.com" , "tglx@kernel.org" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "luto@kernel.org" , "peterz@infradead.org" , "willy@infradead.org" , "akpm@linux-foundation.org" , "lorenzo.stoakes@oracle.com" , "vbabka@suse.cz" , "rppt@kernel.org" , "surenb@google.com" , "mhocko@suse.com" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , "martin.lau@linux.dev" , "eddyz87@gmail.com" , "song@kernel.org" , "yonghong.song@linux.dev" , "john.fastabend@gmail.com" , "kpsingh@kernel.org" , "sdf@fomichev.me" , "haoluo@google.com" , "jolsa@kernel.org" , "jgg@ziepe.ca" , "jhubbard@nvidia.com" , "peterx@redhat.com" , "jannh@google.com" , "pfalcato@suse.de" , "shuah@kernel.org" , "riel@surriel.com" , "ryan.roberts@arm.com" , "jgross@suse.com" , "yu-cheng.yu@intel.com" , "kas@kernel.org" , "coxu@redhat.com" , "kevin.brodsky@arm.com" , "ackerleytng@google.com" , "maobibo@loongson.cn" , "prsampat@amd.com" , "mlevitsk@redhat.com" , "jmattson@google.com" , "jthoughton@google.com" , "agordeev@linux.ibm.com" , "alex@ghiti.fr" , "aou@eecs.berkeley.edu" , "borntraeger@linux.ibm.com" , "chenhuacai@kernel.org" , "dev.jain@arm.com" , "gor@linux.ibm.com" , "hca@linux.ibm.com" , "palmer@dabbelt.com" , "pjw@kernel.org" , "shijie@os.amperecomputing.com" , "svens@linux.ibm.com" , "thuth@redhat.com" , "wyihan@google.com" , "yang@os.amperecomputing.com" , "Jonathan.Cameron@huawei.com" , "Liam.Howlett@oracle.com" , "urezki@gmail.com" , "zhengqi.arch@bytedance.com" , "gerald.schaefer@linux.ibm.com" , "jiayuan.chen@shopee.com" , "lenb@kernel.org" , "osalvador@suse.de" , "pavel@kernel.org" , "rafael@kernel.org" , "vannapurve@google.com" , "jackmanb@google.com" , "aneesh.kumar@kernel.org" , "patrick.roy@linux.dev" , "Thomson, Jack" , "Itazuri, Takahiro" , "Manwaring, Derek" , "Cali, Marco" References: <20260126164445.11867-1-kalyazin@amazon.com> <20260126164445.11867-10-kalyazin@amazon.com> <13ed00e1-f0db-4326-a800-2ba306833921@kernel.org> <690c22f9-b71a-4f14-9857-008c7c858373@amazon.com> <0c0b911c-cda2-44a4-897e-361e02be7da5@kernel.org> <936fa782-d937-4b14-b92d-cc8707336e5e@amazon.com> <9b4b9f48-595d-46c9-8f77-fc021ac2619c@kernel.org> Content-Language: en-US From: Nikita Kalyazin In-Reply-To: <9b4b9f48-595d-46c9-8f77-fc021ac2619c@kernel.org> X-Originating-IP: [10.106.83.26] X-ClientProxiedBy: EX19D011EUA003.ant.amazon.com (10.252.50.178) To EX19D005EUB003.ant.amazon.com (10.252.51.31) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260306_074215_091554_F1431BDE X-CRM114-Status: GOOD ( 16.54 ) X-Mailman-Approved-At: Mon, 09 Mar 2026 17:00:27 -0700 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: kalyazin@amazon.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On 06/03/2026 15:16, David Hildenbrand (Arm) wrote: > On 3/6/26 15:49, Nikita Kalyazin wrote: >> >> >> On 06/03/2026 14:22, David Hildenbrand (Arm) wrote: >>> [...] >>> >>>> >>>> Dave pointed earlier that the failures were possible [1]. Do you think >>>> we can document it better? >>> >>> I'm fine with checking that somewhere (to catch any future problems). >>> >>> Why not do the WARN_ON_ONCE() in folio_restore_direct_map()? >>> >>> Then, carefully document (in the new kerneldoc for >>> folio_restore_direct_map() etc) that folio_restore_direct_map() is only >>> allowed after a prior successful folio_zap_direct_map(), and add a >>> helpful comment above the WARN_ON_ONCE() in folio_restore_direct_map() >>> that we don't expect errors etc. >> >> My only concern about that is the assumptions we make in KVM may not >> apply to the general case and the WARN_ON_ONCE may become too >> restrictive compared to proper error handling in some (rare) cases. For >> example, is it possible for the folio to migrate in between? > > Not without migration support. But then, migration would have to make > sure that the destination folio has the direct map removed. So I > wouldn't worry about that. > > Once you return an error from folio_restore_direct_map(), you better > document when/why it happens and how the caller should handle it. > > There is nothing existing callers could really do, so it's an > implementation detail of the > folio_zap_direct_map()/folio_restore_direct_map() functions to make sure > it keeps working. > > If it ever fails, we'll have to figure out how to keep the interface > working. > > You can document any restrictions regarding when > folio_zap_direct_map()/folio_restore_direct_map() is allowed to be used > in the kerneldoc. Ok, makes sense to me. > > -- > Cheers, > > David _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv