From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E65DDCCA480 for ; Thu, 23 Jun 2022 19:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbiFWTdO (ORCPT ); Thu, 23 Jun 2022 15:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbiFWTcx (ORCPT ); Thu, 23 Jun 2022 15:32:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042E05DF01; Thu, 23 Jun 2022 12:12:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FE1660DE1; Thu, 23 Jun 2022 19:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB333C341C0; Thu, 23 Jun 2022 19:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656011520; bh=2vFS5ecHYj7lFUc7JnMpmVqJneVrPDUFMqR3YyGroMQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dglapzEvUizu4TJLaOScyRQb674dhVNYAwjiELs76w3pGcYX8SsrULa3MSpyJZWjK oG5vwu/O8N4r5pTVvFrdw4knikfA3RoLKzIDn1FHYLSz9F22Me7u9O2Y7m5fzr/gta 4rYtJZDLSInC7tRUjsJKjTbGZJzNLZWdVg37zh0RJ7k2lbJb9vtYdlGPid0w2d3meJ UATjOKK5xij1Oii0yIF8aNW8gBkiP6H7rI+xVIyfTjTxrFXGiH94XcXAXmGVUzrMwO ruCxSPhOTaKCFakDxlc9AN8MexKuBY+8GzRYiA5qBYzRhy6/e4vNdzaAYmeXW4JwwL vXFky3n51iGVg== Date: Thu, 23 Jun 2022 13:11:57 -0600 From: Keith Busch To: Eric Farman Cc: Keith Busch , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Christian Borntraeger , axboe@kernel.dk, Kernel Team , hch@lst.de, bvanassche@acm.org, damien.lemoal@opensource.wdc.com, ebiggers@kernel.org, pankydev8@gmail.com Subject: Re: [PATCHv6 11/11] iomap: add support for dma aligned direct-io Message-ID: References: <20220610195830.3574005-1-kbusch@fb.com> <20220610195830.3574005-12-kbusch@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Thu, Jun 23, 2022 at 12:51:08PM -0600, Keith Busch wrote: > On Thu, Jun 23, 2022 at 02:29:13PM -0400, Eric Farman wrote: > > On Fri, 2022-06-10 at 12:58 -0700, Keith Busch wrote: > > > From: Keith Busch > > > > > > Use the address alignment requirements from the block_device for > > > direct > > > io instead of requiring addresses be aligned to the block size. > > > > Hi Keith, > > > > Our s390 PV guests recently started failing to boot from a -next host, > > and git blame brought me here. > > > > As near as I have been able to tell, we start tripping up on this code > > from patch 9 [1] that gets invoked with this patch: > > > > > for (k = 0; k < i->nr_segs; k++, skip = 0) { > > > size_t len = i->iov[k].iov_len - skip; > > > > > > if (len > size) > > > len = size; > > > if (len & len_mask) > > > return false; > > > > The iovec we're failing on has two segments, one with a len of x200 > > (and base of x...000) and another with a len of xe00 (and a base of > > x...200), while len_mask is of course xfff. > > > > So before I go any further on what we might have broken, do you happen > > to have any suggestions what might be going on here, or something I > > should try? > > Thanks for the notice, sorry for the trouble. This check wasn't intended to > have any difference from the previous code with respect to the vector lengths. > > Could you tell me if you're accessing this through the block device direct-io, > or through iomap filesystem? If using iomap, the previous check was this: unsigned int blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev)); unsigned int align = iov_iter_alignment(dio->submit.iter); ... if ((pos | length | align) & ((1 << blkbits) - 1)) return -EINVAL; And if raw block device, it was this: if ((pos | iov_iter_alignment(iter)) & (bdev_logical_block_size(bdev) - 1)) return -EINVAL; The result of "iov_iter_alignment()" would include "0xe00 | 0x200" in your example, and checked against 0xfff should have been failing prior to this patch. Unless I'm missing something...