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 B91FAC4332F for ; Mon, 21 Nov 2022 14:52:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34B356B0071; Mon, 21 Nov 2022 09:52:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FB426B0073; Mon, 21 Nov 2022 09:52:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C2016B0074; Mon, 21 Nov 2022 09:52:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 107916B0071 for ; Mon, 21 Nov 2022 09:52:30 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D03281402B4 for ; Mon, 21 Nov 2022 14:52:29 +0000 (UTC) X-FDA: 80157740418.02.E8806AA Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf16.hostedemail.com (Postfix) with ESMTP id 1021318000E for ; Mon, 21 Nov 2022 14:52:28 +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 3F59DB8108B for ; Mon, 21 Nov 2022 14:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C58CC43147 for ; Mon, 21 Nov 2022 14:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669042346; bh=1NpqYHTbeVShPEPEVlR21hf3+Bgbo/clIJ92F4nCKL0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tCwz64VxR1lUvhF/F4n7wwsQ+zPTHvMegsUftKJ13YNRHii7kvt5M1fDeH+JTRJmY L9oqNWQ/R3dfZlFy0/iWtwlfrQOCZg/M4cCkvqUCJNvca7SmoIWrBNx89tdarwOOKG sSrhGEOB3nYGVwBUzks2oGS8u9MUTBRNUBlsi4/V0OoGWGOMsggYEJr6h9+64xwZlu PL146feXLfWY7J1mTf0uVlTZ0VUz7hFtpE36DHUP81DnnywmvQSR6EoCoSpRY9PP0i eXqQEnifDXIEcPtSiYbS/S2ydO9knCmLX9Al8+C1duaL3cyzX2eJIp9BY6K885l11z YfYN2FZmhIyvw== Received: by mail-ej1-f47.google.com with SMTP id bj12so29013922ejb.13 for ; Mon, 21 Nov 2022 06:52:25 -0800 (PST) X-Gm-Message-State: ANoB5pmmRrsIuqzjc3IRdVhtS89oCqgJXxU0g/u64XWkv5bmxCSDSwQI DtPyut4KwftbB22mktTiLI4W6PizS8z+mtvioxQ= X-Google-Smtp-Source: AA0mqf4/CR5tEsPR5HXixifxoixQz3KKsUdB0XZlZbEJMncSS2DbWUVu0lSGcgANJX/qAKQ1DQI7mPQKMjJqWr1jNNI= X-Received: by 2002:a17:906:fa06:b0:7ae:72ae:264b with SMTP id lo6-20020a170906fa0600b007ae72ae264bmr15607931ejb.301.1669042344250; Mon, 21 Nov 2022 06:52:24 -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, 21 Nov 2022 07:52:12 -0700 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; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tCwz64Vx; spf=pass (imf16.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=1669042349; a=rsa-sha256; cv=none; b=M1Bzgqw1Gf/xf9Lo1Z//we6Zpan4/O4CdTiRhOt3AN0oRE4Rtpa4zAt9IeOb5v4cPEZOkH BJVENZ0N0t9vNxhJV0SAiXWUh2FXBP7kJa1EIQTSufHICqEnvu7E3FbiAJ1K9IAmZbll0r pVi3KQafGvoSikQiqcl15fZFoLGIfsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669042349; 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=1NpqYHTbeVShPEPEVlR21hf3+Bgbo/clIJ92F4nCKL0=; b=RlnzU07FTsPDNFxF8I0D4FFYjWD8fe7+ZKjLcCJL3WulLM8GCGEvMEWI01+u3OgrH3Vmb0 LVnx+YBcD5JWRvWI8C4R4sOdwuSW70oldzCqxTY7cRzs+ZIvY7b+kmcL/vbCPZh2tsWSJK FNy4gt2xTtuEsZPTJrV/Zh8ec+T82ks= X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tCwz64Vx; spf=pass (imf16.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: o9phzoii19nfjcz5ba5wek4a3z9kh8iu X-Rspamd-Queue-Id: 1021318000E X-Rspamd-Server: rspam09 X-HE-Tag: 1669042348-254026 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 20, 2022 at 3:41 AM Mike Rapoport wrote: > > 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? "Something similar" means it will use execmem_alloc as is. We still need changes to the ARM JIT code, just like we need it for powerpc and x86. > > > 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. We haven't got module to use execmem_alloc yet, that's true. But this has nothing to do with VM_TOPDOWN_VMAP at all. Thanks, Song