Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2025027ybh; Fri, 24 Jul 2020 02:28:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpYWj4Cpd1BxbkbjaWynBh3WBDhE8dvCiiOpCycdrsFfSb/VdvUCfMtuAVfTaE8iAbfs/a X-Received: by 2002:a05:6402:204e:: with SMTP id bc14mr8296142edb.128.1595582903332; Fri, 24 Jul 2020 02:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595582903; cv=none; d=google.com; s=arc-20160816; b=oBTeCZSkJXVI8yIjm216+nVXtIYMXd7bwV3P1h+47X3CSp3VpKue3MhFLmSQNZ2HAz K/CaD3cy1DmeZt8hznhaFay5MlZDPvGbjtdaZeyXkSVeyhPH5uCjM9nKBbeXiGuoZZx9 LiI9xug3k7uz2wckX3AhfgmTs0tNLEpS3D+urh17+UZftjkJlYKWiTsg1IEJOmsyLe1d dF/7pdv/epX8CO+RREQOarrmq7NSjoM3/xZWzESTVMr59U7tVkCz7lq9ahjRv8pBjOes Ra3072rG+KYyaP/HQIWMyafHE+5GKj1BeMgfQjVDJ/g3CZUhEPp+8EAEqEcT1f27FI0A 0N0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=t/IL7SzOQEirppaKu0kppf6/HL3sTtCWEVRaMwuH7Qs=; b=fOFs+zLuWD+Rs2FB3ava/KQJBHXBKHZ5aNPkeRxfs2M31hsE68WZihLPq880+N3NuV WYcDlzz9C/CxyuUdieV7xqBhHIwaMXmW0BTJf3mbOUBYtmXuHSl7MYap1TrpIuqGWQzU qfe3n38BFPkUucVuWCxAcJfkP6OdDK5abEpMLCXsHFEwpPMoy2NiUd16HiKxCbB832S8 SFpVdcPv9ISFsygHcfWdDwm15SDdhjRnKKIblpARB4e7C5xxev49rUf1C+42LjKEomQs vNsSNAq0CvhBrPfgvmRC2VdGbT2GynjDnsPuBYfF4Scr+1ielYEsbel8GD0vhgPDlqaZ gskw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oUMohlqX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si278390ejg.127.2020.07.24.02.28.01; Fri, 24 Jul 2020 02:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oUMohlqX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbgGXJ1v (ORCPT + 99 others); Fri, 24 Jul 2020 05:27:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgGXJ1v (ORCPT ); Fri, 24 Jul 2020 05:27:51 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B75D4C0619D3 for ; Fri, 24 Jul 2020 02:27:50 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id d18so6544239edv.6 for ; Fri, 24 Jul 2020 02:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=t/IL7SzOQEirppaKu0kppf6/HL3sTtCWEVRaMwuH7Qs=; b=oUMohlqXje6HNqC7d0qAdNhF8nSC/reJxnDqywwzHxBm5HAEsEzTejHNXn0iX5gQRb n1HvPdZyTzneiEaA9TsDkvYS/o0U2pbSU0XB3ZuDfNMw6ASlOsC2Cw7B0jIE4e+RDeAV avUEPrQwU1w+yPA++GrzwdzAmNFTRuLcpymkYuzCQBKgzhGZ7veENgCKNKKJiaKvz3wG 6IhwOeSohyeDH6gkO5B792fOhiZerw57SxcbTg/jnFWtXSbk/CK9oMzZykP7sjQTFt+p 01nShC1wyGxpPh4Y0OB8MO/hNW9aN7w3WPK/m6rQKfDrEUm5A9SWUGpf0jduqVJPCYEZ bhRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=t/IL7SzOQEirppaKu0kppf6/HL3sTtCWEVRaMwuH7Qs=; b=YuuEBCiEx/U8ipJtxER59YSy84P5OY9cJurYXeWPPz/tzd0pbZ8fcB9rOlXjjj8z1L k6/nI/I00iIAUKit2axxBsXHtvko4sxL5NJBUnIZxuxjV1eYaIhCMDGumtYnqrsbk5WY dtr5RsOHfsseQej9h5E3MvTbERX9lIqOWVVPSGnIWL6Hv8HyVnQ1/RVm/8IeShH059MF VyQ+5XDSKpKCTKDboNLEfnmPjo/5FFI17BwoOFUuwiqdW3kWgD53p71Guj59Y5pmT0S3 s1DEhHxFCEIT3/t4JI9lUsDhHYYNEqUew9x1Qt4oc2TzT69PZrjFy5C5P6keO0rnAxgd H+yg== X-Gm-Message-State: AOAM533DZwhfpBKiobbZ83lbKGr4gPYoaXDYQn9IJ7sohyqRJ+JNvpkJ Q9KjQF8EYuQNqsnJmgbo1RU= X-Received: by 2002:a05:6402:2350:: with SMTP id r16mr7748316eda.62.1595582869426; Fri, 24 Jul 2020 02:27:49 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id d25sm326397edr.78.2020.07.24.02.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 02:27:48 -0700 (PDT) Date: Fri, 24 Jul 2020 11:27:46 +0200 From: Ingo Molnar To: Jarkko Sakkinen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Jessica Yu , Ard Biesheuvel Subject: Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free() Message-ID: <20200724092746.GD517988@gmail.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jarkko Sakkinen wrote: > Use text_alloc() and text_free() instead of module_alloc() and > module_memfree() when an arch provides them. > > Cc: linux-mm@kvack.org > Cc: Andi Kleen > Cc: Masami Hiramatsu > Cc: Peter Zijlstra > Signed-off-by: Jarkko Sakkinen > --- > kernel/kprobes.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 4e46d96d4e16..611fcda9f6bf 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -40,6 +40,7 @@ > #include > #include > #include > +#include > > #define KPROBE_HASH_BITS 6 > #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS) > @@ -111,12 +112,20 @@ enum kprobe_slot_state { > > void __weak *alloc_insn_page(void) > { > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > + return text_alloc(PAGE_SIZE); > +#else > return module_alloc(PAGE_SIZE); > +#endif > } > > void __weak free_insn_page(void *page) > { > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > + text_free(page); > +#else > module_memfree(page); > +#endif > } I've read the observations in the other threads, but this #ifdef jungle is silly, it's a de-facto open coded text_alloc() with a module_alloc() fallback... Thanks, Ingo