Re: [PATCH] io-mapping: Indicate mapping failure
On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote: > Sometimes it is good to know when your mapping failed. Can you elaborate... > Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata > about the io-mapping" ...especially taking into account that Fixes implies regression / bug? -- With Best Regards, Andy Shevchenko ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] io-mapping: Indicate mapping failure
On Tue, Jul 21, 2020 at 03:00:41PM +, Ruhl, Michael J wrote: > >-Original Message- > >From: Andy Shevchenko > >Sent: Tuesday, July 21, 2020 10:47 AM > >To: Ruhl, Michael J > >Cc: dri-devel@lists.freedesktop.org; Andrew Morton >foundation.org>; Mike Rapoport ; Chris Wilson > >; sta...@vger.kernel.org > >Subject: Re: [PATCH] io-mapping: Indicate mapping failure > > > >On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote: > >> Sometimes it is good to know when your mapping failed. I was going to say it's always a good idea ;-) > >Can you elaborate... > > Sure, guess I was too glib. > > Currently the io_mapping_init_wc (the !ATOMIC_IOMAP version), function will > always return success. > > If the setting of the iomem (from ioremap_wc) fails, the only way for the > caller to know is to check the value of iomap->iomem. > > Since all of the callers expect a NULL return on error, and check for a NULL, > I felt this needed a fixes (i.e. unexpected behavior). > > >> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata > >about the io-mapping" > > > >...especially taking into account that Fixes implies regression / bug? > > The failure (in my case a crash) is not revealed until the address is accessed > long after the init. > > I will update the commit. > > Mike > > >-- > >With Best Regards, > >Andy Shevchenko > > > -- Sincerely yours, Mike. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH] io-mapping: Indicate mapping failure
>-Original Message- >From: Andy Shevchenko >Sent: Tuesday, July 21, 2020 10:47 AM >To: Ruhl, Michael J >Cc: dri-devel@lists.freedesktop.org; Andrew Morton foundation.org>; Mike Rapoport ; Chris Wilson >; sta...@vger.kernel.org >Subject: Re: [PATCH] io-mapping: Indicate mapping failure > >On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote: >> Sometimes it is good to know when your mapping failed. > >Can you elaborate... Sure, guess I was too glib. Currently the io_mapping_init_wc (the !ATOMIC_IOMAP version), function will always return success. If the setting of the iomem (from ioremap_wc) fails, the only way for the caller to know is to check the value of iomap->iomem. Since all of the callers expect a NULL return on error, and check for a NULL, I felt this needed a fixes (i.e. unexpected behavior). >> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata >about the io-mapping" > >...especially taking into account that Fixes implies regression / bug? The failure (in my case a crash) is not revealed until the address is accessed long after the init. I will update the commit. Mike >-- >With Best Regards, >Andy Shevchenko > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] io-mapping: Indicate mapping failure
Sometimes it is good to know when your mapping failed. Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping" Cc: Andrew Morton Cc: Mike Rapoport Cc: Andy Shevchenko Cc: Chris Wilson Cc: sta...@vger.kernel.org Signed-off-by: Michael J. Ruhl --- 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