* io-mapping: Indicate mapping failure
@ 2020-07-21 15:34 Michael J. Ruhl
2020-07-21 15:34 ` Michael J. Ruhl
2020-07-21 15:57 ` Andy Shevchenko
0 siblings, 2 replies; 6+ messages in thread
From: Michael J. Ruhl @ 2020-07-21 15:34 UTC (permalink / raw)
To: dri-devel; +Cc: Andy Shevchenko, Mike Rapoport
I found this when my system crashed long after the mapping failure.
The expected behavior should have been driver exit.
Since this is almost exclusively used for drm, I am posting to
the dri mailing list. Should this go to another list as well?
Thanks,
Mike
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1] io-mapping: Indicate mapping failure
2020-07-21 15:34 io-mapping: Indicate mapping failure Michael J. Ruhl
@ 2020-07-21 15:34 ` Michael J. Ruhl
2020-07-21 15:57 ` Andy Shevchenko
1 sibling, 0 replies; 6+ messages in thread
From: Michael J. Ruhl @ 2020-07-21 15:34 UTC (permalink / raw)
To: dri-devel
Cc: Michael J. Ruhl, Andrew Morton, Mike Rapoport, Andy Shevchenko,
Chris Wilson, stable
The !ATOMIC_IOMAP version of io_maping_init_wc will always return
success, even when the ioremap fails.
Since the ATOMIC_IOMAP version returns NULL when the init fails, and
callers check for a NULL return on error this is unexpected.
Return NULL on ioremap failure.
Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
include/linux/io-mapping.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 0beaa3eba155..5641e06cbcf7 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -118,7 +118,7 @@ io_mapping_init_wc(struct io_mapping *iomap,
iomap->prot = pgprot_noncached(PAGE_KERNEL);
#endif
- return iomap;
+ return iomap->iomem ? iomap : NULL;
}
static inline void
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1] io-mapping: Indicate mapping failure
@ 2020-07-21 15:34 ` Michael J. Ruhl
0 siblings, 0 replies; 6+ messages in thread
From: Michael J. Ruhl @ 2020-07-21 15:34 UTC (permalink / raw)
To: dri-devel
Cc: Mike Rapoport, stable, Chris Wilson, Michael J. Ruhl,
Andrew Morton, Andy Shevchenko
The !ATOMIC_IOMAP version of io_maping_init_wc will always return
success, even when the ioremap fails.
Since the ATOMIC_IOMAP version returns NULL when the init fails, and
callers check for a NULL return on error this is unexpected.
Return NULL on ioremap failure.
Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
include/linux/io-mapping.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 0beaa3eba155..5641e06cbcf7 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -118,7 +118,7 @@ io_mapping_init_wc(struct io_mapping *iomap,
iomap->prot = pgprot_noncached(PAGE_KERNEL);
#endif
- return iomap;
+ return iomap->iomem ? iomap : NULL;
}
static inline void
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] io-mapping: Indicate mapping failure
2020-07-21 15:34 ` Michael J. Ruhl
@ 2020-07-21 15:56 ` Andy Shevchenko
-1 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-21 15:56 UTC (permalink / raw)
To: Michael J. Ruhl
Cc: dri-devel, Andrew Morton, Mike Rapoport, Chris Wilson, stable
On Tue, Jul 21, 2020 at 11:34:26AM -0400, Michael J. Ruhl wrote:
Thanks for an update, my comments below.
> The !ATOMIC_IOMAP version of io_maping_init_wc will always return
> success, even when the ioremap fails.
>
> Since the ATOMIC_IOMAP version returns NULL when the init fails, and
> callers check for a NULL return on error this is unexpected.
>
> Return NULL on ioremap failure.
>
> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"
Missed parenthesis.
Still not visible why Fixes tag.
Provide also couple of lines of crash and add a paragraph about it.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] io-mapping: Indicate mapping failure
@ 2020-07-21 15:56 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-21 15:56 UTC (permalink / raw)
To: Michael J. Ruhl
Cc: Andrew Morton, Chris Wilson, stable, dri-devel, Mike Rapoport
On Tue, Jul 21, 2020 at 11:34:26AM -0400, Michael J. Ruhl wrote:
Thanks for an update, my comments below.
> The !ATOMIC_IOMAP version of io_maping_init_wc will always return
> success, even when the ioremap fails.
>
> Since the ATOMIC_IOMAP version returns NULL when the init fails, and
> callers check for a NULL return on error this is unexpected.
>
> Return NULL on ioremap failure.
>
> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"
Missed parenthesis.
Still not visible why Fixes tag.
Provide also couple of lines of crash and add a paragraph about it.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: io-mapping: Indicate mapping failure
2020-07-21 15:34 io-mapping: Indicate mapping failure Michael J. Ruhl
2020-07-21 15:34 ` Michael J. Ruhl
@ 2020-07-21 15:57 ` Andy Shevchenko
1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-21 15:57 UTC (permalink / raw)
To: Michael J. Ruhl; +Cc: dri-devel, Mike Rapoport
On Tue, Jul 21, 2020 at 11:34:25AM -0400, Michael J. Ruhl wrote:
> I found this when my system crashed long after the mapping failure.
> The expected behavior should have been driver exit.
>
> Since this is almost exclusively used for drm, I am posting to
> the dri mailing list. Should this go to another list as well?
Just drop this cover letter. For single patch is not needed. Use place
immediately after cutter '---' line for comments like above.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-22 7:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 15:34 io-mapping: Indicate mapping failure Michael J. Ruhl
2020-07-21 15:34 ` [PATCH v1] " Michael J. Ruhl
2020-07-21 15:34 ` Michael J. Ruhl
2020-07-21 15:56 ` Andy Shevchenko
2020-07-21 15:56 ` Andy Shevchenko
2020-07-21 15:57 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.