Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2014415imu; Thu, 24 Jan 2019 05:58:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN4TAunxzAWv0lkpm/ZZ0odOLwPxOxYV+KCfvNWmgg5Q3YXtm9QjuPa70vohRPJLcwnMoJsu X-Received: by 2002:a63:9b11:: with SMTP id r17mr6073069pgd.416.1548338302087; Thu, 24 Jan 2019 05:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548338302; cv=none; d=google.com; s=arc-20160816; b=R52a5VHNImGbM75lsi6ai36pY3drJyW0+7HEaYb6cgXnqRFLzBPsWGwrcyYzGMfs+J Z0+IgV9cE1b//QIqmKvGUN37EL6lAyzR2WnQVGS72/FLE8I7Gqgc0YQ9zeuHYMdLmay0 MUxjHnP0slXL1xKlqdrlndztSP2UPEF9sTld+C4SEX8bCJRiVWGwZ2kuIWYjBg4wYy9t BPaivyZiVvMo28Wq70oE5Bzune2kTJU8PL+LzXG2tsH7oE+YMo5sE14WA2rKzzyxFd6t yyaeZTCgRtz50OqxwRir1ImWyvlhMYA/38vLjN0GkjrgxZKTa3hV90dmZEkb3qY9ZlYD aGcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KqbWSaiyHO3jwEX7JNeSt49HGRO3N4zQp3FURwWaLU8=; b=BaQ88QH2Blj2AEKt07nCiVMbHovVxUGdypvMdx7/LZt7O3lCn3bUAY67UvqaqkHQFY Ll/TGYSzdN9PhLFLIEreJS1M/DE9t5DquiZwBySZDuSYAsM7qcFjJlVEvHQoe85lSNrn XYUHFXPVU5S2fR4xWDQQPhdvVl7nG9DSRkqgyVCTYkFAVIdWojlv/UFsj1E1rq1EyJ7b J/mLS63GzcyC1jbHitdG4sTUG5uZrLrDXP+ATO0qX/E65u1ABF7BdicINMUBNLBw47Gw PIF2tnzELqo1sGYQLEFI8kyv5mdrO3FRL1ju1VB3X6/OPJ3H77c45965CAz4bT82rIkB WyEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lqn+gjIn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h70si21993094pge.221.2019.01.24.05.58.06; Thu, 24 Jan 2019 05:58:22 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=Lqn+gjIn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727799AbfAXN5R (ORCPT + 99 others); Thu, 24 Jan 2019 08:57:17 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:47080 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727596AbfAXN5R (ORCPT ); Thu, 24 Jan 2019 08:57:17 -0500 Received: by mail-io1-f68.google.com with SMTP id s8so4739000iob.13 for ; Thu, 24 Jan 2019 05:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KqbWSaiyHO3jwEX7JNeSt49HGRO3N4zQp3FURwWaLU8=; b=Lqn+gjIncbO+NzbYiyb0YDloKirpxpmGe7BXLsnXWzCVc3ZzzwqqFJK51g8pB/doPq x3EMwUwquEo0yoPU+TF8PcW49SknCactKU4a0hXwN9IwRMUJ9jLLBTqOXiomOvQkEI+G ZVaA5gjqsmoi1hgbWKtGxA8F/m2H5BNVBpW4U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KqbWSaiyHO3jwEX7JNeSt49HGRO3N4zQp3FURwWaLU8=; b=uTKdndFPLhwxWQt5j2d2uoBUv5IygTuJvaH9pkaqy7+4D9jCirTbahTCClSnlMVUra 7bIWWn9qyYgTNp+cW+lJCut9Vxsow288YKZZWqrEdASugCcea1RRTG8ygIKjAvz0efxA olU6PZcFglA6U61wq7Zq+K9ckTu8x4NtUncE6TVrxyxg/mEIC8H2512mPuQguSHWhuW/ WVnoJEfAZzXfeCQq+XTU94dGTRd5tsXJMI3sf5zMCvdfOSphH7Ln5ZM5bKPXgXRh3HGM swk1kfgMyAMRRH09lT042GcWOZApKfhiSi3I8QYt/P+USYRc1nyy+F3zlazHE0TivreI yGuA== X-Gm-Message-State: AHQUAuZ9ewzV+sxJyBz1MeHcxsc1lLhQLt2MJlfzZWVMsVcUYUDH83WI g6ZKYOO9r/7lj+XUC97R/KdSbq9OaPJyZDDmjnOeMA== X-Received: by 2002:a5e:c206:: with SMTP id v6mr4049610iop.60.1548338236024; Thu, 24 Jan 2019 05:57:16 -0800 (PST) MIME-Version: 1.0 References: <850b6aee-0040-c333-b125-45211c18ada5@daenzer.net> <047667fd-17be-1c37-5d2a-26768cfd6ab8@daenzer.net> <20190123071521.GB20526@infradead.org> <20190123164428.GA9367@infradead.org> <20190124091316.GA22796@infradead.org> <953e5e5f-5d47-d6df-40df-c8c94db5447f@amd.com> <57590a48-4629-e2a1-8673-ce9eb2ec210b@amd.com> <40ad3ae7-9970-0cb9-d35c-05e128f83820@amd.com> In-Reply-To: From: Ard Biesheuvel Date: Thu, 24 Jan 2019 14:57:03 +0100 Message-ID: Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86 To: Alex Deucher Cc: "Koenig, Christian" , Christoph Hellwig , =?UTF-8?Q?Michel_D=C3=A4nzer?= , Maxime Ripard , Will Deacon , Linux Kernel Mailing List , amd-gfx list , David Airlie , "Huang, Ray" , dri-devel , Michael Ellerman , "Zhang, Jerry" , "Deucher, Alexander" , Sean Paul , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jan 2019 at 14:54, Alex Deucher wrote: > > On Thu, Jan 24, 2019 at 6:45 AM Ard Biesheuvel > wrote: > > > > On Thu, 24 Jan 2019 at 12:37, Koenig, Christian > > wrote: > > > > > > Am 24.01.19 um 12:26 schrieb Ard Biesheuvel: > > > > On Thu, 24 Jan 2019 at 12:23, Koenig, Christian > > > > wrote: > > > >> Am 24.01.19 um 10:59 schrieb Ard Biesheuvel: > > > >>> [SNIP] > > > >>> This is *exactly* my point the whole time. > > > >>> > > > >>> The current code has > > > >>> > > > >>> static inline bool drm_arch_can_wc_memory(void) > > > >>> { > > > >>> #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) > > > >>> return false; > > > >>> > > > >>> which means the optimization is disabled *unless the system is > > > >>> non-cache coherent* > > > >>> > > > >>> So if you have reports that the optimization works on some PowerPC, it > > > >>> must be non-cache coherent PowerPC, because that is the only place > > > >>> where it is enabled in the first place. > > > >>> > > > >>>> The only problematic here actually seems to be ARM, so you should > > > >>>> probably just add an "#ifdef .._ARM return false;". > > > >>>> > > > >>> ARM/arm64 does not have a Kconfig symbol like > > > >>> CONFIG_NOT_COHERENT_CACHE, so we can only disable it everywhere. If > > > >>> there are non-coherent ARM systems that are currently working in the > > > >>> same way as those non-coherent PowerPC systems, we will break them by > > > >>> doing this. > > > >> Summing the things I've read so far for ARM up I actually think it > > > >> depends on a runtime configuration and not on compile time one. > > > >> > > > >> So the whole idea of providing the device to the drm_*_can_wc_memory() > > > >> function isn't so far fetched. > > > >> > > > > Thank you. > > > > > > > >> But for now I do prefer working and slightly slower system over broken > > > >> one, so I think we should just disable this on ARM for now. > > > >> > > > > Again, this is not about non-cache coherent being slower without the > > > > optimization, it is about non-cache coherent likely not working *at > > > > all* unless the optimization is enabled. > > > > > > As Michel tried to explain this CAN'T happen. The optimization is a > > > purely optional request from userspace. > > > > > > > Right. > > > > So in that case, we can assume that the following test > > > > static inline bool drm_arch_can_wc_memory(void) > > { > > #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) > > return false; > > > > is bogus, and it was just unnecessary caution on the part of the > > author to disregard non-cache coherent devices. > > Unfortunately, those commits have no log messages whatsoever, so it is > > difficult to infer the intent retroactively. > > > > > > Otherwise, the driver will vmap() DMA pages with cacheable attributes, > > > > while the non-cache coherent device uses uncached attributes, breaking > > > > coherency. > > > > > > Again this is mandated by the userspace APIs anyway. E.g. we can't > > > vmap() pages in any other way or our userspace APIs would break. > > > > > > > OK, > > > > So let's just disable this for all ARM and arm64 then, given that > > non-cache coherent is not supported in any case > > So I think we are back to this patch: > https://patchwork.kernel.org/patch/10739023/ > Apart from the fact that the issue has nothing to do with write-combining, yes.