* Re: [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range [not found] ` <CALCETrV2E-LBHLTV6zJ=nfw8ijjV8VZoYAinXdg9ZaOryfqquw@mail.gmail.com> @ 2014-11-13 17:11 ` Borislav Petkov 2014-11-13 17:33 ` Ville Syrjälä 0 siblings, 1 reply; 5+ messages in thread From: Borislav Petkov @ 2014-11-13 17:11 UTC (permalink / raw) To: Andy Lutomirski Cc: intel-gfx, X86 ML, linux-kernel@vger.kernel.org, DRI, Ingo Molnar, Ross Zwisler, H Peter Anvin, Thomas Gleixner On Thu, Nov 13, 2014 at 08:38:23AM -0800, Andy Lutomirski wrote: > On Nov 13, 2014 3:20 AM, "Borislav Petkov" <bp@alien8.de> wrote: > > > > On Wed, Nov 12, 2014 at 07:14:21PM -0800, Andy Lutomirski wrote: > > > On 11/11/2014 10:43 AM, Ross Zwisler wrote: > > > > If clwb is available on the system, use it in drm_clflush_virt_range. > > > > If clwb is not available, fall back to clflushopt if you can. > > > > If clflushopt is not supported, fall all the way back to clflush. > > > > > > I don't know exactly what drm_clflush_virt_range (and the other > > > functions you're modifying similarly) are for, but it seems plausible to > > > me that they're used before reads to make sure that non-coherent memory > > > sees updated data. If that's true, then this will break it. > > > > Why would it break it? The updated cachelines will be in memory and > > subsequent reads will be serviced from the cache instead from going to > > memory as it is not invalidated as it would be by CLFLUSH. > > > > /me is puzzled. > > Suppose you map some device memory WB, and then the device > non-coherently updates. If you want the CPU to see it, you need > clflush or clflushopt. Some architectures might do this for > dma_sync_single_for_cpu with DMA_FROM_DEVICE. Ah, you're talking about the other way around - the device does the writes. Well, the usage sites are all in i915*, maybe we should ask them - it looks to me like this is only the CPU making stuff visible in the shared buffer but I don't know that code... intel-gfx CCed although dri-devel is already on CC. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range 2014-11-13 17:11 ` [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range Borislav Petkov @ 2014-11-13 17:33 ` Ville Syrjälä 2014-11-13 17:47 ` Borislav Petkov 2014-11-13 18:43 ` Ville Syrjälä 0 siblings, 2 replies; 5+ messages in thread From: Ville Syrjälä @ 2014-11-13 17:33 UTC (permalink / raw) To: Borislav Petkov Cc: Andy Lutomirski, intel-gfx, X86 ML, linux-kernel@vger.kernel.org, DRI, Ingo Molnar, Ross Zwisler, H Peter Anvin, Thomas Gleixner On Thu, Nov 13, 2014 at 06:11:33PM +0100, Borislav Petkov wrote: > On Thu, Nov 13, 2014 at 08:38:23AM -0800, Andy Lutomirski wrote: > > On Nov 13, 2014 3:20 AM, "Borislav Petkov" <bp@alien8.de> wrote: > > > > > > On Wed, Nov 12, 2014 at 07:14:21PM -0800, Andy Lutomirski wrote: > > > > On 11/11/2014 10:43 AM, Ross Zwisler wrote: > > > > > If clwb is available on the system, use it in drm_clflush_virt_range. > > > > > If clwb is not available, fall back to clflushopt if you can. > > > > > If clflushopt is not supported, fall all the way back to clflush. > > > > > > > > I don't know exactly what drm_clflush_virt_range (and the other > > > > functions you're modifying similarly) are for, but it seems plausible to > > > > me that they're used before reads to make sure that non-coherent memory > > > > sees updated data. If that's true, then this will break it. > > > > > > Why would it break it? The updated cachelines will be in memory and > > > subsequent reads will be serviced from the cache instead from going to > > > memory as it is not invalidated as it would be by CLFLUSH. > > > > > > /me is puzzled. > > > > Suppose you map some device memory WB, and then the device > > non-coherently updates. If you want the CPU to see it, you need > > clflush or clflushopt. Some architectures might do this for > > dma_sync_single_for_cpu with DMA_FROM_DEVICE. > > Ah, you're talking about the other way around - the device does the > writes. Well, the usage sites are all in i915*, maybe we should ask > them - it looks to me like this is only the CPU making stuff visible in > the shared buffer but I don't know that code... intel-gfx CCed although > dri-devel is already on CC. We use it both ways in i915. So please don't break it. -- Ville Syrjälä Intel OTC ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range 2014-11-13 17:33 ` Ville Syrjälä @ 2014-11-13 17:47 ` Borislav Petkov 2014-11-13 18:14 ` Ville Syrjälä 2014-11-13 18:43 ` Ville Syrjälä 1 sibling, 1 reply; 5+ messages in thread From: Borislav Petkov @ 2014-11-13 17:47 UTC (permalink / raw) To: Ville Syrjälä Cc: intel-gfx, X86 ML, linux-kernel@vger.kernel.org, DRI, Andy Lutomirski, Thomas Gleixner, Ross Zwisler, H Peter Anvin, Ingo Molnar On Thu, Nov 13, 2014 at 07:33:54PM +0200, Ville Syrjälä wrote: > We use it both ways in i915. So please don't break it. Haha, we started from Intel with Ross' patch and made a full circle back. Maybe you guys should talk about it. LOL. :-) -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range 2014-11-13 17:47 ` Borislav Petkov @ 2014-11-13 18:14 ` Ville Syrjälä 0 siblings, 0 replies; 5+ messages in thread From: Ville Syrjälä @ 2014-11-13 18:14 UTC (permalink / raw) To: Borislav Petkov Cc: intel-gfx, X86 ML, linux-kernel@vger.kernel.org, DRI, Andy Lutomirski, Thomas Gleixner, Ross Zwisler, H Peter Anvin, Ingo Molnar On Thu, Nov 13, 2014 at 06:47:34PM +0100, Borislav Petkov wrote: > On Thu, Nov 13, 2014 at 07:33:54PM +0200, Ville Syrjälä wrote: > > We use it both ways in i915. So please don't break it. > > Haha, we started from Intel with Ross' patch and made a full circle > back. Maybe you guys should talk about it. > > LOL. :-) Indeed. The problem I see with these patches is that they don't actually tell what the new instruction does, so a casual glance doesn't really raise any red flags. Another excuse I can use is that I just got used to the fact that the x86 hasn't historically bothered separating invalidate and writeback and just does both. In my previous life on the dark^Warm side I did actually know the difference :) But there's plenty of blame to go around to the other side of the fence too. We should have documented what we expect from these functions. Currently you just have to know/guess, and that's just not good enough. -- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range 2014-11-13 17:33 ` Ville Syrjälä 2014-11-13 17:47 ` Borislav Petkov @ 2014-11-13 18:43 ` Ville Syrjälä 1 sibling, 0 replies; 5+ messages in thread From: Ville Syrjälä @ 2014-11-13 18:43 UTC (permalink / raw) To: Borislav Petkov Cc: Andy Lutomirski, intel-gfx, X86 ML, linux-kernel@vger.kernel.org, DRI, Ingo Molnar, Ross Zwisler, H Peter Anvin, Thomas Gleixner On Thu, Nov 13, 2014 at 07:33:54PM +0200, Ville Syrjälä wrote: > On Thu, Nov 13, 2014 at 06:11:33PM +0100, Borislav Petkov wrote: > > On Thu, Nov 13, 2014 at 08:38:23AM -0800, Andy Lutomirski wrote: > > > On Nov 13, 2014 3:20 AM, "Borislav Petkov" <bp@alien8.de> wrote: > > > > > > > > On Wed, Nov 12, 2014 at 07:14:21PM -0800, Andy Lutomirski wrote: > > > > > On 11/11/2014 10:43 AM, Ross Zwisler wrote: > > > > > > If clwb is available on the system, use it in drm_clflush_virt_range. > > > > > > If clwb is not available, fall back to clflushopt if you can. > > > > > > If clflushopt is not supported, fall all the way back to clflush. > > > > > > > > > > I don't know exactly what drm_clflush_virt_range (and the other > > > > > functions you're modifying similarly) are for, but it seems plausible to > > > > > me that they're used before reads to make sure that non-coherent memory > > > > > sees updated data. If that's true, then this will break it. > > > > > > > > Why would it break it? The updated cachelines will be in memory and > > > > subsequent reads will be serviced from the cache instead from going to > > > > memory as it is not invalidated as it would be by CLFLUSH. > > > > > > > > /me is puzzled. > > > > > > Suppose you map some device memory WB, and then the device > > > non-coherently updates. If you want the CPU to see it, you need > > > clflush or clflushopt. Some architectures might do this for > > > dma_sync_single_for_cpu with DMA_FROM_DEVICE. > > > > Ah, you're talking about the other way around - the device does the > > writes. Well, the usage sites are all in i915*, maybe we should ask > > them - it looks to me like this is only the CPU making stuff visible in > > the shared buffer but I don't know that code... intel-gfx CCed although > > dri-devel is already on CC. > > We use it both ways in i915. So please don't break it. Actually to clarify a bit, I think we shouldn't actually need the invalidate part for any modern platform with shared LLC. Apart from the display those tend to be fully coherent, so we only have to care about the display controller not seeing stale data in memory. I have no idea which platforms support this instruction. If Baytrail/Braswell/Cherrytrail are on the list, then we have a problem. Otherwise we should probably be fine with it. But I'm not 100% sure about any future platforms that are still under wraps. Also ttm seems to use some of this stuff. Not sure what they expect from it. -- Ville Syrjälä Intel OTC ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-13 18:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1415731396-19364-1-git-send-email-ross.zwisler@linux.intel.com>
[not found] ` <1415731396-19364-7-git-send-email-ross.zwisler@linux.intel.com>
[not found] ` <5464220D.6090204@amacapital.net>
[not found] ` <20141113112017.GA14416@pd.tnic>
[not found] ` <CALCETrV2E-LBHLTV6zJ=nfw8ijjV8VZoYAinXdg9ZaOryfqquw@mail.gmail.com>
2014-11-13 17:11 ` [PATCH 6/6] x86: Use clwb in drm_clflush_virt_range Borislav Petkov
2014-11-13 17:33 ` Ville Syrjälä
2014-11-13 17:47 ` Borislav Petkov
2014-11-13 18:14 ` Ville Syrjälä
2014-11-13 18:43 ` Ville Syrjälä
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox