From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754887AbbCSKMP (ORCPT ); Thu, 19 Mar 2015 06:12:15 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:41264 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753770AbbCSKMG (ORCPT ); Thu, 19 Mar 2015 06:12:06 -0400 Date: Thu, 19 Mar 2015 11:12:03 +0100 From: Pavel Machek To: Oliver Neukum Cc: Jiri Kosina , Lauri Kasanen , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, ao2@ao2.it, AndrewD207@aol.com Subject: Re: [PATCH] HID: sony: Enable Gasia third-party PS3 controllers Message-ID: <20150319101203.GA22127@amd> References: <20150207154859.89a7e4e3.cand@gmx.com> <1423476481.10695.2.camel@linux-0dmf.site> <20150209204414.a4d205be.cand@gmx.com> <1423556076.19839.3.camel@linux-0dmf.site> <20150316211056.GB11441@amd> <1426756461.3815.3.camel@suse.de> <20150319093834.GB18997@amd> <1426758862.2814.4.camel@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426758862.2814.4.camel@suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2015-03-19 10:54:22, Oliver Neukum wrote: > On Thu, 2015-03-19 at 10:38 +0100, Pavel Machek wrote: > > On Thu 2015-03-19 10:14:21, Oliver Neukum wrote: > > > On Mon, 2015-03-16 at 22:37 +0100, Jiri Kosina wrote: > > > > > Are you sure CONFIG_DMA_API_DEBUG wouldn't warn here? > > > > > > As far as I can tell, it will not warn. The problem is not in the > > > mapping itself. That is usually legitimate. The problem arises > > > because the buffer doesn't have a cacheline of its own. Thus the > > > memory corruption happens after the IO operation has started. > > > > Nasty. Would WARN_ON(buffer & CACHELINE_SIZE-1) do at least part of > > No. It is perfectly legitimate to put your buffer at an offset > or to combine buffers provided you don't use them at the same > time. Legitimate: yes. Is anyone doing it? And will not they see exactly the same data corruption with the aliasing data? > > Alternatively, we could create "allocate_for_usb" function, and only > > take pointers allocated by that function in usb functions. That would > > also teach people the problem exists... > > No, this problem is not limited to USB. Well.. Recognize that just because you have a pointer does not mean you can pass it to certain functions. Maybe those functions should not be taking pointers in the first place.... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html