All of lore.kernel.org
 help / color / mirror / Atom feed
* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
@ 2018-06-24 20:37 Jordan Glover
  2018-06-24 21:15 ` Scott Bauer
  0 siblings, 1 reply; 10+ messages in thread
From: Jordan Glover @ 2018-06-24 20:37 UTC (permalink / raw)



Hello, 

After update to Linux 4.18-rc2 I see the following warning at every boot.
It doesn't occur on Linux 4.18-rc1.

WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Tainted: G                T 4.18.0 #1
Hardware name: LENOVO 20JJS0HD00/20JJS0HD00, BIOS R0HET49W (1.29 ) 06/12/2018
RIP: 0010:nvme_probe+0x212/0x440
Code: a8 0f 84 35 01 00 00 48 8d bb 98 01 00 00 4c 89 f1 48 c7 c2 40 fc ca 97 4c 89 fe e8 68 5f ff ff 89 c5 85 c0 0f 85 c7 00 00 00 <0f> 0b 41 b8 c0 00 60 00 45 89 e1 b9 e0 13 00 00 48 c7 c2 a0 0b 1a 
RSP: 0000:ffff9f15c0cbbd20 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff935ad769b018 RCX: 0000000000000000
RDX: ffff935ad78eddc0 RSI: 00000000000186a0 RDI: ffffffff980bfe40
RBP: 0000000000000000 R08: 0000000000000002 R09: ffff935ad7699010
R10: 00000000fffffffc R11: 0000000000000020 R12: 00000000ffffffff
R13: ffff935ad769e030 R14: 0000000000000000 R15: ffff935ad769e0d0
FS:  0000000000000000(0000) GS:ffff935ae1400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000006d008001 CR4: 00000000003606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 local_pci_probe+0x41/0x90
 pci_device_probe+0x189/0x1a0
 driver_probe_device+0x2b3/0x450
 __driver_attach+0xdd/0x110
 ? driver_probe_device+0x450/0x450
 ? driver_probe_device+0x450/0x450
 bus_for_each_dev+0x8c/0xd0
 bus_add_driver+0x151/0x230
 ? trace_event_define_fields_nvme_setup_nvm_cmd+0x1ce/0x1ce
 driver_register+0x6b/0xb0
 ? trace_event_define_fields_nvme_setup_nvm_cmd+0x1ce/0x1ce
 do_one_initcall+0x46/0x1fb
 kernel_init_freeable+0x335/0x434
 ? rest_init+0xc5/0xc5
 kernel_init+0xa/0x102
 ret_from_fork+0x35/0x40
---[ end trace 72e724386090a223 ]---
nvme nvme0: pci function 0000:05:00.0

Jordan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-24 20:37 [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440 Jordan Glover
@ 2018-06-24 21:15 ` Scott Bauer
  2018-06-24 22:06   ` Jordan Glover
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Bauer @ 2018-06-24 21:15 UTC (permalink / raw)


On Sun, Jun 24, 2018@04:37:35PM -0400, Jordan Glover wrote:
> 
> Hello, 
> 
> After update to Linux 4.18-rc2 I see the following warning at every boot.
> It doesn't occur on Linux 4.18-rc1.
> 
> WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
> Modules linked in:

I suspect that you have CONFIG_DEBUG_SG and CONFIG_NEED_SG_DMA_LENGTH set, can you
confirm for us please?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-24 21:15 ` Scott Bauer
@ 2018-06-24 22:06   ` Jordan Glover
  2018-06-25  3:13     ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Jordan Glover @ 2018-06-24 22:06 UTC (permalink / raw)


On June 24, 2018 11:15 PM, Scott Bauer <scott.bauer@intel.com> wrote:

> On Sun, Jun 24, 2018@04:37:35PM -0400, Jordan Glover wrote:
> 
> > Hello,
> > 
> > After update to Linux 4.18-rc2 I see the following warning at every boot.
> > 
> > It doesn't occur on Linux 4.18-rc1.
> > 
> > WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
> > 
> > Modules linked in:
> 
> I suspect that you have CONFIG_DEBUG_SG and CONFIG_NEED_SG_DMA_LENGTH set, can you
> 
> confirm for us please?

Yes, I have both of them enabled.

Jordan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-24 22:06   ` Jordan Glover
@ 2018-06-25  3:13     ` Jens Axboe
  2018-06-25 11:13       ` Jordan Glover
  0 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2018-06-25  3:13 UTC (permalink / raw)


On 6/24/18 4:06 PM, Jordan Glover wrote:
> On June 24, 2018 11:15 PM, Scott Bauer <scott.bauer@intel.com> wrote:
> 
>> On Sun, Jun 24, 2018@04:37:35PM -0400, Jordan Glover wrote:
>>
>>> Hello,
>>>
>>> After update to Linux 4.18-rc2 I see the following warning at every boot.
>>>
>>> It doesn't occur on Linux 4.18-rc1.
>>>
>>> WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
>>>
>>> Modules linked in:
>>
>> I suspect that you have CONFIG_DEBUG_SG and CONFIG_NEED_SG_DMA_LENGTH set, can you
>>
>> confirm for us please?
> 
> Yes, I have both of them enabled.

Ugh, CONFIG_NEED_SG_DMA_LENGTH was accounted for, but the debug was not.
Actually I think it's about time to remove it, I'm not aware of anything
interesting it's caught since I introduced it.

We can still retain the other checks, just getting rid of the magic.

diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 51f52020ad5f..88544bf2359a 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -9,9 +9,6 @@
 #include <asm/io.h>
 
 struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
-	unsigned long	sg_magic;
-#endif
 	unsigned long	page_link;
 	unsigned int	offset;
 	unsigned int	length;
@@ -98,7 +95,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
 	 */
 	BUG_ON((unsigned long) page & (SG_CHAIN | SG_END));
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	sg->page_link = page_link | (unsigned long) page;
@@ -129,7 +125,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
 static inline struct page *sg_page(struct scatterlist *sg)
 {
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END));
@@ -195,9 +190,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
  **/
 static inline void sg_mark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	/*
 	 * Set termination bit, clear potential chain bit
 	 */
@@ -215,9 +207,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
  **/
 static inline void sg_unmark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	sg->page_link &= ~SG_END;
 }
 
@@ -260,12 +249,6 @@ static inline void *sg_virt(struct scatterlist *sg)
 static inline void sg_init_marker(struct scatterlist *sgl,
 				  unsigned int nents)
 {
-#ifdef CONFIG_DEBUG_SG
-	unsigned int i;
-
-	for (i = 0; i < nents; i++)
-		sgl[i].sg_magic = SG_MAGIC;
-#endif
 	sg_mark_end(&sgl[nents - 1]);
 }
 
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 1642fd507a96..7c6096a71704 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -24,9 +24,6 @@
  **/
 struct scatterlist *sg_next(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	if (sg_is_last(sg))
 		return NULL;
 
@@ -111,10 +108,7 @@ struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
 	for_each_sg(sgl, sg, nents, i)
 		ret = sg;
 
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sgl[0].sg_magic != SG_MAGIC);
 	BUG_ON(!sg_is_last(ret));
-#endif
 	return ret;
 }
 EXPORT_SYMBOL(sg_last);

-- 
Jens Axboe


-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-25  3:13     ` Jens Axboe
@ 2018-06-25 11:13       ` Jordan Glover
  2018-06-25 13:52         ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Jordan Glover @ 2018-06-25 11:13 UTC (permalink / raw)


On June 25, 2018 5:13 AM, Jens Axboe <axboe@kernel.dk> wrote:
> 
> Ugh, CONFIG_NEED_SG_DMA_LENGTH was accounted for, but the debug was not.
> 
> Actually I think it's about time to remove it, I'm not aware of anything
> 
> interesting it's caught since I introduced it.
> 
> We can still retain the other checks, just getting rid of the magic.
> 
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> 
> index 51f52020ad5f..88544bf2359a 100644
> 
> --- a/include/linux/scatterlist.h
> 
> +++ b/include/linux/scatterlist.h
> 
> @@ -9,9 +9,6 @@
> 
> #include <asm/io.h>
> 
> struct scatterlist {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   unsigned long sg_magic;
>     
>     -#endif
>     
>     unsigned long page_link;
>     
>     unsigned int offset;
>     
>     unsigned int length;
>     
>     @@ -98,7 +95,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
>     
>     */
>     
>     BUG_ON((unsigned long) page & (SG_CHAIN | SG_END));
>     
>     #ifdef CONFIG_DEBUG_SG
>     
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     sg->page_link = page_link | (unsigned long) page;
>     
> 
> @@ -129,7 +125,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
> 
> static inline struct page *sg_page(struct scatterlist *sg)
> 
> {
> 
> #ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END));
>     
> 
> @@ -195,9 +190,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
> 
> **/
> 
> static inline void sg_mark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> /*
> 
> * Set termination bit, clear potential chain bit
> 
> */
> 
> @@ -215,9 +207,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
> 
> **/
> 
> static inline void sg_unmark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> sg->page_link &= ~SG_END;
> 
> }
> 
> @@ -260,12 +249,6 @@ static inline void *sg_virt(struct scatterlist *sg)
> 
> static inline void sg_init_marker(struct scatterlist *sgl,
> 
> unsigned int nents)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   unsigned int i;
> -   
> -   for (i = 0; i < nents; i++)
> -         sgl[i].sg_magic = SG_MAGIC;
>         
>     
> 
> -#endif
> 
> sg_mark_end(&sgl[nents - 1]);
> 
> }
> 
> diff --git a/lib/scatterlist.c b/lib/scatterlist.c
> 
> index 1642fd507a96..7c6096a71704 100644
> 
> --- a/lib/scatterlist.c
> 
> +++ b/lib/scatterlist.c
> 
> @@ -24,9 +24,6 @@
> 
> **/
> 
> struct scatterlist *sg_next(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> if (sg_is_last(sg))
> 
> return NULL;
> 
> @@ -111,10 +108,7 @@ struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
> 
> for_each_sg(sgl, sg, nents, i)
> 
> ret = sg;
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sgl[0].sg_magic != SG_MAGIC);
>     
>     BUG_ON(!sg_is_last(ret));
>     
>     -#endif
>     
>     return ret;
>     
>     }
>     
>     EXPORT_SYMBOL(sg_last);
>     
>     --
>     
>     Jens Axboe

Above patch is breaking the build for me. I have :
CONFIG_DRM_I915_GVT=y
CONFIG_DRM_I915_GVT_KVMGT=m

---------------------------------------------------------------
In file included from ./include/linux/init.h:5,
                 from drivers/gpu/drm/i915/gvt/kvmgt.c:31:
drivers/gpu/drm/i915/i915_drv.h: In function ?__sg_next?:
drivers/gpu/drm/i915/i915_drv.h:2249:11: error: ?struct scatterlist? has no member named ?sg_magic?
  BUG_ON(sg->sg_magic != SG_MAGIC);
           ^~
./include/linux/compiler.h:77:42: note: in definition of macro ?unlikely?
 # define unlikely(x) __builtin_expect(!!(x), 0)
                                          ^
drivers/gpu/drm/i915/i915_drv.h:2249:2: note: in expansion of macro ?BUG_ON?
  BUG_ON(sg->sg_magic != SG_MAGIC);
  ^~~~~~
make[4]: *** [scripts/Makefile.build:324: drivers/gpu/drm/i915/gvt/kvmgt.o] Error 1
make[3]: *** [scripts/Makefile.build:558: drivers/gpu/drm/i915] Error 2
make[2]: *** [scripts/Makefile.build:558: drivers/gpu/drm] Error 2
make[1]: *** [scripts/Makefile.build:558: drivers/gpu] Error 2
make[1]: *** Waiting for unfinished jobs....
---------------------------------------------------------------

Jordan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-25 11:13       ` Jordan Glover
@ 2018-06-25 13:52         ` Jens Axboe
  2018-06-25 15:01           ` Jordan Glover
  2018-06-29  9:16           ` hch
  0 siblings, 2 replies; 10+ messages in thread
From: Jens Axboe @ 2018-06-25 13:52 UTC (permalink / raw)


On 6/25/18 5:13 AM, Jordan Glover wrote:
> Above patch is breaking the build for me. I have :
> CONFIG_DRM_I915_GVT=y
> CONFIG_DRM_I915_GVT_KVMGT=m

Try this one, actually did a grep for users of it too...

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7014a96546f4..52f3b91d14fd 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2245,9 +2245,6 @@ static inline struct scatterlist *____sg_next(struct scatterlist *sg)
  **/
 static inline struct scatterlist *__sg_next(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	return sg_is_last(sg) ? NULL : ____sg_next(sg);
 }
 
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 51f52020ad5f..093aa57120b0 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -9,9 +9,6 @@
 #include <asm/io.h>
 
 struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
-	unsigned long	sg_magic;
-#endif
 	unsigned long	page_link;
 	unsigned int	offset;
 	unsigned int	length;
@@ -64,7 +61,6 @@ struct sg_table {
  *
  */
 
-#define SG_MAGIC	0x87654321
 #define SG_CHAIN	0x01UL
 #define SG_END		0x02UL
 
@@ -98,7 +94,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
 	 */
 	BUG_ON((unsigned long) page & (SG_CHAIN | SG_END));
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	sg->page_link = page_link | (unsigned long) page;
@@ -129,7 +124,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
 static inline struct page *sg_page(struct scatterlist *sg)
 {
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END));
@@ -195,9 +189,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
  **/
 static inline void sg_mark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	/*
 	 * Set termination bit, clear potential chain bit
 	 */
@@ -215,9 +206,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
  **/
 static inline void sg_unmark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	sg->page_link &= ~SG_END;
 }
 
@@ -260,12 +248,6 @@ static inline void *sg_virt(struct scatterlist *sg)
 static inline void sg_init_marker(struct scatterlist *sgl,
 				  unsigned int nents)
 {
-#ifdef CONFIG_DEBUG_SG
-	unsigned int i;
-
-	for (i = 0; i < nents; i++)
-		sgl[i].sg_magic = SG_MAGIC;
-#endif
 	sg_mark_end(&sgl[nents - 1]);
 }
 
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 1642fd507a96..7c6096a71704 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -24,9 +24,6 @@
  **/
 struct scatterlist *sg_next(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	if (sg_is_last(sg))
 		return NULL;
 
@@ -111,10 +108,7 @@ struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
 	for_each_sg(sgl, sg, nents, i)
 		ret = sg;
 
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sgl[0].sg_magic != SG_MAGIC);
 	BUG_ON(!sg_is_last(ret));
-#endif
 	return ret;
 }
 EXPORT_SYMBOL(sg_last);
diff --git a/tools/virtio/linux/scatterlist.h b/tools/virtio/linux/scatterlist.h
index 9a45f90e2d08..369ee308b668 100644
--- a/tools/virtio/linux/scatterlist.h
+++ b/tools/virtio/linux/scatterlist.h
@@ -36,7 +36,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
 	 */
 	BUG_ON((unsigned long) page & 0x03);
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	sg->page_link = page_link | (unsigned long) page;
@@ -67,7 +66,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
 static inline struct page *sg_page(struct scatterlist *sg)
 {
 #ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
 	BUG_ON(sg_is_chain(sg));
 #endif
 	return (struct page *)((sg)->page_link & ~0x3);
@@ -116,9 +114,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
  **/
 static inline void sg_mark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	/*
 	 * Set termination bit, clear potential chain bit
 	 */
@@ -136,17 +131,11 @@ static inline void sg_mark_end(struct scatterlist *sg)
  **/
 static inline void sg_unmark_end(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	sg->page_link &= ~0x02;
 }
 
 static inline struct scatterlist *sg_next(struct scatterlist *sg)
 {
-#ifdef CONFIG_DEBUG_SG
-	BUG_ON(sg->sg_magic != SG_MAGIC);
-#endif
 	if (sg_is_last(sg))
 		return NULL;
 
@@ -160,13 +149,6 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg)
 static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
 {
 	memset(sgl, 0, sizeof(*sgl) * nents);
-#ifdef CONFIG_DEBUG_SG
-	{
-		unsigned int i;
-		for (i = 0; i < nents; i++)
-			sgl[i].sg_magic = SG_MAGIC;
-	}
-#endif
 	sg_mark_end(&sgl[nents - 1]);
 }
 

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-25 13:52         ` Jens Axboe
@ 2018-06-25 15:01           ` Jordan Glover
  2018-06-29  9:16           ` hch
  1 sibling, 0 replies; 10+ messages in thread
From: Jordan Glover @ 2018-06-25 15:01 UTC (permalink / raw)


On June 25, 2018 3:52 PM, Jens Axboe <axboe@kernel.dk> wrote:

> On 6/25/18 5:13 AM, Jordan Glover wrote:
> 
> > Above patch is breaking the build for me. I have :
> > 
> > CONFIG_DRM_I915_GVT=y
> > 
> > CONFIG_DRM_I915_GVT_KVMGT=m
> 
> Try this one, actually did a grep for users of it too...
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> 
> index 7014a96546f4..52f3b91d14fd 100644
> 
> --- a/drivers/gpu/drm/i915/i915_drv.h
> 
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> 
> @@ -2245,9 +2245,6 @@ static inline struct scatterlist *____sg_next(struct scatterlist *sg)
> 
> **/
> 
> static inline struct scatterlist *__sg_next(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> return sg_is_last(sg) ? NULL : ____sg_next(sg);
> 
> }
> 
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> 
> index 51f52020ad5f..093aa57120b0 100644
> 
> --- a/include/linux/scatterlist.h
> 
> +++ b/include/linux/scatterlist.h
> 
> @@ -9,9 +9,6 @@
> 
> #include <asm/io.h>
> 
> struct scatterlist {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   unsigned long sg_magic;
>     
>     -#endif
>     
>     unsigned long page_link;
>     
>     unsigned int offset;
>     
>     unsigned int length;
>     
>     @@ -64,7 +61,6 @@ struct sg_table {
>     
> 
> -   
> 
> */
> 
> -#define SG_MAGIC 0x87654321
> 
> #define SG_CHAIN 0x01UL
> 
> #define SG_END 0x02UL
> 
> @@ -98,7 +94,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
> 
> */
> 
> BUG_ON((unsigned long) page & (SG_CHAIN | SG_END));
> 
> #ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     sg->page_link = page_link | (unsigned long) page;
>     
> 
> @@ -129,7 +124,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
> 
> static inline struct page *sg_page(struct scatterlist *sg)
> 
> {
> 
> #ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END));
>     
> 
> @@ -195,9 +189,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
> 
> **/
> 
> static inline void sg_mark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> /*
> 
> * Set termination bit, clear potential chain bit
> 
> */
> 
> @@ -215,9 +206,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
> 
> **/
> 
> static inline void sg_unmark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> sg->page_link &= ~SG_END;
> 
> }
> 
> @@ -260,12 +248,6 @@ static inline void *sg_virt(struct scatterlist *sg)
> 
> static inline void sg_init_marker(struct scatterlist *sgl,
> 
> unsigned int nents)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   unsigned int i;
> -   
> -   for (i = 0; i < nents; i++)
> -         sgl[i].sg_magic = SG_MAGIC;
>         
>     
> 
> -#endif
> 
> sg_mark_end(&sgl[nents - 1]);
> 
> }
> 
> diff --git a/lib/scatterlist.c b/lib/scatterlist.c
> 
> index 1642fd507a96..7c6096a71704 100644
> 
> --- a/lib/scatterlist.c
> 
> +++ b/lib/scatterlist.c
> 
> @@ -24,9 +24,6 @@
> 
> **/
> 
> struct scatterlist *sg_next(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> if (sg_is_last(sg))
> 
> return NULL;
> 
> @@ -111,10 +108,7 @@ struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
> 
> for_each_sg(sgl, sg, nents, i)
> 
> ret = sg;
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sgl[0].sg_magic != SG_MAGIC);
>     
>     BUG_ON(!sg_is_last(ret));
>     
>     -#endif
>     
>     return ret;
>     
>     }
>     
>     EXPORT_SYMBOL(sg_last);
>     
>     diff --git a/tools/virtio/linux/scatterlist.h b/tools/virtio/linux/scatterlist.h
>     
>     index 9a45f90e2d08..369ee308b668 100644
>     
>     --- a/tools/virtio/linux/scatterlist.h
>     
>     +++ b/tools/virtio/linux/scatterlist.h
>     
>     @@ -36,7 +36,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
>     
>     */
>     
>     BUG_ON((unsigned long) page & 0x03);
>     
>     #ifdef CONFIG_DEBUG_SG
>     
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     sg->page_link = page_link | (unsigned long) page;
>     
> 
> @@ -67,7 +66,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
> 
> static inline struct page *sg_page(struct scatterlist *sg)
> 
> {
> 
> #ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
>     
>     BUG_ON(sg_is_chain(sg));
>     
>     #endif
>     
>     return (struct page *)((sg)->page_link & ~0x3);
>     
> 
> @@ -116,9 +114,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
> 
> **/
> 
> static inline void sg_mark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> /*
> 
> * Set termination bit, clear potential chain bit
> 
> */
> 
> @@ -136,17 +131,11 @@ static inline void sg_mark_end(struct scatterlist *sg)
> 
> **/
> 
> static inline void sg_unmark_end(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> sg->page_link &= ~0x02;
> 
> }
> 
> static inline struct scatterlist *sg_next(struct scatterlist *sg)
> 
> {
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   BUG_ON(sg->sg_magic != SG_MAGIC);
> 
> -#endif
> 
> if (sg_is_last(sg))
> 
> return NULL;
> 
> @@ -160,13 +149,6 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg)
> 
> static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
> 
> {
> 
> memset(sgl, 0, sizeof(*sgl) * nents);
> 
> -#ifdef CONFIG_DEBUG_SG
> 
> -   {
> -         unsigned int i;
>         
>     
> -         for (i = 0; i < nents; i++)
>         
>     
> -         	sgl[i].sg_magic = SG_MAGIC;
>         
>     
> -   }
>     
>     -#endif
>     
>     sg_mark_end(&sgl[nents - 1]);
>     
>     }
>     
>     --
>     
>     Jens Axboe
>

This one works and there is no warning on boot anymore. Thank you.

Jordan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-25 13:52         ` Jens Axboe
  2018-06-25 15:01           ` Jordan Glover
@ 2018-06-29  9:16           ` hch
  2018-06-29 13:54             ` Jens Axboe
  1 sibling, 1 reply; 10+ messages in thread
From: hch @ 2018-06-29  9:16 UTC (permalink / raw)


>  static inline struct scatterlist *__sg_next(struct scatterlist *sg)
>  {
> -#ifdef CONFIG_DEBUG_SG
> -	BUG_ON(sg->sg_magic != SG_MAGIC);
> -#endif
>  	return sg_is_last(sg) ? NULL : ____sg_next(sg);
>  }

All that sg mess in i915 really needs to switch to using the generic
helpers instead of being opencoded..

But except for that the sg_magic removal looks good to me:

Acked-by: Christoph Hellwig <hch at lst.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-29  9:16           ` hch
@ 2018-06-29 13:54             ` Jens Axboe
  2018-06-29 14:52               ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2018-06-29 13:54 UTC (permalink / raw)


On 6/29/18 3:16 AM, hch@lst.de wrote:
>>  static inline struct scatterlist *__sg_next(struct scatterlist *sg)
>>  {
>> -#ifdef CONFIG_DEBUG_SG
>> -	BUG_ON(sg->sg_magic != SG_MAGIC);
>> -#endif
>>  	return sg_is_last(sg) ? NULL : ____sg_next(sg);
>>  }
> 
> All that sg mess in i915 really needs to switch to using the generic
> helpers instead of being opencoded..

Totally agreed...

> But except for that the sg_magic removal looks good to me:
> 
> Acked-by: Christoph Hellwig <hch at lst.de>

Thanks, though I wonder if we can sneak this into 4.18. I'd rather
avoid having to shrink nvme segment count further, if at all possible.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440
  2018-06-29 13:54             ` Jens Axboe
@ 2018-06-29 14:52               ` Jens Axboe
  0 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2018-06-29 14:52 UTC (permalink / raw)


On 6/29/18 7:54 AM, Jens Axboe wrote:
> On 6/29/18 3:16 AM, hch@lst.de wrote:
>>>  static inline struct scatterlist *__sg_next(struct scatterlist *sg)
>>>  {
>>> -#ifdef CONFIG_DEBUG_SG
>>> -	BUG_ON(sg->sg_magic != SG_MAGIC);
>>> -#endif
>>>  	return sg_is_last(sg) ? NULL : ____sg_next(sg);
>>>  }
>>
>> All that sg mess in i915 really needs to switch to using the generic
>> helpers instead of being opencoded..
> 
> Totally agreed...
> 
>> But except for that the sg_magic removal looks good to me:
>>
>> Acked-by: Christoph Hellwig <hch at lst.de>
> 
> Thanks, though I wonder if we can sneak this into 4.18. I'd rather
> avoid having to shrink nvme segment count further, if at all possible.

Decided I'll see what the boss man says, it's small enough that it
should be doable... Queued up for 4.18.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-29 14:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-24 20:37 [4.18-rc2 regression] WARNING: CPU: 0 PID: 1 at drivers/nvme/host/pci.c:2570 nvme_probe+0x212/0x440 Jordan Glover
2018-06-24 21:15 ` Scott Bauer
2018-06-24 22:06   ` Jordan Glover
2018-06-25  3:13     ` Jens Axboe
2018-06-25 11:13       ` Jordan Glover
2018-06-25 13:52         ` Jens Axboe
2018-06-25 15:01           ` Jordan Glover
2018-06-29  9:16           ` hch
2018-06-29 13:54             ` Jens Axboe
2018-06-29 14:52               ` Jens Axboe

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.