Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1303098lqb; Thu, 18 Apr 2024 06:18:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVldhVCSqY1jT5v4hmkdvKShd1/t7EcyT8btkjb4sHpfdZU0gzf7v9zTJudG9jVp3IJmWRVGDrI8yM7qMcNENAIcH/kwOmekFm62Y/StA== X-Google-Smtp-Source: AGHT+IHQDFSW135DrvoVEX0FuA/4AmhsxoOov0l1ye+NwY+CxVD2P+zCxwT2jY5Y0S3bsc5g3xs0 X-Received: by 2002:a05:6a00:2353:b0:6ea:ca90:3459 with SMTP id j19-20020a056a00235300b006eaca903459mr3070965pfj.32.1713446294153; Thu, 18 Apr 2024 06:18:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713446294; cv=pass; d=google.com; s=arc-20160816; b=SbGw+L+aUJ8TpxD5Xm+HyXq1JPn8GOWagCA3pDWA+Of6EYHqLN7K4Y41aSs+nQHP9G k+CCNlcTYtsgeTFetteGR3Vf2tuw5WnWWz9czjCG3zeaDLeN3HcUV+Q+OSPY0iC7qL6S C5DonfyS9UhyKSkXwnLmzxRjJsfzI+5v3dXsfiRSMt0r2hL43vmJWnv+IT78NFM1C0e/ BzT8RYQU2OE9e3Jq3cylEkf8x0X97n6fg9X0+M3k14VIxGfs1gc5rnrZd0XkKLcziQSo 8XbpNWXnM2bO2ZXzazgT7/ulbZsI8uYZ7NnMaTmEXrRtQ/gn7+CdY3PaZRzRCCKVj5eP aZTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=RaI5RA/Q5QPRrrhoR9duIhNVwqkwcc6C9qMHRKNHl+Q=; fh=4+IeEPuL/mY6yi1d9od/gMO3AFNpg7hrztjljxEXcPI=; b=zL83FwVY+vuUB+EmqU/6e+BIy7dFVm/3CWdNELDZyXQgnkjhjj8jfRyiUtEyUEIqX9 dExKMGuRsv6g8Z/l9fHI2AzwSo0q6cMUyjbXcokBE+pyhWkpVlsnFr3bU68zGpoWtKkg GB04b1toQFoZvrAQKpJdkKSfNtoU35N4m6Zce/jrwtmfyTjN/SPNqIaaHR7KiWmeXyT7 LiwxICUGrXZhR6GA8+AgvqUxNaP4+y2+SvgnsaVQ36dt8nUUDhjh91YZgG6sMqzmFkKC BQ0LBsaP5CjNjpgc/tkB83pwpf2nikUu1cWFLcuCqGzeWqHFP4tM0jUOQB2//zFG4gNi mpVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GStT0MXM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-150136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t4-20020a632244000000b005dc956c2c15si1344204pgm.70.2024.04.18.06.18.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 06:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GStT0MXM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-150136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CBA56284D3B for ; Thu, 18 Apr 2024 13:10:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5464A160780; Thu, 18 Apr 2024 13:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="GStT0MXM" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 17440145337; Thu, 18 Apr 2024 13:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445776; cv=none; b=MZO4gUdzaNju7YKoBPkizDMrTEIpFe7OAl714NNjtB2h4lolKe8ivcDGwj/6UCxooVv4zpQIrZ9MlC53XLlN/tXFwjw0lXGCObRILGPi3iWmw6SxgtAJe+sTWT6+JKJQFAGPpKPJho5O+Qiy6850FTGHaHudaqYh1uJzkL+eyKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445776; c=relaxed/simple; bh=Z8LqLKETTuqPbNx9AIZuOgf3LNGzlBMZYBlVi5bQc3A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rnDtckvEwxWz9Et4vskt67uJGDbZ7mgaS51UmbTwIstPRn3h9ei9S32ufvpOxnezeITCzP2cIkQjbPBWy+W24YMo1AbYU23lP/LJLrFqEm1yQfBL3gyVI1aY1JGodfeQJPdsNlcUpdG/ivC/WP3D8d/qoKq/CsRz5kuUQuHThSw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=GStT0MXM; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43ID8jU3007642; Thu, 18 Apr 2024 13:09:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=RaI5RA/Q5QPRrrhoR9duIhNVwqkwcc6C9qMHRKNHl+Q=; b=GStT0MXMLM/fZ9pe8YXt69mb+WpGa4ehYFCflmtI1TebfTGuMbPUuO7bFFnEttDSGBpW wVjQT2tYVG8bdJ5Dp0s8vaUIjKR3RCxcLs48OrDl9BDsHP8mgIt4bC3h/HXWy87Ur1ea OG9YwjXWDQgRJ3xAyBqYuela6as1U9OG3ItFOtMY6xuJO3ksmt8+q6QcY4JBOUX8EU6t aTY6SuWGr6L6Sa3qMYJOWu+A/ACjxwgvja03h9WYrHbiyap/VyGC7jtnVQ3bkhm2zmeo liJWDwa2pRwk/Mgrered6Ws1P8sjCBP9Z2EJssVeAecdv7ag1WdPqSTLHHeM5tyWcBQQ 9g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xk44rr044-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 13:09:28 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43ID9SkW008360; Thu, 18 Apr 2024 13:09:28 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xk44rr041-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 13:09:28 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 43IB566T027289; Thu, 18 Apr 2024 13:09:27 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xg4s0aw1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 13:09:27 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43ID9LH348693672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Apr 2024 13:09:23 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8FB9520043; Thu, 18 Apr 2024 13:09:21 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 591E320040; Thu, 18 Apr 2024 13:09:21 +0000 (GMT) Received: from [9.152.224.222] (unknown [9.152.224.222]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 18 Apr 2024 13:09:21 +0000 (GMT) Message-ID: <453afb13-c7e3-4156-9dbb-c6317503c715@linux.ibm.com> Date: Thu, 18 Apr 2024 15:09:20 +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 Content-Language: en-US To: David Hildenbrand , Alexander Gordeev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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> <8533cb18-42ff-42bc-b9e5-b0537aa51b21@redhat.com> <20d1d8c5-70e9-4b00-965b-918f275cfae7@linux.ibm.com> From: Christian Borntraeger In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: U_NintKTDQIUuOR8ZvOzcdWvOEEHjrHp X-Proofpoint-ORIG-GUID: T0JHOIK5lgqLYJh6QQs6jAcpUgEmZbJt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-18_11,2024-04-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=782 priorityscore=1501 mlxscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404180093 Am 16.04.24 um 15:41 schrieb David Hildenbrand: > On 16.04.24 14:02, Christian Borntraeger wrote: >> >> >> Am 16.04.24 um 08:37 schrieb Alexander Gordeev: >> >>>> 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. >>> >>> @Christian, do you agree with this suggestion? >> >> I would need to look into that more closely to give a proper answer. In general I am ok >> with this but I prefer to have more eyes on that. >>   From what I can tell we should cover all the normal cases with our CI as soon as it hits >> next. But maybe we should try to create/change a selftest to trigger these error cases? > > If we find a shared zeropage we expect the next unsharing fault to succeed except: > > (1) OOM, in which case we translate to -ENOMEM. > > (2) Some obscure race with MADV_DONTNEED paired with concurrent truncate(), in which case we get an error, but if we look again, we will find the shared zeropage no longer mapped. (this is what break_ksm() describes) > > (3) MCE while copying the page, which doesn't quite apply here. > > For the time being, we only get shared zeropages in (a) anon mappings (b) MAP_PRIVATE shmem mappings via UFFDIO_ZEROPAGE. So (2) is hard or even impossible to trigger. (1) is hard to test as well, and (3) ... > > No easy way to extend selftests that I can see. Yes, lets just go forward. > > If we repeatedly find a shared zeropage in a COW mapping and get an error from the unsharing fault, something else would be deeply flawed. So I'm not really worried about that, but I agree that having a more centralized check will make sense.