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 5A856C4332F for ; Thu, 17 Nov 2022 18:37:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C31D16B0071; Thu, 17 Nov 2022 13:37:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE3806B0072; Thu, 17 Nov 2022 13:37:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAA428E0001; Thu, 17 Nov 2022 13:37:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 920366B0071 for ; Thu, 17 Nov 2022 13:37:03 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6B58C1C5DCC for ; Thu, 17 Nov 2022 18:37:03 +0000 (UTC) X-FDA: 80143791126.04.F0F9AAF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf22.hostedemail.com (Postfix) with ESMTP id 0EC80C0010 for ; Thu, 17 Nov 2022 18:37:00 +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 984FFB82158 for ; Thu, 17 Nov 2022 18:36:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62540C4347C for ; Thu, 17 Nov 2022 18:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668710218; bh=y0a1kN4E5U0xytB8/wQI0e7kakRSff/1znGiKB5P4Wg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YJxUT7Vp3UpMOzZPJu18YZ95Hr7LIR5Kqoz34Peav3wlBXYgz9HIGFg4dkiV43NXl bl9cocWQ3rcxYBjP59q9vDjJLFiAIRXPqgH0RZeaOKme9S7i2LuUcSWst+abDx6p4g sYAB/n9wUuMabvNRwt+UkcSYsRt957zan381tn+81yuD8ekgLYqLgHccEdwyKbYlsR bd5eZnrrDmm3/6AdlQ2OlEjxHtk9rN/nQhes5pbuApWNOCCkx3HzDJxoK6O6Nr4Iwy 9JQOsTjad+aYdgbQyJ2NCFYsjo8a3fJjr3NJCdTvev/dYQjTuDX1V1GJkYx27d1tsD 3T3Ep0IiasY5A== Received: by mail-ej1-f46.google.com with SMTP id kt23so7271777ejc.7 for ; Thu, 17 Nov 2022 10:36:58 -0800 (PST) X-Gm-Message-State: ANoB5pmUmb2PNO6UTOgi+ykpsWWtp75wuRskimFOZqNN8c5JE2sHcXwy He3FjN2t/+9hPIDhcKEGMQS5g6bdhXO9/P9rM28= X-Google-Smtp-Source: AA0mqf63XWB6A2beNTXDEGscspG5MQwfkBCrXrsXgU82FReayLSaj84K1iKmzbMRIoVtueFgTBl2PEVd7cYhql9qtEw= X-Received: by 2002:a17:906:c34f:b0:78e:17ad:ba62 with SMTP id ci15-20020a170906c34f00b0078e17adba62mr3175838ejb.719.1668710216515; Thu, 17 Nov 2022 10:36:56 -0800 (PST) MIME-Version: 1.0 References: <20221107223921.3451913-1-song@kernel.org> <9e59a4e8b6f071cf380b9843cdf1e9160f798255.camel@intel.com> In-Reply-To: From: Song Liu Date: Thu, 17 Nov 2022 10:36:43 -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; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YJxUT7Vp; spf=pass (imf22.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=1668710221; a=rsa-sha256; cv=none; b=8fkvYPPi5KKwvEH8oShjnwygfc5DpDibvUT0hh4Ch0OhKw2X1NQaemDzk263eg8S9GhkIB RzPDd/Q15MvinvSC0DNn1tpfOtCZfqaC3xiil/FwWOv7Ouh2QkU/xYaZff3C8335NIreoP OOle7F4xRH9MliI4iDVWy6ZsNA62B2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668710221; 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=y0a1kN4E5U0xytB8/wQI0e7kakRSff/1znGiKB5P4Wg=; b=zRY4fhrGbXfVNin92w3XHDCreQ4itu3L4QSfah5Vu2cuwNqqWI8CUC9QBSuBiCqE4VX0uA l2MSQhrkn0Uwp42Lpv7YCp2o/z94XLFwUBs3c34Z1+QWIJf1Ehi8LQYAfaen1foL2v8vm7 KPvDxr0bAodb/rSBgcs56j307q+1Lfc= Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YJxUT7Vp; spf=pass (imf22.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-Rspamd-Server: rspam02 X-Rspam-User: X-Stat-Signature: fezzoaxaj68wzuq6hj85hs3uhb5m4s5h X-Rspamd-Queue-Id: 0EC80C0010 X-HE-Tag: 1668710220-518186 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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 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. I guess these are good enough for major architectures? > > > > 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. Thanks, Song