lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVeFuKah7yeTpzt+BySFGs7vSkuOw5GLWvJp5-b63HZ_G8=yA@mail.gmail.com>
Date:	Tue, 24 Jun 2014 22:25:34 +0900
From:	Alexandre Courbot <gnurou@...il.com>
To:	Russell King - ARM Linux <linux@....linux.org.uk>
Cc:	Alexandre Courbot <acourbot@...dia.com>,
	David Airlie <airlied@...ux.ie>,
	Ben Skeggs <bskeggs@...hat.com>, Lucas Stach <dev@...xeye.de>,
	Thierry Reding <thierry.reding@...il.com>,
	"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2 2/3] drm/ttm: introduce dma cache sync helpers

On Tue, Jun 24, 2014 at 10:09 PM, Russell King - ARM Linux
<linux@....linux.org.uk> wrote:
> On Tue, Jun 24, 2014 at 09:23:05PM +0900, Alexandre Courbot wrote:
>> On Tue, Jun 24, 2014 at 7:55 PM, Alexandre Courbot <acourbot@...dia.com> wrote:
>> > The only alternative I see here is to flush the CPU caches when syncing for
>> > the device, and invalidate them for the other direction. Of course if the
>> > device has caches on its side as well the opposite operation must also be
>> > done for it. Guess the only way is to handle it all by ourselves here. :/
>>
>> ... and it really sucks. Basically if we cannot use the DMA API here
>> we will lose the convenience of having a portable API that does just
>> the right thing for the underlying platform. Without it we would have
>> to duplicate arm_iommu_sync_single_for_cpu/device() and we would only
>> have support for ARM.
>>
>> The usage of the DMA API that we are doing might be illegal, but in
>> essence it does exactly what we need - at least for ARM. What are the
>> alternatives?
>
> It may seem /to you/ as a driver developer to be the easiest thing in
> the world to abuse an API in a way that it's not supposed to be used,
> and it is easy to do that.
>
> However, what you're actually saying is that you don't respect your
> fellow kernel developers who have to maintain the other side of that
> interface.  When they need to change the implementation of that
> interface, what if those changes then screw your abuse of that
> interface.
>
> The reason we define the behaviours and properties of APIs is to give
> both the user and the implementer of the API some degree of latitude
> in how that interface works, so that it can be maintained into the
> future.  If abuses (such as these) are allowed, then we've lost,
> because the interface can no longer be sanely maintained - especially
> if driver authors eventually end up not caring about their pile of
> abuse they've created after they've moved on to new wonderful hardware.
>
> With an API such as the DMA API, where we have hundreds, if not a
> thousand users of it, this /really/ matters.
>
> We've been here before with the DMA API on older ARM platforms, where
> we've had people abusing the API or going beneath the API because "it
> does what they need it to", which then makes stuff much harder to change
> at architecture level.
>
> Last time it happened, it was when ARMv6 came along and ARM moved away
> from VIVT caches.  The options were either to break the crap drivers
> and support ARMv6+ CPUs, or keep the crap drivers working and not
> support DMA in any shape or form on ARMv6+.
>
> Obviously, this was too important to for one or two abusive drivers to
> block, so I changed the architecture level /anyway/ and just said screw
> the drivers which end up being broken by their short-sightedness, they
> can either rot or someone else can fix them.
>
> I have no beef for intentionally breaking stuff when people abuse well
> defined interfaces and/or refuse to discuss their requirements when
> interfaces don't quite do what they want - or worse, refuse to listen
> to objections.
>
> As I say, it's disrespectful to your fellow kernel developers to abuse
> well defined interfaces.

Apologies if I sounded that way - I wasn't suggesting that we carry on
with this clearly illegal usage of the DMA API, but was merely noting
that if we were to implement the intended behavior on our side it
would look just like what the ARM implementation currently does. My
question about alternatives wasn't rethorical, I am not so familiar
with this part of the system (as should be obvious by now) and would
like to know whether there aren't other solutions that would spare us
the need to re-implement something that already exists.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ