[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Fix hppa kernel crash at boot in block/blk-merge.c



Since kernel 4.3 we have a problem on hppa that it crashes at bootup
during the SCSI drive detection.
There are multiple threads about this issue and this link is maybe a good start:
https://patchwork.kernel.org/patch/8402441/.

Now, after quite some time, we could identify what's going wrong.
The attached patch avoids this crash by switching to compiling with
"-O1" instead of "-O2" for a function in block/blk-merge.c (for hppa only).

This patch is meant to be a temporary patch for the debian kernel, until we 
have been able to fix the real problem (in gcc and/or kernel code).

Would it be possible to add this patch to the debian kernel tree for
stable and experimental kernels in the meantime, so that we get bootable
kernels on hppa again?

Thanks,
Helge

diff -up ./block/blk-merge.c.org ./block/blk-merge.c
--- ./block/blk-merge.c.org	2016-03-10 09:44:33.171141161 +0100
+++ ./block/blk-merge.c	2016-03-10 09:47:33.391119064 +0100
@@ -80,7 +80,15 @@ static inline unsigned get_max_io_size(s
 	return sectors;
 }
 
-static struct bio *blk_bio_segment_split(struct request_queue *q,
+static struct bio *
+#ifdef __hppa__
+	/* 
+	 * gcc-4.9 miscompiles this function at O2, leading to a kernel crash at bootup.
+	 * So, let's temporarily compile this function with O1 until the bug is fully analyzed and fixed.
+	 */
+	__attribute__ ((optimize("O1")))
+#endif
+blk_bio_segment_split(struct request_queue *q,
 					 struct bio *bio,
 					 struct bio_set *bs,
 					 unsigned *segs)


Reply to: