Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp5807ybt; Tue, 23 Jun 2020 13:48:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrvB3uqbJLAsRPvvLhjrUTdcDVpr1eMBdx7t/Nio6yfYiG5Lb6l2KZf14C0yHx0sUaP5eL X-Received: by 2002:a17:906:abca:: with SMTP id kq10mr21347014ejb.242.1592945297144; Tue, 23 Jun 2020 13:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945297; cv=none; d=google.com; s=arc-20160816; b=CFlrla4yuqRLFao8tBfapWq9K7I8vPEZdWcAesTTu8dizkzxdoTDZHa8/JiN9htBXB TInUSK5j9EdGZAjCNgS4Cb+ljHLAsx3O6U9TrLPwwi1jtxq+v4IIfyEkZ3BfFHgFo6Q0 8KxPPte/nrao1Bq/YVoEReOTLpFqZr+U5dpyWHJ2YHCdswijBwqHoe1Q50E4N7bZifXy r+rzJNqgkDMNdIfsslZm5uqQBhqihfiW4aZy+d5p03zsFzRDeUeLYQGLYuwxqMCRxROM bCOZQ3Pxoh4GOesW6EgWR1Q4TBYvYXL6qFojuED7JpmTKe87WPmxBmE3OTnEZP/EbP33 WHvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mgbQ2oRF9tpzBtUUinFo/1gsnRnaEUwzkLKTuqw9gVU=; b=oSkqYrWZv2zln5K5yWowvthfqPSy257OpuE0Frve9i6aKEBjXJzDu/OiqhvFJI75un lswr+CNQPke9wwRruhItuGTMfeDDoncvcLBdb2pMx+ML7Fus6zTwSWQWRbh2tOD1KKLO AtqnVuU2hOfeRV9BaTuz8aaoJOWWjx0zQA8uolClA9rqBNtnBuxCjyKuOJcF25b//Zhf PSK00HiEn6c7aGcBt88jEkY6JgijVicQq6bAWZFxxKqP9Agrmt7c8Vfk2ODm/5YaPdIw tvnxfDg5UwA8kGySWsOPkOz6Pk11LLsdgWN4L1wuAULKIywUpfCMe9CKrMG6KUEH5NSJ wuvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hgLX4Dq2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si6256403ejy.58.2020.06.23.13.47.53; Tue, 23 Jun 2020 13:48:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hgLX4Dq2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391061AbgFWUoW (ORCPT + 99 others); Tue, 23 Jun 2020 16:44:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:41332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391966AbgFWUoO (ORCPT ); Tue, 23 Jun 2020 16:44:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5CC5521BE5; Tue, 23 Jun 2020 20:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945055; bh=VTgECtsmnew3I+DG8yH1+oCtTQklwgoqBZ4yrtOuAGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgLX4Dq2KSFTm+TNq09h/Zj/Tx2fGxeAGaCKl71BpdCetNX/+ScYYXF6JAb+nHvST 5m3vFKnszePIuiFe8oep6Yw1eVd6cjQnkKAL3hXt04LTBcxd0im4HCWMiZzmF2RAtH uUGYZVT3r9qe8I5J6yzHtH3l8RdpkYcCgcIAWbQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Nicolet , Geoff Levand , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 021/136] ps3disk: use the default segment boundary Date: Tue, 23 Jun 2020 21:57:57 +0200 Message-Id: <20200623195304.697752787@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Emmanuel Nicolet [ Upstream commit 720bc316690bd27dea9d71510b50f0cd698ffc32 ] Since commit dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count"), the kernel will bug_on on the PS3 because bio_split() is called with sectors == 0: kernel BUG at block/bio.c:1853! Oops: Exception in kernel mode, sig: 5 [#1] BE PAGE_SIZE=4K MMU=Hash PREEMPT SMP NR_CPUS=8 NUMA PS3 Modules linked in: firewire_sbp2 rtc_ps3(+) soundcore ps3_gelic(+) \ ps3rom(+) firewire_core ps3vram(+) usb_common crc_itu_t CPU: 0 PID: 97 Comm: blkid Not tainted 5.3.0-rc4 #1 NIP: c00000000027d0d0 LR: c00000000027d0b0 CTR: 0000000000000000 REGS: c00000000135ae90 TRAP: 0700 Not tainted (5.3.0-rc4) MSR: 8000000000028032 CR: 44008240 XER: 20000000 IRQMASK: 0 GPR00: c000000000289368 c00000000135b120 c00000000084a500 c000000004ff8300 GPR04: 0000000000000c00 c000000004c905e0 c000000004c905e0 000000000000ffff GPR08: 0000000000000000 0000000000000001 0000000000000000 000000000000ffff GPR12: 0000000000000000 c0000000008ef000 000000000000003e 0000000000080001 GPR16: 0000000000000100 000000000000ffff 0000000000000000 0000000000000004 GPR20: c00000000062fd7e 0000000000000001 000000000000ffff 0000000000000080 GPR24: c000000000781788 c00000000135b350 0000000000000080 c000000004c905e0 GPR28: c00000000135b348 c000000004ff8300 0000000000000000 c000000004c90000 NIP [c00000000027d0d0] .bio_split+0x28/0xac LR [c00000000027d0b0] .bio_split+0x8/0xac Call Trace: [c00000000135b120] [c00000000027d130] .bio_split+0x88/0xac (unreliable) [c00000000135b1b0] [c000000000289368] .__blk_queue_split+0x11c/0x53c [c00000000135b2d0] [c00000000028f614] .blk_mq_make_request+0x80/0x7d4 [c00000000135b3d0] [c000000000283a8c] .generic_make_request+0x118/0x294 [c00000000135b4b0] [c000000000283d34] .submit_bio+0x12c/0x174 [c00000000135b580] [c000000000205a44] .mpage_bio_submit+0x3c/0x4c [c00000000135b600] [c000000000206184] .mpage_readpages+0xa4/0x184 [c00000000135b750] [c0000000001ff8fc] .blkdev_readpages+0x24/0x38 [c00000000135b7c0] [c0000000001589f0] .read_pages+0x6c/0x1a8 [c00000000135b8b0] [c000000000158c74] .__do_page_cache_readahead+0x118/0x184 [c00000000135b9b0] [c0000000001591a8] .force_page_cache_readahead+0xe4/0xe8 [c00000000135ba50] [c00000000014fc24] .generic_file_read_iter+0x1d8/0x830 [c00000000135bb50] [c0000000001ffadc] .blkdev_read_iter+0x40/0x5c [c00000000135bbc0] [c0000000001b9e00] .new_sync_read+0x144/0x1a0 [c00000000135bcd0] [c0000000001bc454] .vfs_read+0xa0/0x124 [c00000000135bd70] [c0000000001bc7a4] .ksys_read+0x70/0xd8 [c00000000135be20] [c00000000000a524] system_call+0x5c/0x70 Instruction dump: 7fe3fb78 482e30dc 7c0802a6 482e3085 7c9e2378 f821ff71 7ca42b78 7d3e00d0 7c7d1b78 79290fe0 7cc53378 69290001 <0b090000> 81230028 7bca0020 7929ba62 [ end trace 313fec760f30aa1f ]--- The problem originates from setting the segment boundary of the request queue to -1UL. This makes get_max_segment_size() return zero when offset is zero, whatever the max segment size. The test with BLK_SEG_BOUNDARY_MASK fails and 'mask - (mask & offset) + 1' overflows to zero in the return statement. Not setting the segment boundary and using the default value (BLK_SEG_BOUNDARY_MASK) fixes the problem. Signed-off-by: Emmanuel Nicolet Signed-off-by: Geoff Levand Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/060a416c43138f45105c0540eff1a45539f7e2fc.1589049250.git.geoff@infradead.org Signed-off-by: Sasha Levin --- drivers/block/ps3disk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 075662f2cf466..d20f66d578040 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c @@ -468,7 +468,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH); blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); - blk_queue_segment_boundary(queue, -1UL); blk_queue_dma_alignment(queue, dev->blk_size-1); blk_queue_logical_block_size(queue, dev->blk_size); -- 2.25.1