Skip to contentSkip to conversation

Revert "bus: remove cpu_coherent flag"

PATCH In review Karol Herbst 5 participants 10 messages Sep 18, 2016 – Sep 19, 2016 7 messages not in the archive Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "bus: remove cpu_coherent flag"

This reverts commit 01bbcb69f80e1058395b737ae399c6f4ef48691b.

The commit caused fence timeouts within nvc0_screen_destroy and most likely other places as well.

The most obvious effect is, that userspace processes take minutes to actually quit.

---
 drm/nouveau/include/nvkm/core/device.h | 1 +
 drm/nouveau/nouveau_bo.c               | 3 ++-
 drm/nouveau/nvkm/engine/device/pci.c   | 1 +
 drm/nouveau/nvkm/engine/device/tegra.c | 1 +
 lib/include/nvif/os.h                  | 6 ++++++
 5 files changed, 11 insertions(+), 1 deletion(-)
drm/nouveau/include/nvkm/core/device.h +1 -0
index 7ea8aa7..6bc712f 100644
@@ -175,6 +175,7 @@ struct nvkm_device_func {
 	void (*fini)(struct nvkm_device *, bool suspend);
 	resource_size_t (*resource_addr)(struct nvkm_device *, unsigned bar);
 	resource_size_t (*resource_size)(struct nvkm_device *, unsigned bar);
+	bool cpu_coherent;
 };
 
 struct nvkm_device_quirk {
drm/nouveau/nouveau_bo.c +2 -1
index 528bdef..6887d0a 100644
@@ -209,7 +209,8 @@ nouveau_bo_new(struct drm_device *dev, int size, int align,
 	nvbo->tile_flags = tile_flags;
 	nvbo->bo.bdev = &drm->ttm.bdev;
 
-	nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
+	if (!nvxx_device(&drm->device)->func->cpu_coherent)
+		nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
 
 	nvbo->page_shift = 12;
 	if (drm->client.vm) {
drm/nouveau/nvkm/engine/device/pci.c +1 -0
index b1b6932..62ad030 100644
@@ -1614,6 +1614,7 @@ nvkm_device_pci_func = {
 	.fini = nvkm_device_pci_fini,
 	.resource_addr = nvkm_device_pci_resource_addr,
 	.resource_size = nvkm_device_pci_resource_size,
+	.cpu_coherent = !IS_ENABLED(CONFIG_ARM),
 };
 
 int
drm/nouveau/nvkm/engine/device/tegra.c +1 -0
index 939682f..9b638bd 100644
@@ -245,6 +245,7 @@ nvkm_device_tegra_func = {
 	.fini = nvkm_device_tegra_fini,
 	.resource_addr = nvkm_device_tegra_resource_addr,
 	.resource_size = nvkm_device_tegra_resource_size,
+	.cpu_coherent = false,
 };
 
 int
lib/include/nvif/os.h +6 -0
index b45a186..2f34c5a 100644
@@ -124,6 +124,12 @@ typedef dma_addr_t resource_size_t;
 #define __printf(a,b)
 #define __user
 
+#if defined(CONFIG_ARM)
+#define IS_ENABLED_CONFIG_ARM 1
+#else
+#define IS_ENABLED_CONFIG_ARM 0
+#endif
+
 #if defined(CONFIG_IOMMU_API)
 #define IS_ENABLED_CONFIG_IOMMU_API 1
 #else
Signature · 6 lines
2.10.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20160918102157.3921-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 2/2 nouveau: Fix compile error due to bad include

Cought while working on travis-ci integration

---
 drm/nouveau/uapi/drm/nouveau_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/uapi/drm/nouveau_drm.h +1 -1
index 259588a..0bfaae8 100644
@@ -27,7 +27,7 @@
 
 #define DRM_NOUVEAU_EVENT_NVIF                                       0x80000000
 
-#include "drm.h"
+#include "drm/drm.h"
 
 #if defined(__cplusplus)
 extern "C" {
Signature · 6 lines
2.10.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20160918102157.3921-2-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] nouveau: Fix compile error due to bad include

Every other *_drm.h does #include "drm.h". Something else is wrong.

Quoted 23 lines · Karol Herbst

Cought while working on travis-ci integration

---
 drm/nouveau/uapi/drm/nouveau_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/uapi/drm/nouveau_drm.h +1 -2
index 259588a..0bfaae8 100644
@@ -27,7 +27,7 @@
 
 #define DRM_NOUVEAU_EVENT_NVIF                                       0x80000000
 
-#include "drm.h"
+#include "drm/drm.h"
 
 #if defined(__cplusplus)
 extern "C" {
--

2.10.0

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAKb7Uvg=no4KWS8rLDbNJMk9a6tT_Bt+2oXoy5gzAWYjR5OOCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] nouveau: Fix compile error due to bad include

odd, let me check again

2016-09-18 16:18 GMT+02:00 Ilia Mirkin <[email protected]>:

Quoted 26 lines

Every other *_drm.h does #include "drm.h". Something else is wrong.

Quoted 23 lines · Karol Herbst

Cought while working on travis-ci integration

---
 drm/nouveau/uapi/drm/nouveau_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/uapi/drm/nouveau_drm.h +1 -2
index 259588a..0bfaae8 100644
@@ -27,7 +27,7 @@
 
 #define DRM_NOUVEAU_EVENT_NVIF                                       0x80000000
 
-#include "drm.h"
+#include "drm/drm.h"
 
 #if defined(__cplusplus)
 extern "C" {
--

2.10.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAEXux-anwQoo+vMd+BRp--KAUhz9AJGxu+61ePikMCgB+kW17w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] nouveau: Fix compile error due to bad include

FWIW I also have to carry a local patch doing this, otherwise I cannot perform an out-of-tree module build.

Quoted 29 lines · Karol Herbst

odd, let me check again

2016-09-18 16:18 GMT+02:00 Ilia Mirkin <[email protected]>:

Quoted 26 lines

Every other *_drm.h does #include "drm.h". Something else is wrong.

Quoted 23 lines · Karol Herbst

Cought while working on travis-ci integration

---
 drm/nouveau/uapi/drm/nouveau_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/uapi/drm/nouveau_drm.h +1 -2
index 259588a..0bfaae8 100644
@@ -27,7 +27,7 @@
 
 #define DRM_NOUVEAU_EVENT_NVIF                                       0x80000000
 
-#include "drm.h"
+#include "drm/drm.h"
 
 #if defined(__cplusplus)
 extern "C" {
--

2.10.0

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#9 lore raw

Re: [PATCH 2/2] nouveau: Fix compile error due to bad include

In reply to a message not in the archive
Quoted 12 lines · Karol Herbst

Cought while working on travis-ci integration

---
 drm/nouveau/uapi/drm/nouveau_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/uapi/drm/nouveau_drm.h +0 -0
index 259588a..0bfaae8 100644

drm/nouveau/uapi/drm/nouveau_drm.h line 31

Quoted 6 lines
drm/nouveau/uapi/drm/nouveau_drm.h +1 -1
@@ -27,7 +27,7 @@
 
 #define DRM_NOUVEAU_EVENT_NVIF                                       0x80000000
 
-#include "drm.h"
+#include "drm/drm.h"
 

Afaict this is a side effect of an "incomplete sync" with the kernel code. In there we have the respective header alongside the nouveau_drm.h one.

One workaround is to track drm.h in the nouveau repo, with another to adjust KBUILD_OPTS to honour the upstream one.

KBUILD_OPTS += KCPPFLAGS="-I$(LINUXDIR)/include/uapi/drm"

The above (untested) sounds like the better solution imho.

Regards,
Emil
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#10 lore raw
In reply to a message not in the archive
Quoted 7 lines · Karol Herbst

This reverts commit 01bbcb69f80e1058395b737ae399c6f4ef48691b.

The commit caused fence timeouts within nvc0_screen_destroy and most likely other places as well.

The most obvious effect is, that userspace processes take minutes to actually quit.

Quoted 80 lines
---
 drm/nouveau/include/nvkm/core/device.h | 1 +
 drm/nouveau/nouveau_bo.c               | 3 ++-
 drm/nouveau/nvkm/engine/device/pci.c   | 1 +
 drm/nouveau/nvkm/engine/device/tegra.c | 1 +
 lib/include/nvif/os.h                  | 6 ++++++
 5 files changed, 11 insertions(+), 1 deletion(-)
drm/nouveau/include/nvkm/core/device.h +1 -0
index 7ea8aa7..6bc712f 100644
@@ -175,6 +175,7 @@ struct nvkm_device_func {
        void (*fini)(struct nvkm_device *, bool suspend);
        resource_size_t (*resource_addr)(struct nvkm_device *, unsigned bar);
        resource_size_t (*resource_size)(struct nvkm_device *, unsigned bar);
+       bool cpu_coherent;
 };
 
 struct nvkm_device_quirk {
drm/nouveau/nouveau_bo.c +2 -1
index 528bdef..6887d0a 100644
@@ -209,7 +209,8 @@ nouveau_bo_new(struct drm_device *dev, int size, int align,
        nvbo->tile_flags = tile_flags;
        nvbo->bo.bdev = &drm->ttm.bdev;
 
-       nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
+       if (!nvxx_device(&drm->device)->func->cpu_coherent)
+               nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
 
        nvbo->page_shift = 12;
        if (drm->client.vm) {
drm/nouveau/nvkm/engine/device/pci.c +1 -0
index b1b6932..62ad030 100644
@@ -1614,6 +1614,7 @@ nvkm_device_pci_func = {
        .fini = nvkm_device_pci_fini,
        .resource_addr = nvkm_device_pci_resource_addr,
        .resource_size = nvkm_device_pci_resource_size,
+       .cpu_coherent = !IS_ENABLED(CONFIG_ARM),
 };
 
 int
drm/nouveau/nvkm/engine/device/tegra.c +1 -0
index 939682f..9b638bd 100644
@@ -245,6 +245,7 @@ nvkm_device_tegra_func = {
        .fini = nvkm_device_tegra_fini,
        .resource_addr = nvkm_device_tegra_resource_addr,
        .resource_size = nvkm_device_tegra_resource_size,
+       .cpu_coherent = false,
 };
 
 int
lib/include/nvif/os.h +6 -1
index b45a186..2f34c5a 100644
@@ -124,6 +124,12 @@ typedef dma_addr_t resource_size_t;
 #define __printf(a,b)
 #define __user
 
+#if defined(CONFIG_ARM)
+#define IS_ENABLED_CONFIG_ARM 1
+#else
+#define IS_ENABLED_CONFIG_ARM 0
+#endif
+
 #if defined(CONFIG_IOMMU_API)
 #define IS_ENABLED_CONFIG_IOMMU_API 1
 #else
--

2.10.0

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAAVeFuL2mGPzfe1PJJmhOc7wv+XVDXomAUz4n8Fj8RHov-fBMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#12 lore raw
Quoted 2 lines · Alexandre Courbot
Quoted 1 line · Karol Herbst

This reverts commit 01bbcb69f80e1058395b737ae399c6f4ef48691b.

I think you meant aff51175cdbf345740ec9203eff88e772af88059 - that's the commit id that matters, not the one in Ben's non-linux repo.

Quoted 8 lines
Quoted 6 lines

The commit caused fence timeouts within nvc0_screen_destroy and most likely other places as well.

The most obvious effect is, that userspace processes take minutes to actually quit.

If this doesn't make it into v4.8 (which is due to be released in a week), it should get tagged for stable as well.

By the way, Alexandre, I believe Martin was reporting issues like this on his TK1 before this change as well. Probably worth investigating - sounds like there's a wider issue with TTM_PL_FLAG_UNCACHED and/or force_coherent.

Quoted 81 lines
Quoted 81 lines
---
 drm/nouveau/include/nvkm/core/device.h | 1 +
 drm/nouveau/nouveau_bo.c               | 3 ++-
 drm/nouveau/nvkm/engine/device/pci.c   | 1 +
 drm/nouveau/nvkm/engine/device/tegra.c | 1 +
 lib/include/nvif/os.h                  | 6 ++++++
 5 files changed, 11 insertions(+), 1 deletion(-)
drm/nouveau/include/nvkm/core/device.h +1 -0
index 7ea8aa7..6bc712f 100644
@@ -175,6 +175,7 @@ struct nvkm_device_func {
        void (*fini)(struct nvkm_device *, bool suspend);
        resource_size_t (*resource_addr)(struct nvkm_device *, unsigned bar);
        resource_size_t (*resource_size)(struct nvkm_device *, unsigned bar);
+       bool cpu_coherent;
 };
 
 struct nvkm_device_quirk {
drm/nouveau/nouveau_bo.c +2 -1
index 528bdef..6887d0a 100644
@@ -209,7 +209,8 @@ nouveau_bo_new(struct drm_device *dev, int size, int align,
        nvbo->tile_flags = tile_flags;
        nvbo->bo.bdev = &drm->ttm.bdev;
 
-       nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
+       if (!nvxx_device(&drm->device)->func->cpu_coherent)
+               nvbo->force_coherent = flags & TTM_PL_FLAG_UNCACHED;
 
        nvbo->page_shift = 12;
        if (drm->client.vm) {
drm/nouveau/nvkm/engine/device/pci.c +1 -0
index b1b6932..62ad030 100644
@@ -1614,6 +1614,7 @@ nvkm_device_pci_func = {
        .fini = nvkm_device_pci_fini,
        .resource_addr = nvkm_device_pci_resource_addr,
        .resource_size = nvkm_device_pci_resource_size,
+       .cpu_coherent = !IS_ENABLED(CONFIG_ARM),
 };
 
 int
drm/nouveau/nvkm/engine/device/tegra.c +1 -0
index 939682f..9b638bd 100644
@@ -245,6 +245,7 @@ nvkm_device_tegra_func = {
        .fini = nvkm_device_tegra_fini,
        .resource_addr = nvkm_device_tegra_resource_addr,
        .resource_size = nvkm_device_tegra_resource_size,
+       .cpu_coherent = false,
 };
 
 int
lib/include/nvif/os.h +6 -1
index b45a186..2f34c5a 100644
@@ -124,6 +124,12 @@ typedef dma_addr_t resource_size_t;
 #define __printf(a,b)
 #define __user
 
+#if defined(CONFIG_ARM)
+#define IS_ENABLED_CONFIG_ARM 1
+#else
+#define IS_ENABLED_CONFIG_ARM 0
+#endif
+
 #if defined(CONFIG_IOMMU_API)
 #define IS_ENABLED_CONFIG_IOMMU_API 1
 #else
--

2.10.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAKb7UvhEZtnj-wyKzUtg1ASSJj0Ce9p9y+bC_+05ikbo8fcdiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#14 lore raw
Quoted 16 lines · Ilia Mirkin
Quoted 2 lines · Alexandre Courbot
Quoted 1 line · Karol Herbst

This reverts commit 01bbcb69f80e1058395b737ae399c6f4ef48691b.

I think you meant aff51175cdbf345740ec9203eff88e772af88059 - that's the commit id that matters, not the one in Ben's non-linux repo.

Quoted 8 lines
Quoted 6 lines

The commit caused fence timeouts within nvc0_screen_destroy and most likely other places as well.

The most obvious effect is, that userspace processes take minutes to actually quit.

Quoted 7 lines

If this doesn't make it into v4.8 (which is due to be released in a week), it should get tagged for stable as well.

By the way, Alexandre, I believe Martin was reporting issues like this on his TK1 before this change as well. Probably worth investigating - sounds like there's a wider issue with TTM_PL_FLAG_UNCACHED and/or force_coherent.

Yes, it may be indeed related. I need to sync with Martin to understand his exact repro case.
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAAVeFuL3V3MZNcDSUPvsnjLPABGvccF0GzZ-xL4C8DaKX_-eJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw
Quoted 16 lines · Alexandre Courbot
Quoted 15 lines · Ilia Mirkin
Quoted 2 lines · Alexandre Courbot
Quoted 1 line · Karol Herbst

This reverts commit 01bbcb69f80e1058395b737ae399c6f4ef48691b.

I think you meant aff51175cdbf345740ec9203eff88e772af88059 - that's the commit id that matters, not the one in Ben's non-linux repo.

Quoted 6 lines
Quoted 5 lines

The commit caused fence timeouts within nvc0_screen_destroy and most likely other places as well.

The most obvious effect is, that userspace processes take minutes to actually quit.

If this doesn't make it into v4.8 (which is due to be released in a week), it should get tagged for stable as well.

Quoted 6 lines
Quoted 4 lines

By the way, Alexandre, I believe Martin was reporting issues like this on his TK1 before this change as well. Probably worth investigating - sounds like there's a wider issue with TTM_PL_FLAG_UNCACHED and/or force_coherent.

Yes, it may be indeed related. I need to sync with Martin to understand his exact repro case.

Running piglit on the tk1 is enough for me, but I will try to update the kernel again to see if it helps.

The issue is that mesa is waiting on a fence that never gets synced on in the gbm destructor. The probably of having the timeout is about 50/50, so it is easy-enough to reproduce in my case :s

Martin

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau