Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1638644lqp; Mon, 15 Apr 2024 12:14:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmbaoTE3/PKP9HqV/GSzZ1GP5i5stvWJ9LXKRgOWHVqcGFvOuw9WWjcB7bjl4sHfKhaVejIUy+o0dW3HLZFU6gKM5jtGR6O/rrPyKUMg== X-Google-Smtp-Source: AGHT+IHAeSug6+3gTspr5VM7y0SjwHb6kyUFRtRhE35jDMPZSXsxaRHgtMyhUpf7L3DN73xgD8qI X-Received: by 2002:a50:9e82:0:b0:567:824:e36c with SMTP id a2-20020a509e82000000b005670824e36cmr10430812edf.14.1713208459644; Mon, 15 Apr 2024 12:14:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713208459; cv=pass; d=google.com; s=arc-20160816; b=AI0og35E2WABvlPuFZK7uls95surZdsaXYWmvl/tXeDHfSZ6RW5ES4enHsGrGyxh0C PL2qgbrwWVGGiiaCUEbk5OWDgLyQ1FxyCIgqYsykovZlvyQP5IafUVsmJzjwMA0DZUbu bmmfFuTVNxefrzwojttFak7wz0CGuGU+5pVIHa6NSaj8go54tQ5CX3M0arJBUrblE/tI qeNr11jPmSf2Isp5Vk8UPOWYhxl/Ui8HC/ls2eZHLrhcJAakJbWndCWlaVIUEe3kPNUo Wn7KX31D6pZlAiG56A8GdhmY82goyxbBKp+MMqPgihXsEFgYqvLST2aqNcfd1Nd9YUnD RD0A== 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=bMAt0oAbaTmcnLSElf/SBdLJ4dVXqKvD9eBFf4mhfOU=; fh=sRaN3UqgrUemN03COxte8IGzeEeKXAkhoSUdHNcOCaY=; b=XNRa/fot6Y33unSaUP92ZMmC7pZwKWeI5gAU+bOqIZjAk5oXRhfjkgWt+hMqRabQq1 dOcgfSWUThmtNIH+RWKAu54J6TK1cVkdFbyLYS1x3DVuo1qZ6+wd2mq2ObLJsWCFloK4 +A5HjTLsc4ZzLZVqhnuoIOksGMAbGAyk5j9D3kJIeGwKOct4Ua465CixzrqSXwE1i1ut 0hayAGdEd26jdIv+a4xzUceUtl0NOC0mpweAc8zgFsbKGHezCooWcifxyVXCLsQ1F3hI NhjqhwJTfy8VJnKJyy5FZkeU9qvJPwe/wudbcOF0LCNFXOnehSRjshNP5ES4K8MMGcgE wUdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ijNU2v8W; 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-145757-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145757-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 m14-20020a50930e000000b005701e8d118dsi1975093eda.33.2024.04.15.12.14.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145757-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=ijNU2v8W; 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-145757-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145757-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 292131F22C03 for ; Mon, 15 Apr 2024 19:14:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4525D156258; Mon, 15 Apr 2024 19:14:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ijNU2v8W" 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 4127B219EA for ; Mon, 15 Apr 2024 19:14:09 +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=1713208450; cv=none; b=j7WDoT74bJaFGGUnEp8YsHW+8FI1o51t/f5GUgXpTi76sdjKHVjdgdDUZKfQXMdk0Q412HfXFo+ddLYOL8QBpc9h6glI4skQkQtofSdiKayxvuAl9nYchFUh86Yev+3QL6RGBnH67T1/K/D3YOzgDKZHIBXDwhQVYeP+LRDnslI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713208450; c=relaxed/simple; bh=55Pl/vF5UQBIoZhpH0JLS80dLgybZ4QhMUjXOji3+XE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BxxBAMZx2n/FwT9X//c7NaM2ShQJ9McAHwcRuBzOMTLQ83Cl0XlbyBGg26GrYNOEmkCGwYkscg0rE2013Jcgq/PcxexrmK5l9fTB/VRzOrrUgelCNnaRU+4DEOvEiFWIXp8aUQQU1d4yJFW7018z6VZp6vQTc3Usu4mFxhO60ig= 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=ijNU2v8W; 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=1713208448; 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=bMAt0oAbaTmcnLSElf/SBdLJ4dVXqKvD9eBFf4mhfOU=; b=ijNU2v8WO3YNshY+4sdhmDZjvS6pdvk6vksc/ODRc9nNYrsK4LSHT+/BeDcsoEjoC7IPRd 7Iybx1Q3XeUqgJ70DwEczPJD2jd5wmthB98d3UavxGsUqeHns0itzRLpfBKq9/yU/vYHbn 4ntNSSeJu2L7jv6ssIVKA+OsFinDm2s= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-Y2MqCdLzMZO9qyUfqMfCdA-1; Mon, 15 Apr 2024 15:14:06 -0400 X-MC-Unique: Y2MqCdLzMZO9qyUfqMfCdA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-416542ed388so11820535e9.0 for ; Mon, 15 Apr 2024 12:14:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713208445; x=1713813245; 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=bMAt0oAbaTmcnLSElf/SBdLJ4dVXqKvD9eBFf4mhfOU=; b=DofEP2vLMj+cvjzoa/Zgt6ZFBrmBhcpugnnEk6y37JZQzy67YF+UGM3zX8QSXetQzo ibWdPaTn3UN8KvfZ8yQHEvEUbJR++U9055k15VjfBOE+4+vdR9tUiz3PN6YY5rbseJJ0 S9vNbidK9LKddzzKsNqc4rMyq+kAePupKcYAXPnJVU06ogbgWaakhQl8wrylTfdZUByR ipc8ebslHnVKBxIkMiDd9Xe+u+/sJ8SJcTKT7RYdIEDhXPKAgFVQuFV2IqN4XzOZkB0H U1WacZMI04mB/g04pF8Ylx+OoxAwI7+f6/HDwMq//pUZfxaWg/X7hdspyEigM1G7rOu6 z8mQ== X-Gm-Message-State: AOJu0YyVHXmMVKxA1nRCPDdDfatVRmYqz4UZP8rXWe7DEO3+UZe9uEF2 dMTFO4+NdG9FWswWg2B4heBkhkT+jhJwykih2TsU8a8AgHmHQGTMDZFP8YTXLYCADnGlsvtNOlJ qVwQOkv0B3zOe0uMAOpqf9elWXFASgvNprnFnisJ+MqS/3VbAgJPkwxCmXfnkLg== X-Received: by 2002:a05:600c:4ed4:b0:417:caa8:c3f4 with SMTP id g20-20020a05600c4ed400b00417caa8c3f4mr9281079wmq.34.1713208445567; Mon, 15 Apr 2024 12:14:05 -0700 (PDT) X-Received: by 2002:a05:600c:4ed4:b0:417:caa8:c3f4 with SMTP id g20-20020a05600c4ed400b00417caa8c3f4mr9281051wmq.34.1713208445135; Mon, 15 Apr 2024 12:14:05 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:d800:568a:6ea7:5272:797c? (p200300cbc706d800568a6ea75272797c.dip0.t-ipconnect.de. [2003:cb:c706:d800:568a:6ea7:5272:797c]) by smtp.gmail.com with ESMTPSA id s12-20020a05600c45cc00b00417e8be070csm15550664wmo.9.2024.04.15.12.14.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Apr 2024 12:14:04 -0700 (PDT) Message-ID: <8533cb18-42ff-42bc-b9e5-b0537aa51b21@redhat.com> Date: Mon, 15 Apr 2024 21:14:03 +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 v3 2/2] s390/mm: re-enable the shared zeropage for !PV and !skeys KVM guests To: Alexander Gordeev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Andrew Morton , Peter Xu , Sven Schnelle , Gerald Schaefer , Andrea Arcangeli , kvm@vger.kernel.org, linux-s390@vger.kernel.org References: <20240411161441.910170-1-david@redhat.com> <20240411161441.910170-3-david@redhat.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/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcd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Iwlb2mAB9sTNHdMrXesX8eBL6T9b+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 On 15.04.24 20:24, Alexander Gordeev wrote: > On Thu, Apr 11, 2024 at 06:14:41PM +0200, David Hildenbrand wrote: > > David, could you please clarify the below questions? Sure, let me take a look if we're still missing to handle some corner cases correctly. > >> +static int __s390_unshare_zeropages(struct mm_struct *mm) >> +{ >> + struct vm_area_struct *vma; >> + VMA_ITERATOR(vmi, mm, 0); >> + unsigned long addr; >> + int rc; >> + >> + for_each_vma(vmi, vma) { >> + /* >> + * We could only look at COW mappings, but it's more future >> + * proof to catch unexpected zeropages in other mappings and >> + * fail. >> + */ >> + if ((vma->vm_flags & VM_PFNMAP) || is_vm_hugetlb_page(vma)) >> + continue; >> + addr = vma->vm_start; >> + >> +retry: >> + rc = walk_page_range_vma(vma, addr, vma->vm_end, >> + &find_zeropage_ops, &addr); >> + if (rc <= 0) >> + continue; > > So in case an error is returned for the last vma, __s390_unshare_zeropage() > finishes with that error. By contrast, the error for a non-last vma would > be ignored? Right, it looks a bit off. walk_page_range_vma() shouldn't fail unless find_zeropage_pte_entry() would fail -- which would also be very unexpected. To handle it cleanly in case we would ever get a weird zeropage where we don't expect it, we should probably just exit early. Something like the following (not compiled, addressing the comment below): From b97cd17a3697ac402b07fe8d0033f3c10fbd6829 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 15 Apr 2024 20:56:20 +0200 Subject: [PATCH] fixup Signed-off-by: David Hildenbrand --- arch/s390/mm/gmap.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 9233b0acac89..3e3322a9cc32 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -2618,7 +2618,8 @@ static int __s390_unshare_zeropages(struct mm_struct *mm) struct vm_area_struct *vma; VMA_ITERATOR(vmi, mm, 0); unsigned long addr; - int rc; + vm_fault_t rc; + int zero_page; for_each_vma(vmi, vma) { /* @@ -2631,9 +2632,11 @@ static int __s390_unshare_zeropages(struct mm_struct *mm) addr = vma->vm_start; retry: - rc = walk_page_range_vma(vma, addr, vma->vm_end, - &find_zeropage_ops, &addr); - if (rc <= 0) + zero_page = walk_page_range_vma(vma, addr, vma->vm_end, + &find_zeropage_ops, &addr); + if (zero_page < 0) + return zero_page; + else if (!zero_page) continue; /* addr was updated by find_zeropage_pte_entry() */ @@ -2656,7 +2659,7 @@ static int __s390_unshare_zeropages(struct mm_struct *mm) goto retry; } - return rc; + return 0; } static int __s390_disable_cow_sharing(struct mm_struct *mm) -- 2.44.0 > >> + >> + /* addr was updated by find_zeropage_pte_entry() */ >> + rc = handle_mm_fault(vma, addr, >> + FAULT_FLAG_UNSHARE | FAULT_FLAG_REMOTE, >> + NULL); >> + if (rc & VM_FAULT_OOM) >> + return -ENOMEM; > > Heiko pointed out that rc type is inconsistent vs vm_fault_t returned by Right, let's use another variable for that. > handle_mm_fault(). While fixing it up, I've got concerned whether is it > fine to continue in case any other error is met (including possible future > VM_FAULT_xxxx)? Such future changes would similarly break break_ksm(). Staring at it, I do wonder if break_ksm() should be handling VM_FAULT_HWPOISON ... very likely we should handle it and fail -- we might get an MC while copying from the source page. VM_FAULT_HWPOISON on the shared zeropage would imply a lot of trouble, so I'm not concerned about that for the case here, but handling it in the future would be cleaner. Note that we always retry the lookup, so we won't just skip a zeropage on unexpected errors. We could piggy-back on vm_fault_to_errno(). We could use vm_fault_to_errno(rc, FOLL_HWPOISON), and only continue (retry) if the rc is 0 or -EFAULT, otherwise fail with the returned error. But I'd do that as a follow up, and also use it in break_ksm() in the same fashion. -- Cheers, David / dhildenb