From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 0CBCA17996; Wed, 17 Sep 2025 14:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758117620; cv=none; b=Jy8w7efAFUEQT/kZ/1E85xygn6eCEAjd82F/bzW2tRRDPTgFWpuIMJx44x1zoXGSBmw3P4y7XeeUcia3TG60MdLQPYTmtWtj0pcRkkI/6h5iRbTBEcD+q+6WtYB2EGhNwtq3Pn+Q1optCuBDcz9mUB84Bz2FmSGE/ObnGu0oSms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758117620; c=relaxed/simple; bh=qDELSBPbewW9UViHYPERnbJvNMt3pjAMGezfHZON4es=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qo7LlsOMPfMaFnqDlxNuZkxnyPF7+Mh+0bysJm/fJM5tM8CX5a62GDMG6qdsJFT/8YIkQt1K+88TAqH3u+ecb1YfRTHOx5Z24DlYwGgTT0Rvr5XnWLa9DFe0LgD0Qsti+DuLwzeWOPDCE9T7puQoarqyLi02FbhU1Fx+ZsGVleg= 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=BL6eQ5z9; arc=none smtp.client-ip=148.163.156.1 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="BL6eQ5z9" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58H8nO5e027677; Wed, 17 Sep 2025 14:00:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=zGqTf3 RGn/itpBlrDNp495hY7ceeC4TUkBQSJnQnLD0=; b=BL6eQ5z9cL5OcBpMvg5uxY xqCQjhzhPWZhuV2MBGAtGBDy9CknDKV+CUfBIPwrwC/J2+SgSIwDDrGjmWbv6dwq Ha3zdm5juzaPmqoeJ5lLGb0lCeEHBHWRi2o9dOvtSN8Mi15RdLze1p59y2YZK9B1 B48PeIZ/5bwcFaU7dl+nQmJEZvxOBc0PqGiPDAJgfSGwuwOCXH2ebmPpywr9mBQn Dc66ig+oImpQt8Mb+ka9+ldBXgea8uETb9p6qencVspD7NUnqgsJXfmYZjcyC+UU x40fj8WLTITIa9L5II7PWMsyx9HpF4YxVMFXtBhMFX25t/kUYGN/OjvfdGFHVzKg == Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 497g4p45b1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:00:16 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 58HB1ssU027341; Wed, 17 Sep 2025 14:00:08 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 495men9fpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:00:08 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 58HE04gr34407022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Sep 2025 14:00:04 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4AFF820043; Wed, 17 Sep 2025 14:00:04 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B9DA20040; Wed, 17 Sep 2025 14:00:04 +0000 (GMT) Received: from p-imbrenda (unknown [9.152.224.66]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 Sep 2025 14:00:03 +0000 (GMT) Date: Wed, 17 Sep 2025 16:00:02 +0200 From: Claudio Imbrenda To: Christian Borntraeger Cc: Heiko Carstens , kvm@vger.kernel.org, linux-s390@vger.kernel.org, frankja@linux.ibm.com, nsg@linux.ibm.com, nrb@linux.ibm.com, seiden@linux.ibm.com, schlameuss@linux.ibm.com, svens@linux.ibm.com, agordeev@linux.ibm.com, david@redhat.com, gerald.schaefer@linux.ibm.com Subject: Re: [PATCH v2 08/20] KVM: s390: KVM page table management functions: allocation Message-ID: <20250917160002.778b1905@p-imbrenda> In-Reply-To: <976f2cf6-e56f-4089-923d-29098746018b@de.ibm.com> References: <20250910180746.125776-1-imbrenda@linux.ibm.com> <20250910180746.125776-9-imbrenda@linux.ibm.com> <20250916162653.27229G04-hca@linux.ibm.com> <20250916184737.47224f56@p-imbrenda> <63e8c905-28b1-4e1f-be77-e0789bd75692@de.ibm.com> <20250916190514.1a3082bd@p-imbrenda> <15f451d9-ecb3-4a82-9b9a-2de64b93944d@de.ibm.com> <20250916173644.27229Kcc-hca@linux.ibm.com> <20250917072733.7515Af5-hca@linux.ibm.com> <20250917132556.4814fe98@p-imbrenda> <20250917123006.7515C59-hca@linux.ibm.com> <20250917151124.1a53b0a6@p-imbrenda> <976f2cf6-e56f-4089-923d-29098746018b@de.ibm.com> Organization: IBM X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTE2MDIwNCBTYWx0ZWRfX7AzIJthoaFpE kEMezcsjUYTlYBe4Y8r2fxD5DjlNwrvGXz7gNkuxTUCHhGueL5FtvNicmDNq7CqbxND0Ygx1eO5 /agP263/loWG3H64H6IbcxBasqJGtlhIbBH/EUEffrrM8XfDlneHKyf7H3/rhrbMOpYs7zB+z4o 1D/MEkfOQ9O4AkZ6RqgrouM7rKoZTMdAYLvev2P3a4Rkdc5u3gT7eA3kTVU4H7TiqnBO7O5H0ku +0CANkv33SVm7kUAXPhByWaf969GZXC/Gze5IbnHI84qbvg/6G72KiCmDSCNtsoCAkWulrvm8Nf bCdLK9SnOd0o8l+TP39VkRAgrzQp7bEZQpTIBFQNOTBph7ayws4wmrCBrJmcQinkA1TNaz0NV1/ M+9VzOEp X-Proofpoint-ORIG-GUID: LSka-GKLP6UwJOhsi4ZFvjthZiVBqkmt X-Proofpoint-GUID: LSka-GKLP6UwJOhsi4ZFvjthZiVBqkmt X-Authority-Analysis: v=2.4 cv=cNzgskeN c=1 sm=1 tr=0 ts=68cabef0 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=kj9zAlcOel0A:10 a=yJojWOMRYYMA:10 a=VnNF1IyMAAAA:8 a=jfXe4LG6N2JJ2hfJZe0A:9 a=CjuIK1q_8ugA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-17_01,2025-09-17_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 priorityscore=1501 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509160204 On Wed, 17 Sep 2025 15:26:33 +0200 Christian Borntraeger wrote: > Am 17.09.25 um 15:11 schrieb Claudio Imbrenda: > > On Wed, 17 Sep 2025 14:30:06 +0200 > > Heiko Carstens wrote: > > > >> On Wed, Sep 17, 2025 at 01:25:56PM +0200, Claudio Imbrenda wrote: > >>> On Wed, 17 Sep 2025 09:27:33 +0200 > >>> Heiko Carstens wrote: > >>> > >>>> On Tue, Sep 16, 2025 at 07:36:44PM +0200, Heiko Carstens wrote: > >>>>> On Tue, Sep 16, 2025 at 07:06:06PM +0200, Christian Borntraeger wrote: > >>>>>> > >>>>>> Am 16.09.25 um 19:05 schrieb Claudio Imbrenda: > >>>>>> > >>>>>>>>> I think GFP_ATOMIC actually gives more guarantees? > >>>>>>>> > >>>>>>>> In real life GFP_ATOMIC can fail, GFP_KERNEL does not.All gfp allocation failures > >>>>>>>> are usually the atomic ones. > >>>>>>> > >>>>>>> interesting... then I guess I need GFP_KERNEL | GFP_ATOMIC ? > >>>>>> > >>>>>> No. ATOMIC always means: can fail. > >>> > >>> my issue is that GFP_KERNEL can sleep, and this allocation is sometimes > >>> called from atomic contexts (e.g. while holding spinlocks) > >>> > >>> the right way to do this would be with mempools, to allocate memory > >>> (and potentially sleep) when we are not in atomic context, and use it > >>> whenever needed. this is on my to-do list for the future, but right now > >>> I'd like to avoid having to refactor a ton of code. > >> > >> I doubt this is accetable even for an intermediate solution. As soon > >> as the host is under memory pressure and starts doing I/O to free up > >> memory, you will end up in -ENOMEM situations for simple guest page > >> allocations. > >> > >> What happens with a guest in such a situation? Is this gracefully > >> handled without that the guest is terminated? > > > > well, we return -ENOMEM to userspace (and qemu will probably kill the > > guest) > > > > but if we can't even allocate 16kB, probably we're already in a pretty > > bad situation > > > > if you think this is not acceptable, I guess I'll have to implement > > mempools > > This is not acceptable. 16k atomic allocations are pretty much guaranteed > to fail after a while of high workload. > What are the callers of this allocation? literally anything that touches the gmap page tables, since we need to hold kvm->mmu_lock, which is an rw spinlock I'll use mempools