Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5317207iog; Wed, 22 Jun 2022 17:18:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t2S21ZuVfYOFg0CkSjvmtoFZe9sCcIFPMmg9VMtKuJr8+T36f+oVQa1JeqUS/J8fjW84dl X-Received: by 2002:a05:6402:4390:b0:42e:b7e:e9ac with SMTP id o16-20020a056402439000b0042e0b7ee9acmr7299341edc.97.1655943536080; Wed, 22 Jun 2022 17:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655943536; cv=none; d=google.com; s=arc-20160816; b=K72I2d4i5KX32Nz+blK0CtuuPSSkMyj7MzsnIqAJolqqsZDFI7NhB6Hek48i9zGXDe dDWWzUMl09w6vAFk3qU8l9eT7axC8guVXyAa+45PzlPDqt9eLwr820NaqtCjn4J3jN3E +zdrZUHpZsg8fNqms03TQ6nPrKe1IkEUdyceW/zKeXLj8f/y3aPkJVjmCDu+NRioE0/z G3HPGlOp0AGRVqfe3VGkheweCiq3VhRdhWcWPZnEFYZDpFD9roR6xxcx4maZ2Yo16OyF d9raZvV4s343xNi2kEfYFfYnynWjgcjRB4tBV1BbO98/d1iv9ixei1h/WeodEsADDBZY fPuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=o7RsO830fD0jUOzHDwoBp7BpixyxsVDMcbzJc/dPZr8=; b=NA+pvziZuH22H8dRet/U6YeumCvQK9rzcTSwr8JUcyTRbhLegDK8xoqsCBEWN3UboH a3rkOPTEi0rDsVBymqaXQvIyATfPValR4Qfcjkw4YXFQksZPqS7Kl9jMfT/leGKrlRMk Nruza5nAJ7xRv1aIpKzEC0UOwGefPb+DYl35s+kCXjT3ZxGdtJWX2qy2eFJjLUDQ9Ow5 XNH4IVrtL34B3RkNXCT9Orj938VJa5AEc3pg9Kzumw3wg/Yiw/WjD05uXiwAls35zcuC ChUlrz6kXgt73dmMuXy5q6qg6Tng0yuJ3XKWx9BQABGofgqe3MyfQl9w2GjXM/tTDVW+ Fw0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fooishbar-org.20210112.gappssmtp.com header.s=20210112 header.b=t72DVOYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt20-20020a170907729400b0071208433c4bsi19444826ejc.54.2022.06.22.17.18.28; Wed, 22 Jun 2022 17:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fooishbar-org.20210112.gappssmtp.com header.s=20210112 header.b=t72DVOYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359229AbiFVXfb (ORCPT + 99 others); Wed, 22 Jun 2022 19:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377263AbiFVXf1 (ORCPT ); Wed, 22 Jun 2022 19:35:27 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F1441999 for ; Wed, 22 Jun 2022 16:35:24 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id i15so28041523ybp.1 for ; Wed, 22 Jun 2022 16:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fooishbar-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=o7RsO830fD0jUOzHDwoBp7BpixyxsVDMcbzJc/dPZr8=; b=t72DVOYNRLlNIK0QWaS0yiZCgLQzJ+mww8RuMAa6SEu21pN2KF8In8tDLoWRqBsrNr KNnBknGFobmW8lD5cwyGXZhMOKni4k712dl8T6Nb1Y74xZMaHi0Kq2qd81vV4LMVdjCT 9lXscB4gWNNBeBTqN53A7/SqtDjl+hdd0crwWDarrUqcrVVL1BKgKrobVA6tolIbU7CW 7qtcKBAh+hyL8KFEk0j6kpHlcnQQCy4LuyU4suQyqWqX68juFOOsbqaTH6uXvAorFBYR T5EyqV/l5CVH064TgCz+CYYxgBqY/E+gzS5VZQ1S06ALNzSu8KP9nwKNPVFQO6FD4QXB X3Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=o7RsO830fD0jUOzHDwoBp7BpixyxsVDMcbzJc/dPZr8=; b=u3qV2EXUFmbf6pysdoajq1tX6jcNGI1wVkOhLKcGHum4zy4JH5Qw1210uRlOTrQAMN dGMPOXkYq9xP50ZNKiHZa/X8nK5eafPzVcZ/6Mp3zXC9vShzOI+HuHg2E/P+cEvs3eUl 13zmC1gagnk7+0LCZye3cUNmMILKo5ai6V7qkCnHbUJfocqx/pvnmpja7DZsSQfcenqM WUtoC4cadBN8hPigd1TYvF0UlwygFkscguIvVqWXgtmcNpldwxOxcrtuLgL7ZKOp1s50 vDMr7gl6FqnIDUYPr3z8A7d6xW8M2OpbYpQNsk7P+yqCpZLETHQfaX7+x4rmZF/onDsC 47hA== X-Gm-Message-State: AJIora9pYcxsPvuXf6+57IFno9xRZTraWlCGd+AhBzv0Jdn2CC4oKunz iprJgVL4B3C2K1eC8qDRJi7qZI3NUBd9KSRrAUQO6g== X-Received: by 2002:a25:b29e:0:b0:669:160e:7f38 with SMTP id k30-20020a25b29e000000b00669160e7f38mr6608657ybj.280.1655940923198; Wed, 22 Jun 2022 16:35:23 -0700 (PDT) MIME-Version: 1.0 References: <91ff0bbb-ea3a-2663-3453-dea96ccd6dd8@amd.com> <9178e19f5c0e141772b61b759abaa0d176f902b6.camel@ndufresne.ca> In-Reply-To: <9178e19f5c0e141772b61b759abaa0d176f902b6.camel@ndufresne.ca> From: Daniel Stone Date: Thu, 23 Jun 2022 00:34:58 +0100 Message-ID: Subject: Re: DMA-buf and uncached system memory To: Nicolas Dufresne Cc: Daniel Vetter , =?UTF-8?Q?Christian_K=C3=B6nig?= , "Sharma, Shashank" , lkml , dri-devel , linaro-mm-sig@lists.linaro.org, Sumit Semwal , linux-media Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, On Wed, 22 Jun 2022 at 20:39, Nicolas Dufresne wrote= : > Le mardi 16 f=C3=A9vrier 2021 =C3=A0 10:25 +0100, Daniel Vetter a =C3=A9c= rit : > > So I think if AMD also guarantees to drop clean cachelines just do the > > same thing we do right now for intel integrated + discrete amd, but in > > reserve. It's fragile, but it does work. > > Sorry to disrupt, but if you pass V4L2 vmalloc data to Intel display driv= er, you > also get nice dirt on the screen. If you have a UVC webcam that produces = a pixel > format compatible with your display, you can reproduce the issue quite ea= sily > with: > > gst-launch-1.0 v4l2src device=3D/dev/video0 ! kmssink > > p.s. some frame-rate are less likely to exhibit the issue, make sure you = create > movement to see it. Right, this is because the UVC data in a vmalloc() area is not necessarily flushed from the CPU cache, and the importer expects it will be. > The only solution I could think of (not implemented) was to detect in the > attach() call what the importers can do (with dev->coherent_dma_mask if I > recall), and otherwise flush the cache immediately and start flushing the= cache > from now on signalling it for DQBUF (in vb2 workqueue or dqbuf ioctl, I d= on't > have an idea yet). I bet this idea is inapplicable to were you have fence= s, we > don't have that in v4l2. > > This idea was hinted by Robert Becket (now in CC), but perhaps I picked i= t up > wrong, explaining it wrong, etc. I'm no expert, just noticed there wasn't= really > a good plan for that, so one needs to make one up. I'm not aware oh an im= porter > could know how the memory was allocated by the exporter, and worst, how a= n > importer could figure-out that the export is going to produce buffer with= hot > CPU cache (UVC driver does memcpy from USB chunks of variable size to pro= duce a > fixed size image). This is exactly what Christian was saying above. Cheers, Daniel