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 2F9E5C433FE for ; Sun, 20 Nov 2022 10:41:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C1FD6B0072; Sun, 20 Nov 2022 05:41:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 24BDC6B0073; Sun, 20 Nov 2022 05:41:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C4FE6B0074; Sun, 20 Nov 2022 05:41:49 -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 EE4516B0072 for ; Sun, 20 Nov 2022 05:41:48 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9D98914068A for ; Sun, 20 Nov 2022 10:41:48 +0000 (UTC) X-FDA: 80153479896.18.72A5DE9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 339B880004 for ; Sun, 20 Nov 2022 10:41:48 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 246A460C26; Sun, 20 Nov 2022 10:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BF88C433D6; Sun, 20 Nov 2022 10:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668940906; bh=MnnoYiWv3uPbIkrSnl3lVxNe3LuFVSR7+M/2fGlq7uo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A65cuATyANOC5dHBDLeCZTNk5X3MwaF55DaP2/7LGXo11XAc/6p77rYCj6xqytQtJ xMbmKCbW9OP+SKzgolUx0lbPjIQ1r0CwVdsYWZb6Rp7PQxAwxjX5rhvV4n9yCLvLW5 Ij6Ut+KU9w9UeSerFskmY3fruQxirvNg29MueN7VXomgkhfeVWPU1/ixh1XDra0ymD DAmE3AIou8+eFEtQjJP6/lR0i+sE6124NU1sHQ3LfHF6LwE4AsBTV6dOqUh074HzkX fE9sHixZO/nMD9RPP1Jq3BZ7VSIKe7VCs/nNw0B9Ossz4aHiVKbPjhr1vuyxfX3oKR L2aegSx0mT7ow== Date: Sun, 20 Nov 2022 12:41:32 +0200 From: Mike Rapoport To: Song Liu 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" Subject: Re: [PATCH bpf-next v2 0/5] execmem_alloc for BPF programs Message-ID: References: <20221107223921.3451913-1-song@kernel.org> <9e59a4e8b6f071cf380b9843cdf1e9160f798255.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668940908; a=rsa-sha256; cv=none; b=UkZmWsPt+mT1pJCmXlAGBxO1KRSMgL8Xdxt528Z0kppic8W5X4obLoRE0zMx1SkVB6Ufmt MVnV174LPNeLIbiWPZNxzYeyKTXsvpF2lGdf3gJU7y8drhAZHV3+qSX/L6CI6B6uRBDpH1 PRCsoFBnSSsKFkzl24mnhaJPM88MLyk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A65cuATy; spf=pass (imf30.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668940908; 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=USbKp8xSzlxUFBV1TQj7mUTLSRt/GbF9nqZ2wOUS/2s=; b=xBVQ+13El9u1+tyreYD37+tGm6aU1FkgrnjEZvHhC/2YyQSkhibbfxy4Cdsa7wNWrKvwXo SnKa9VsKDc5NIUDbE1BQFZe/EB8XSDTRlVGztiouRBmS9pmRy+C8A7/X4pWpz6zN/2sQ1B FBwXQN5i4d+qL0lhJiWlCvitclJ824Q= X-Stat-Signature: rjr8uaq6od7e8nmp86dqpxk8h6zeqrsm X-Rspamd-Queue-Id: 339B880004 X-Rspamd-Server: rspam01 X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A65cuATy; spf=pass (imf30.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1668940908-557017 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 Thu, Nov 17, 2022 at 10:36:43AM -0800, Song Liu wrote: > On Thu, Nov 17, 2022 at 12:50 AM Mike Rapoport wrote: > > > > On Mon, Nov 14, 2022 at 12:30:49PM -0800, Song Liu wrote: > > > On Sun, Nov 13, 2022 at 2:35 AM Mike Rapoport wrote: > > > > > > > > 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. > > > > Again, it's a gut feeling. But for execmem_alloc() to be a unified place of > > code allocation, it has to work for all architectures. If architectures > > have to override it, then where is the unification? > > > > The implementation you propose if great for x86, but to see it as unified > > solution it should be good at least for the major architectures. > > As I mentioned earlier, folks are working on using bpf_prog_pack for BPF > JIT on powerpc. We will also work on something similar for ARM. Does "something similar" mean that it won't use execmem_alloc() as is? > I guess these are good enough for major architectures? Sorry if I wasn't clear, I referred for unified solution for all code allocations, not only BPF, so that execmem_alloc() will eventually replace module_alloc(). And that means it has to be able to deal with with architecture specific requirements at least on ARM and powerpc, probably others as well. > > > > 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? > > > > The most obvious one to implement Peter's suggestion with VM_TOPDOWN_VMAP > > so that execmem_alloc() can be actually used by modules. > > Current implementation is an alternative to VM_TOPDOWN_VMAP. I am > very sure it works for modules just like VM_TOPDOWN_VMAP solution. It might, but it still does not. And until they do I consider these patches as an optimization for BFP rather than unification of code allocations. > Thanks, > Song -- Sincerely yours, Mike.