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 8421EC433FE for ; Tue, 8 Nov 2022 18:47:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D73E6B0078; Tue, 8 Nov 2022 13:47:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 287C88E0003; Tue, 8 Nov 2022 13:47:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 150108E0002; Tue, 8 Nov 2022 13:47:21 -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 047D76B0078 for ; Tue, 8 Nov 2022 13:47:21 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B7F36140AC8 for ; Tue, 8 Nov 2022 18:47:20 +0000 (UTC) X-FDA: 80111157840.17.8DAEB7E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 2BC3B40007 for ; Tue, 8 Nov 2022 18:47:19 +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 386A561710 for ; Tue, 8 Nov 2022 18:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C9E1C433D6 for ; Tue, 8 Nov 2022 18:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667933238; bh=z+CPLTjXOvcKaHD7sqdmx5cvgbmmPAEMI+9ZTDKgU5Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=g/KilDaRGmIWdlgjLmZcCW+rDC+8T/amW2KqpxeJVna1+TvIWZHNkDVhor4iY0GLm 9cLJuYwrEBvIv7vqXhs+8QD83Jyss4F9zDbT5awlwdq9GzS9y3H3jN4D7dxwCptGkz 8Salt6utZaWGoHVYcpZ9ml1Bck2H5N8WkqoqMnS95QB1CdVWmTHaQiJo34+SYpJe0u sHbtgsp12PSJKDj6j1VQRgADZGi4WaFNOQD2iZK5DAMBDJqCrHeUN0giDqI8EEv5QN PyqTsZQDRKFs6G/UXUAZ7SaMPnTFNx2h20f3t0JblKZ445JP/pe3WUEflyyGqjrwya gLHue/6Zdnq8w== Received: by mail-ej1-f48.google.com with SMTP id t25so40952319ejb.8 for ; Tue, 08 Nov 2022 10:47:18 -0800 (PST) X-Gm-Message-State: ACrzQf1Cz6d7skEKBzx0TFwQ/cT/AQmUziIEIJFDNfOHWC/0HpibpBR7 dc+f0PuQqBzQJLmfRRoaRBthqXrtrsS4KkD0e50= X-Google-Smtp-Source: AMsMyM6/n5sNyYm3bPxmQ3Bi8IhUP0Itp6tKeAntlNLg5w8zLtfvooWXxV2+9DtQzViBforLIbg38ELWFGdIgkdfrC4= X-Received: by 2002:a17:907:b602:b0:7ad:e82c:3355 with SMTP id vl2-20020a170907b60200b007ade82c3355mr41167636ejc.3.1667933236913; Tue, 08 Nov 2022 10:47:16 -0800 (PST) MIME-Version: 1.0 References: <20221107223921.3451913-1-song@kernel.org> <83277694-6cb3-3fc7-b300-d39f82ac5b04@csgroup.eu> In-Reply-To: <83277694-6cb3-3fc7-b300-d39f82ac5b04@csgroup.eu> From: Song Liu Date: Tue, 8 Nov 2022 10:47:04 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 0/5] execmem_alloc for BPF programs To: Christophe Leroy Cc: "bpf@vger.kernel.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "x86@kernel.org" , "peterz@infradead.org" , "hch@lst.de" , "rick.p.edgecombe@intel.com" , "aaron.lu@intel.com" , "rppt@kernel.org" , "mcgrof@kernel.org" Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667933240; a=rsa-sha256; cv=none; b=vJUWFKNNot1cWW8imDozr50pc8I8t9gVWm06ISX5+eBQj01fYbXHyeJpngNdky56n5hCkY GxXiYS+zvSBmcXNXHU5YjSwxnbFwFmAlAVKRa+cZhBCDT6t2MhpF67bzi7EU/1l5nPG683 ENIbFxenvml49GUZVhci+B/+n2JhWek= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="g/KilDaR"; spf=pass (imf07.hostedemail.com: domain of song@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=song@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=1667933240; 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=z+CPLTjXOvcKaHD7sqdmx5cvgbmmPAEMI+9ZTDKgU5Q=; b=VAmP4aC8sgT4OE2fLP4jWZHuiM/7JWHuwuyw4ow4OsivGxxHlytUHjHog4LjON+PnZlIIK 1jK69jRC9DyM+Y9nlPJF+AOl9HqCljlZRogYly7YC5/vnvBzAOuJTfy3KftU4F00E6Wyqf oMbU9Omb5RivhBi2Qk6vsh+dDNwG3lA= X-Stat-Signature: d65u954rrrp4wpnmqsd98xxfninhpaao X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="g/KilDaR"; spf=pass (imf07.hostedemail.com: domain of song@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=song@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Queue-Id: 2BC3B40007 X-Rspamd-Server: rspam09 X-HE-Tag: 1667933239-659740 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 Tue, Nov 8, 2022 at 3:44 AM Christophe Leroy wrote: > [...] > > > > execmem_alloc() manages a set of PMD_SIZE RO+X memory, and allocates these > > memory to its users. execmem_alloc() is used to free memory allocated by > > execmem_alloc(). execmem_fill() is used to update memory allocated by > > execmem_alloc(). > > > > Memory allocated by execmem_alloc() is RO+X, so this doesnot violate W^X. > > The caller has to update the content with text_poke like mechanism. > > Specifically, execmem_fill() is provided to update memory allocated by > > execmem_alloc(). execmem_fill() also makes sure the update stays in the > > boundary of one chunk allocated by execmem_alloc(). Please refer to patch > > 1/5 for more details of > > > > Patch 3/5 uses these new APIs in bpf program and bpf dispatcher. > > > > Patch 4/5 and 5/5 allows static kernel text (_stext to _etext) to share > > PMD_SIZE pages with dynamic kernel text on x86_64. This is achieved by > > allocating PMD_SIZE pages to roundup(_etext, PMD_SIZE), and then use > > _etext to roundup(_etext, PMD_SIZE) for dynamic kernel text. > > Would it be possible to have something more generic than being stuck to > PMD_SIZE ? > > On powerpc 8xx, PMD_SIZE is 4MB and hugepages are 512kB and 8MB. Currently, __vmalloc_node_range() tries to allocate huge pages when size_per_node >= PMD_SIZE How do we handle this in powerpc 8xx? I guess we can use the same logic here? Thanks, Song