Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4722327pxv; Tue, 6 Jul 2021 07:41:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzikITVilc/BX0EcSSWfu7nyA8abM3q3R+8UHpnHpRy6g/ebGWEDXhAx4h1t4KdGxxFoDkK X-Received: by 2002:aa7:c607:: with SMTP id h7mr23426174edq.13.1625582465690; Tue, 06 Jul 2021 07:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625582465; cv=none; d=google.com; s=arc-20160816; b=MGQ/Gu6Pm2I3EMd80ibuTO+zE+VYxhaoEukgjt/MFn8Uv5qeuHqOi4vpcP48c8hNYi KJrwFnIt7KCxq/I8zAbIwxj4aAN2j0Gx5h52y8qCCMyiXPDqyLhdiiM2M4mmFS0F8L0G sFpfOZexeKxkxwePSQrRIO7C+KexB9yJ/Tm0dSbvVJ7DlnqsrYe6Ex0JDp+gVEOMK6Q3 bhuuUcxoaOAhRCW0TvPU60e5ujWn07hjfZ1prKMD1nb1MxVJGK1HrQ0kCGByEAjaxs0T w1sybgfWHEvO68UeMxp3JXdLKhH7CTxaxLTpb9hU5EzqFikEHBsK1r6y9fc8p6EG6P7y ohEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kjfZ7HpxdW+wGOjXZEB297oap6EMIrhIvKRroW1CzGQ=; b=x2qqsbh1oNOptfS2/rie0PvTWltBKMirK5slH4ch4ZtbGm0zya4NO0cmfKmU3mReWl 87DvwX3Y3YHCX7UclgrwF3SBQT8GsG9UNK/IuMMAO+hGtQr8+BDYqY6QuhQ5DpZGz9He sjSPOPLLrfKnXj0Belun3ilOLCgkqN0WQC7zmyLXZcysql/90pOB6paseQ9qvQSNMANP WmQwZVgByu00/jaBf2VcWEcWFg7Zo8+rndHjpoz5eswIdxaExSH5HLDdbYz9c+++ctU7 lbz7paBZzAWf2WwdpunVz2ao396e5IpmA8JesqweMQ3y4g7wP2yMsQPpfOHyp18QtrzD eilA== ARC-Authentication-Results: i=1; mx.google.com; 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 hs14si3460651ejc.515.2021.07.06.07.40.42; Tue, 06 Jul 2021 07:41:05 -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; 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 S232461AbhGFOja (ORCPT + 99 others); Tue, 6 Jul 2021 10:39:30 -0400 Received: from verein.lst.de ([213.95.11.211]:33815 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbhGFOj3 (ORCPT ); Tue, 6 Jul 2021 10:39:29 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id F2B0668BFE; Tue, 6 Jul 2021 16:36:47 +0200 (CEST) Date: Tue, 6 Jul 2021 16:36:47 +0200 From: Christoph Hellwig To: Linus Torvalds Cc: Christoph Hellwig , kernel test robot , Jens Axboe , LKML , lkp@lists.01.org, kernel test robot , "H. Peter Anvin" , Borislav Petkov Subject: Re: [ide] b7fb14d3ac: EIP:ioread32_rep Message-ID: <20210706143647.GA28289@lst.de> References: <20210704150025.GC21572@xsang-OptiPlex-9020> <20210705125756.GA25141@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 05, 2021 at 01:00:09PM -0700, Linus Torvalds wrote: > It might perhaps be worth adding some kind of > > WARN_ON_ONCE(offset & 511); > > in the callchain somewhere for that ata_queued_cmd(). But at that > point I no longer know the code. Yeah, there's usually a huge offset into the page. The otherwise similar ATAPI code actually has checks to chunk it up and not cross page boundaries, and copying that over fixes the problem. The testbot config then crashes in an infiband driver, but disabling that driver entirely makes it boot fine: diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index ae7189d1a568..018f021c45a3 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -651,7 +651,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); struct ata_port *ap = qc->ap; struct page *page; - unsigned int offset; + unsigned int offset, count; unsigned char *buf; if (!qc->cursg) { @@ -670,16 +670,22 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); + /* don't overrun current sg */ + count = min(qc->cursg->length - qc->cursg_ofs, qc->sect_size); + + /* don't cross page boundaries */ + count = min(count, (unsigned int)PAGE_SIZE - offset); + /* do the actual data transfer */ buf = kmap_atomic(page); - ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, do_write); + ap->ops->sff_data_xfer(qc, buf + offset, count, do_write); kunmap_atomic(buf); if (!do_write && !PageSlab(page)) flush_dcache_page(page); - qc->curbytes += qc->sect_size; - qc->cursg_ofs += qc->sect_size; + qc->curbytes += count; + qc->cursg_ofs += count; if (qc->cursg_ofs == qc->cursg->length) { qc->cursg = sg_next(qc->cursg);