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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E21BBC4321E for ; Mon, 14 Nov 2022 20:31:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59F556B0071; Mon, 14 Nov 2022 15:31:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 54F3E6B0072; Mon, 14 Nov 2022 15:31:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43E376B0073; Mon, 14 Nov 2022 15:31:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 35BA26B0071 for ; Mon, 14 Nov 2022 15:31:07 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DEB0A1A0111 for ; Mon, 14 Nov 2022 20:31:06 +0000 (UTC) X-FDA: 80133192132.11.1199516 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf20.hostedemail.com (Postfix) with ESMTP id 3B7B81C0008 for ; Mon, 14 Nov 2022 20:31:05 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48E8FB8129E for ; Mon, 14 Nov 2022 20:31:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E574CC43470 for ; Mon, 14 Nov 2022 20:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668457862; bh=zgQp4XhE91vIyGmXpMyVsZiJPfANBzqEOoaMA7ygUl0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XkzIyf1Zp85kbVY6WLYUJWf3jjYhTfIAZw7sml4tSceIA7UHw+MCgFm0nwU/TREn8 f/dBOio7J7O/5sa4SdhyIJmP7dRPbzTJECSF+2e3OovFIc/hGdSrPnmlJQag43A9b3 vSvGhp0thsgu9cv1o+NLfxprN/mpOd9oMmq4AlFE+GYW+85uHmFiwPAEn7dTWjQG7p ONmFFzfE1m6BuWtLR4bu/xS4xDUEzxUqaNXbotxzLCcJL0PiVLpJEq5ytFotfySTMG jjip8zwZacUZOUIAoAbN40K2QpvA3xz70z2L7PbV7eZ630pSto3c/aio3wOLpiaSN1 mzc7xOfxUwRCQ== Received: by mail-ed1-f52.google.com with SMTP id z18so18986458edb.9 for ; Mon, 14 Nov 2022 12:31:02 -0800 (PST) X-Gm-Message-State: ANoB5pmP0zkfQFzh2zv2TQWUziezk8rep7cgT2mQFqcFDVqLT9hUFkTK oz5VD4dVGT6r+0Yr9Zz5gtXJ7WH/qlYDoDXZrAo= X-Google-Smtp-Source: AA0mqf6FbNrkfPGlxAnsH2TFSgi5UFu/qy0uRw1hliM5lNSCQG4sS57dgxaoVyPr4JrPCvPFa1HA33yrBcnbXJC92Hc= X-Received: by 2002:a50:fe13:0:b0:461:565e:8779 with SMTP id f19-20020a50fe13000000b00461565e8779mr12733916edt.387.1668457861058; Mon, 14 Nov 2022 12:31:01 -0800 (PST) MIME-Version: 1.0 References: <20221107223921.3451913-1-song@kernel.org> <9e59a4e8b6f071cf380b9843cdf1e9160f798255.camel@intel.com> In-Reply-To: From: Song Liu Date: Mon, 14 Nov 2022 12:30:49 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 0/5] execmem_alloc for BPF programs To: Mike Rapoport Cc: "Edgecombe, Rick P" , "peterz@infradead.org" , "bpf@vger.kernel.org" , "linux-mm@kvack.org" , "hch@lst.de" , "x86@kernel.org" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "Lu, Aaron" Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XkzIyf1Z; spf=pass (imf20.hostedemail.com: domain of song@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=song@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668457866; a=rsa-sha256; cv=none; b=NwOaPA/MPewzz+U/oa9LHZUm86WPNvZqhw4Jocts4iiLSGL8wF7yIF2qkuYvBDy0hDFFfU PhKD/4hXsbj2ioqt1bKc439bQSZqwiFtwqVmOvEZD0UzjfrR3bnQyMVFPM8ptkZ8hUW1bh iEt3CSo0NDdsdeE+qXD+wOdbO/XeTmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668457866; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FTMMiYumzvpoHGFl+OBv9AlBeDESC18ymTgavfl4Vo0=; b=CEZLCJdTs0k2Rn3EtdFezGjExR9jzJEqFwOvXMfBYLE+jRiCoH7+nA5q13KQoxW78RF83b PiuFQEM9wpTgL+QwtwAaSEbXQ9pCFNc7t+oyzt+VBoy7j2MbuJAw0k1OAHGUUXlwn4xLvA 9dByRGnvQ13H/a1w2cMzCpW4pINC39Q= X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XkzIyf1Z; spf=pass (imf20.hostedemail.com: domain of song@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=song@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: dpuaa736rekmjgs9zxtssicx5z57mj1t X-Rspamd-Queue-Id: 3B7B81C0008 X-Rspamd-Server: rspam09 X-HE-Tag: 1668457865-482740 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Nov 13, 2022 at 2:35 AM Mike Rapoport wrote: > > On Wed, Nov 09, 2022 at 05:04:25PM +0000, Edgecombe, Rick P wrote: > > On Wed, 2022-11-09 at 13:17 +0200, Mike Rapoport wrote: > > > On Tue, Nov 08, 2022 at 04:51:12PM +0000, Edgecombe, Rick P wrote: > > > > > How the caching of large pages in vmalloc can be made useful for use > > > cases like secretmem and PKS? > > > > This part is easy I think. If we had an unmapped page allocator it > > could just feed this. > > The unmapped page allocator could be used by anything that needs > non-default permissions in the direct map and knows how to map the pages > elsewhere. E.g it would have been a oneliner to switch x86::module_alloc() > to use unmapped allocations. But ... > > > Do you have any idea when you might pick up that stuff again? > > ... unfortunately I don't see it happening anytime soon. > > > To answer my own question, I think a good first step would be to make > > the interface also work for non-text_poke() so it could really be cross > > arch, then use it for everything except modules. The benefit to the > > other arch's at that point is centralized handling of loading text. > > My concern is that the proposed execmem_alloc() cannot be used for > centralized handling of loading text. I'm not familiar enough with > modules/ftrace/kprobes/BPF to clearly identify the potential caveats, but > my gut feeling is that the proposed execmem_alloc() won't be an improvement > but rather a hindrance for moving to centralized handling of loading text. I don't follow why this could ever be a hindrance. Luis is very excited about this, and I am very sure it works for ftrace, kprobe, and BPF. If there is a better API, it shouldn't be too hard to do the migration. See the example in 3/5 of the set, where we move x86 BPF jit AND BPF dispatcher from bpf_prog_pack to execmem_alloc(): 5 files changed, 21 insertions(+), 201 deletions(-) It is not a one liner, but it is definitely very easy. > > It feels to me that a lot of ground work is needed to get to the point > where we can use centralized handling of loading text. Could you please be more specific on what is needed? Thanks, Song