Received: by 10.192.165.148 with SMTP id m20csp463889imm; Wed, 25 Apr 2018 02:27:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx494M16s84IfHwZoQobkBOGPG2pg+DTB50IUHfbZAmugXhMcqYcxg2rLBKmGEqsvBh/S9g2X X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr27877066plc.87.1524648439394; Wed, 25 Apr 2018 02:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524648439; cv=none; d=google.com; s=arc-20160816; b=F00joJJ7dFfHbhtv29NBSXqCIeADQcVz+31B5z0H+3926B2sjr56uUNE6Y8hbKf1C3 RY3YS7bSRVk8jqqkCu61+YZFji/85ovVjnisUnqIPQZFzcc3+9n/phAzp5TFptFv3Zie 9AdT3/oPmSFs1JGYcEAifed7MpkO989JcnUWRkaswdg/E40MHIVeJDOG0Yj96Qk77akZ kNpf9gpRNopYnU2T+dGpOedL4AEr5tnVrZ28pSuehN08p5uZGLPCXlYUt7LaX0VMyHf7 JxbMrkqftmfL0/cIp5XAZ5RytijY8bI5qTk3TPmcN4pEGT3oLNEVvMK7Rbfo0ZnE2HVT gqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ENEcFLYFT5K9HmQzAAfl9LUtg4so3l70pbn/hgWDvnA=; b=mCLkVw6YSNulsX2owF88si7ezazJIb7viwOYg7RmVxyQvtqHKo7fhhyBgZD2XzEMIM P/rLXGlZcb1tV2u4JS+3do7nlCpZuaKqNebkH7OAkRCjcQaCMPX3AwxM0pQP4GrDQOt3 1womeq3AaXqqxtdOMNAp/qS2i/8lRSgjIgfa2FMYLN4jvNpkA4XAmT+QosPyEr7RG9b8 iZGF0E8G1Q0qdOtMvvPyj5XkNFmNW1dkc5uo7ctVwJ30E2kuBtplw0iidC15yrG6H9uD DJ6+mzPvFRu9neG004aJ5r123xGm3lR3pYKcMgoIYNa9BjoRlAvd/0Dgvh2QPytOSDE1 BrKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=qeAQhAfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x137si1828099pfd.313.2018.04.25.02.27.05; Wed, 25 Apr 2018 02:27:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=qeAQhAfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751485AbeDYJZz (ORCPT + 99 others); Wed, 25 Apr 2018 05:25:55 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:40430 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751212AbeDYJZw (ORCPT ); Wed, 25 Apr 2018 05:25:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ENEcFLYFT5K9HmQzAAfl9LUtg4so3l70pbn/hgWDvnA=; b=qeAQhAfNcuz+qf6gqDGL6ySVq y0WbkNj99bfEKCKs8+fGBW74IDYCs1QNYUSbZiw1KmC4DRkvVUW97CEN7D2zefGktokFLxXFXdFpf 4Bp3+0VyebZuJh63e897LXIrI6OkjJ+EAZNCgPJaqizbneit6G/0NZz8/BDwmXl1VL4Uk=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:57109) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fBGgH-0007uP-Fq; Wed, 25 Apr 2018 10:25:41 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1fBGgC-0001W5-8V; Wed, 25 Apr 2018 10:25:36 +0100 Date: Wed, 25 Apr 2018 10:25:33 +0100 From: Russell King - ARM Linux To: Thierry Reding Cc: Christoph Hellwig , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux Kernel Mailing List , amd-gfx list , Jerome Glisse , iommu@lists.linux-foundation.org, dri-devel , Daniel Vetter , Dan Williams , Logan Gunthorpe , Christian =?iso-8859-1?Q?K=F6nig?= , linux-arm-kernel@lists.infradead.org, "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: noveau vs arm dma ops Message-ID: <20180425092533.GO16141@n2100.armlinux.org.uk> References: <20180420124625.GA31078@infradead.org> <20180420152111.GR31310@phenom.ffwll.local> <20180424184847.GA3247@infradead.org> <20180425054855.GA17038@infradead.org> <20180425064335.GB28100@infradead.org> <20180425074151.GA2271@ulmo> <20180425085439.GA29996@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425085439.GA29996@infradead.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 25, 2018 at 01:54:39AM -0700, Christoph Hellwig wrote: > [discussion about this patch, which should have been cced to the iommu > and linux-arm-kernel lists, but wasn't: > https://www.spinics.net/lists/dri-devel/msg173630.html] > > On Wed, Apr 25, 2018 at 09:41:51AM +0200, Thierry Reding wrote: > > > API from the iommu/dma-mapping code. Drivers have no business poking > > > into these details. > > > > The interfaces that the above patch uses are all EXPORT_SYMBOL_GPL, > > which is rather misleading if they are not meant to be used by drivers > > directly. EXPORT_SYMBOL* means nothing as far as whether a driver should be able to use the symbol or not - it merely means that the symbol is made available to a module. Modules cover much more than just device drivers - we have library modules, filesystem modules, helper modules to name a few non-driver classes of modules. We also have symbols that are exported as part of the architecture implementation detail of a public interface. For example, the public interface "copy_from_user" is implemented as an inline function (actually several layers of inline functions) eventually calling into arm_copy_from_user(). arm_copy_from_user() is exported, but drivers (in fact no module) is allowed to make direct reference to arm_copy_from_user() - it'd fail when software PAN is enabled. The whole idea that "if a symbol is exported, it's fine for a driver to use it" is a complete work of fiction, always has been, and always will be. We've had this with the architecture implementation details of the DMA API before, and with the architecture implementation details of the CPU cache flushing. There's only so much commentry, or __ prefixes you can add to a symbol before things get rediculous, and none of it stops people creating this abuse. The only thing that seems to prevent it is to make life hard for folk wanting to use the symbols (eg, hiding the symbol prototype in a private header, etc.) Never, ever go under the covers of an interface. If the interface doesn't do what you want, _discuss_ it, don't just think "oh, that architecture private facility looks like what I need, I'll use that directly." If you ever are on the side of trying to maintain those implementation details that are abused in this way, you'll soon understand why this behaviour by driver authors is soo annoying, and the maintainability problems it creates. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up