From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AFBF32E145 for ; Thu, 18 Dec 2025 12:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766060250; cv=none; b=Y+9lzpU89F2H/+BKcC2FlCKEsqp9EQqK3Tq/ZzfCdlDwPO0ujJzah5x1V9krnK5pK+MBiyQ4jFlcMijEwt3dIyThVQByjAr5xiRr7tke8cw4JqHCJMlMhuTdI6oC20MEhdwunZjbSU9dsMrmSKvRuFGy4e700nKVm1NAPAz8ue8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766060250; c=relaxed/simple; bh=TK3q9Qn/Pe4y7lyna7D732vtlt/WgAJ3OxwB0ciLL7w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CI5vJDWGDRAQNpvpn1Icyx8ZLeo1RsUePbAYjhjrpfSUDwiVjDUEw7obUF+3oo/RgXsHWgRsIL3AxHqjP3Vszw1qqYwXZlM+tHG3UO/+K6dW8DcqRupgmeBbadTni/eKuOQowmfSKM4QCl+IcT79kpqa4Ql0oNu2io+ohXtt5Ho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=eSXjjlDu; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="eSXjjlDu" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47bdbc90dcaso4152085e9.1 for ; Thu, 18 Dec 2025 04:17:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1766060246; x=1766665046; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=82ryBTb0OYajbtmHnpP2vY6hULmAqRanYTWCsyHvjaM=; b=eSXjjlDuYzsJ8jklmmUNqKAd6QmQQ95OtAe77JetPa8o4oTWylnDwQjo0qMEEIyT9v Su0VOGOUmd7HNyVuCS13ftVzZvzieD5wkBqF616l29nozYgStoh5AhuDeYigyuGiIVhp o/fEA6WkFc3M2htmgnNzl6AkTwapn/XE9A6HafNk/QLMVK+9o6gobHDGsL1UODTZ6JSR m8dSPq1I39MppYyAnl6Vcv5oF5tM+67iVYcW6v+qHUrg/+UktxwKcNZL8/owszU/UvQq eFfuN2Z9PY/KPEo68Hs9eAa82ds/JhqVVciXSf+f9do9LNfjTSSy73Y2mzG+SNaNK9V3 Oy9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766060246; x=1766665046; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=82ryBTb0OYajbtmHnpP2vY6hULmAqRanYTWCsyHvjaM=; b=bg/gM34hhaR2+gGu1O1nveqehN0Eu7O3x3QtraHO8RFFdIAsqONdX9aA8E0oofgzpP u8XbGq63aqg9a3l3TV/xsx+Fuf2obd6bhJ2O0WKn/E1eumAm6EJLZi7FtvXK+beQEYTO VivRV9B6ehnim3mmC9ismj1aBbC2K12njWSpAgo72gs6gOQOMTiz84KjKFN/ti6XFB7H VoXE7JLjHA9i013v3G47dSt4kl+zeze9h9j3MOiH1j4/+w53/1HiBt9sQNfqKU2GrPL8 HI1sp8XoIziQj8dgC5SB90aTZOoeJkqnAgBpwHp2CWqnlAa+zSN2oGb7HxQ4uH8xn3vX H9Jw== X-Forwarded-Encrypted: i=1; AJvYcCW8FTHvjaq4x62+v7TrgFBLSV3PV2eo8VJcbeT480Y5M5VNGk3x+iD82DUF3gWkx7XVFlLFY96XNd3+mNo=@vger.kernel.org X-Gm-Message-State: AOJu0YwIN05q4j2T9sBoGJAFrDRDBNPcQ2Jlr4HnAhw+RFwn2Ke3cM07 ILwimj4dAH7dUZRKIo3XQrpIcDoWZ0XOuC52MCoyK5MZShA4eka4yK2u+ecfy06OxSc= X-Gm-Gg: AY/fxX40ekY/dnDVPq+/cWAOV9hNLmY2ExZaVFVVxQ+O9eEK1mVb69gqFd1HeNjtf5i 2/H4Xy/6q9GmR9GdI7Z9gBT8+KGksZqwfj4BezA7UbxkLVkevEtrz1KJ8YEb/A/tpOCHspeseH6 GZf63epvL2DMURG70HDR7aB0R8lswKYm+++ifVo0oofmkD0dPLBHOuqrBRkAOhs3zgEaWBVz3Er qS83dNrBSDb01l+5htnPc1kgF8RudJ4wNVy/mRRo+ws+FqQKn1iFNe8TMnubXfu9incU1g0W7zE v6QrDokRwn90AHc4HETHs1ANAx7qm/NB5nf3YvnqltXEzn+elQvCgEl0aJUqtDBzBh6o4uOHiC0 GGhn0TMnSeilECFExRV9ScEXk7NA2bFwMOw2UlKPdgh04tlRpoqHRyzrTujbBlbISyV9HnPKhhQ l83txSBF47CF9Lkz1sTgDvQ8FI8UhtQXf6EEg= X-Google-Smtp-Source: AGHT+IGTUeEzz8tNPQ2pmX/MnRbtFTT5HvfYasuVnspclS+oD1dD2L49trQ2Os59ODIZ3jVEB6x5aw== X-Received: by 2002:a05:600d:6405:20b0:47a:935f:618e with SMTP id 5b1f17b1804b1-47a935f64d7mr172794535e9.15.1766060246405; Thu, 18 Dec 2025 04:17:26 -0800 (PST) Received: from localhost (109-81-80-251.rct.o2.cz. [109.81.80.251]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432449ae0ffsm4488541f8f.39.2025.12.18.04.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 04:17:26 -0800 (PST) Date: Thu, 18 Dec 2025 13:17:25 +0100 From: Michal Hocko To: Ryan Roberts Cc: Yeoreum Yun , akpm@linux-foundation.org, david@kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.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, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, bigeasy@linutronix.de, clrkwllms@kernel.org, rostedt@goodmis.org, catalin.marinas@arm.com, will@kernel.org, kevin.brodsky@arm.com, dev.jain@arm.com, yang@os.amperecomputing.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] arm64: mmu: use pagetable_alloc_nolock() while stop_machine() Message-ID: References: <20251212161832.2067134-1-yeoreum.yun@arm.com> <20251212161832.2067134-3-yeoreum.yun@arm.com> <0d08b4bf-35c5-4c63-964b-ef886b8262d9@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0d08b4bf-35c5-4c63-964b-ef886b8262d9@arm.com> On Thu 18-12-25 12:02:14, Ryan Roberts wrote: > On 18/12/2025 09:36, Yeoreum Yun wrote: > > Hi, > >> On Fri 12-12-25 16:18:32, Yeoreum Yun wrote: > >>> linear_map_split_to_ptes() and __kpti_install_ng_mappings() > >>> are called as callback of stop_machine(). > >>> That means these functions context are preemption disabled. > >>> > >>> Unfortunately, under PREEMPT_RT, the pagetable_alloc() or > >>> __get_free_pages() couldn't be called in this context > >>> since spin lock that becomes sleepable on RT, > >>> potentially causing a sleep during page allocation. > >>> > >>> To address this, pagetable_alloc_nolock(). > >> > >> As you cannot tolerate allocation failure and this is pretty much > >> permanent allocation (AFAIU) why don't you use a static allocation? > > > > Because of when bbl2_noabort is supported, that pages doesn't need to. > > If static alloc, that would be a waste in the system where bbl2_noabort > > is supported. > > > > When I tested, these extra pages are more than 40 in my FVP. > > So, it would be better dynamic allocation and I think since it's quite a > > early time, it's probably not failed that's why former code runs as it > > is. > > The required allocation size is also a function of the size of the installed RAM > so a static worst case allocation would consume all the RAM on small systems. Understood. But is it possible to pre-allocate early on so that the allocation itself doesn't have to happen from a constrained context. -- Michal Hocko SUSE Labs