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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93C59C433E0 for ; Fri, 24 Jul 2020 05:05:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DD46206F0 for ; Fri, 24 Jul 2020 05:05:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DD46206F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C17F48D001B; Fri, 24 Jul 2020 01:05:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC91D8D0007; Fri, 24 Jul 2020 01:05:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADF608D001B; Fri, 24 Jul 2020 01:05:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 99F838D0007 for ; Fri, 24 Jul 2020 01:05:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 52FE2181C9676 for ; Fri, 24 Jul 2020 05:05:09 +0000 (UTC) X-FDA: 77071780338.04.base84_42100b126f44 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 31566800F4E3 for ; Fri, 24 Jul 2020 05:05:09 +0000 (UTC) X-HE-Tag: base84_42100b126f44 X-Filterd-Recvd-Size: 3469 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Jul 2020 05:05:08 +0000 (UTC) IronPort-SDR: I8nUhKj0bYX5Ic5TSBToRdyRACiLzoV92lSMN/KVysKRDnaZt69CBWRPJD9VBNwy9uf6NsDbTA T5cILin/WhGw== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="215249709" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="215249709" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:05:06 -0700 IronPort-SDR: umE99LOgs57vP5a8x4aQCCjnEppKYg8C9jssWlx7eBHi5EcELKrQFRlOH3SBPux12jubU1bu29 x8Den+63ERtg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="271246624" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by fmsmga007.fm.intel.com with ESMTP; 23 Jul 2020 22:05:04 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra Subject: [PATCH v5 0/6] arch/x86: kprobes: Remove MODULES dependency Date: Fri, 24 Jul 2020 08:04:54 +0300 Message-Id: <20200724050501.1723315-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 31566800F4E3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Remove MODULES dependency by migrating from module_alloc() to the new text_alloc() API. Essentially these changes provide preliminaries for allowing to compile a static kernel with a proper tracing support. The same API can be used later on in other sites that allocate space for trampolines, and trivially scaled to other arch's. An arch can inform with CONFIG_ARCH_HAS_TEXT_ALLOC that it's providing implementation for text_alloc(). Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Cc: Peter Zijlstra v4: * Squash lock_modules() patches into one. * Remove fallback versions of text_alloc() and text_free(). Instead, use ARCH_HAS_TEXT_ALLOC at site when required. * Use lockdep_assert_irqs_enabled() in text_free() instead of WARN_ON(in_interrupt()). v3: * Make text_alloc() API disjoint. * Remove all the possible extra clutter not absolutely required and split into more logical pieces. Jarkko Sakkinen (6): kprobes: Remove dependency to the module_mutex vmalloc: Add text_alloc() and text_free() arch/x86: Implement text_alloc() and text_free() arch/x86: kprobes: Use text_alloc() and text_free() kprobes: Use text_alloc() and text_free() kprobes: Remove CONFIG_MODULES dependency arch/Kconfig | 2 +- arch/x86/Kconfig | 3 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/kprobes/core.c | 4 +-- arch/x86/kernel/text_alloc.c | 41 +++++++++++++++++++++++ include/linux/module.h | 32 ++++++++++++++---- include/linux/vmalloc.h | 17 ++++++++++ kernel/kprobes.c | 61 +++++++++++++++++++++++----------- kernel/trace/trace_kprobe.c | 20 ++++++++--- 9 files changed, 147 insertions(+), 34 deletions(-) create mode 100644 arch/x86/kernel/text_alloc.c --=20 2.25.1