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=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 D2642C433DF for ; Tue, 16 Jun 2020 13:27:48 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 986952098B for ; Tue, 16 Jun 2020 13:27:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="hNXoB2aN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vOcnuki3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 986952098B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.93) (envelope-from ) id 1jlBcf-00057Y-Ef; Tue, 16 Jun 2020 09:27:29 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jlBcc-00057N-Ih for kernelnewbies@kernelnewbies.org; Tue, 16 Jun 2020 09:27:26 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4FDEB5C0069; Tue, 16 Jun 2020 09:27:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 16 Jun 2020 09:27:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=bHS0iawcNkgl4FMUgJ8cvxMZJSO F6CDIjUXFiFbGRYU=; b=hNXoB2aNUgrSO6H9jc3SrOdKXtBcz69EeS+n9nvuWv0 lqTV5AobtalrEL0c96nAmU07TETEdNrx5cD3wC2rVeF95RuV5SZqBeIzxBKIbQWM ablkv7F6+OBZ5QocLem2lWVof9JMO22oGHzHqB5R1St3Xy7o1X38bVojqQCxyB36 DS0juPVRWwMLB/wocaV9FzXcusIXvxsAcxG2hwTyHFpr62viVBQMhJ+jRJp2txB2 utxTs8+AYvqBUrBvonCv6zSUnfyg1PsH4heGFtqexXNAGhUPrOtmvrk6EtEAllrE YkcqewQAiQG/ZMrlkbF05UYE68e+h5tvjy6TT8zkdLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=bHS0ia wcNkgl4FMUgJ8cvxMZJSOF6CDIjUXFiFbGRYU=; b=vOcnuki3IpFNSutBosZmwG WiD+8/CPDL547YjF0i4SHnG1887XjeU2k+CYh/wBPsutRorTTVgS9NH9QcTAlrwr NxxQnOoLXx9r7kb381P6kptuUBygGCSZrTymi18IOupOA7SiVz+F0IlQqMt/8+39 1XhCVnCpcKkl+vECNRVfvKChQ7Qt0IahLuQLfAlcF6XiNeCNeaIMorOJ9Rhp1QAt sxsCccstMq6M18uGw1bMahtzgUE9WC4PX5G/5NtK8ZqJhZ7agfYNg+Q4rqvZBPTJ fzavbViM9fQ0JisIzh7uB1o7Cn+V3NQz861VufEvs48RB7sZ1JJo9a5KTIIwRfzA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejtddgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeevueehje fgfffgiedvudekvdektdelleelgefhleejieeugeegveeuuddukedvteenucfkphepkeef rdekiedrkeelrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 8E0DB30618B7; Tue, 16 Jun 2020 09:27:22 -0400 (EDT) Date: Tue, 16 Jun 2020 15:27:14 +0200 From: Greg KH To: Tomek The Messenger Subject: Re: the cost of EXPORT_SYMBOL_GPL Message-ID: <20200616132714.GA4019625@kroah.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Tue, Jun 16, 2020 at 03:18:02PM +0200, Tomek The Messenger wrote: > Hi > I am in the middle of implementation of various external kernel modules. > All kernel modules touch some board specific registers. For example let's > say we have 3 groups of register areas: > #define REG1_ADDR (0xFDEA7000) > #define REG1 _SIZE (0x3C0) > #define REG2_ADDR (0xFDEC4000) > #define REG2 _SIZE (0xFF8) > #define REG3_ADDR (0xFDEA6000) > #define REG3_SIZE (0x80) > And let's say we have 5 kernel modules: > A > B > C > D > E > > Kernel module A touches only one 32-bit register X from REG1 space and a > lot of registers from REG2 space. > Kernel modules B,C,D touches various registers from REG1 and REG2 space but > not this one which kernel module A touches. > Kernel module E is the only one who touches registers from REG3 space. No > other kernel module touches REG3 space. > > If I would implement the code in C++ in user space I would create dynamic > library for access to REG1,REG2,REG3 register space. Each 32-bit register > would have his own separate function to read,write to register. And then > each user space process A-E would be linked against this library during > compilation. > When programming in kernel I don't know what I should do. > Should I implement 6th external kernel module which implements all > operations on access to registers REG1,REG2,REG3??? There will be a lot of > EXPORT_SYMBOL_GPL. Or maybe this approach is NOK, I mean it is good but I > should only place in 6th helper kernel module functions which are used by > more than one kernel module. So for example functions for getting access to > REG3 address space or reg X from REG1 space should be not there. They > should be only in kernel module code A/E. Currently this is code which I > implemented. In 6th helper kernel module there are only registers which are > used by more than one kernel module. But I am not sure if it is good > approach. Maybe there should be there all registers access? > > Could anybody help how to organize code here. Why is this so many different modules? Why not just make it one? thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies