Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp321722imm; Fri, 21 Sep 2018 00:25:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYnevBC0XrJUdlX2+oa29k2iYz9oj65rrJsG5MVb8CSWM3+hqssvHT4XhP0iTRp547fo2wu X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr42754051pli.207.1537514751693; Fri, 21 Sep 2018 00:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537514751; cv=none; d=google.com; s=arc-20160816; b=X1WDSBvOcyUaW1aJl8VsezNutcTlmZ6Xg5EaQkVyRPJezNN3tyCrH+BMlGFlb9esw/ jvVFG8c2Sb1hW8h/b+FrmQK1fvdvd0D2E2yxrB+67uvT9F7qcUNyC870ganmLB+EFigA j8pkBMePd4kEezAb0UCVqnHllCk2hhPINV3oU2dg+Buz7JwvGNBcviziwKhT/M/pSDKo zXQiZLnphyAytOUhEidzC7q5E52sFxukzNrLgNwu0GnnA6+Tp0JTK5oTjMFeP/LZrL75 gAQg0WV4IZIu35NvTlSICLIVDy3aZoOicIWLtPDZ3g8aS+pPT+nKWhtj3sdFfae9bwnP Fz2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pDq/REP17GEqID1wdY7ZKWnF3mO0vWuru4IDrvNzrFg=; b=O1iRkYfLmlBvAJ5kZW5q577bJ/Qzdny064mwwa9DMUdF9UgxEipOcLab0ndOItb3Do ZBTwuRKKeF6QVjxwkYTzC0CuXE1taXK0A7DfIwTDfG36minbsR8hABGwZIghHbEvMn3n 1jUOu7Tuu9U8Q6w10oGH4mNiF0VWWO/3M+8QiBYLmHm9Lh3sWRXOpROZo6JGe2pERlqe 478VkBo7jsg6oYctSEgDt4nGU7euNh3lVBIZGU6WO8Rft2RsOO3n6VzguXHbsx0pbDBr MXW1TqZDQhu/iBFz94HqXX8swNz+HFOBYy6r1WHfpShLKxJmHTaOuVShFJgKJ8bkZ0ZC CoDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k91-v6si26927351pld.187.2018.09.21.00.25.33; Fri, 21 Sep 2018 00:25:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389369AbeIUNNC (ORCPT + 99 others); Fri, 21 Sep 2018 09:13:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41754 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725898AbeIUNNC (ORCPT ); Fri, 21 Sep 2018 09:13:02 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6788D3082A2C; Fri, 21 Sep 2018 07:25:28 +0000 (UTC) Received: from ming.t460p (ovpn-8-30.pek2.redhat.com [10.72.8.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 519B32015C02; Fri, 21 Sep 2018 07:25:17 +0000 (UTC) Date: Fri, 21 Sep 2018 15:25:13 +0800 From: Ming Lei To: Christoph Hellwig Cc: Dave Chinner , Ming Lei , linux-block , linux-mm , Linux FS Devel , "open list:XFS FILESYSTEM" , Dave Chinner , Vitaly Kuznetsov , Linux Kernel Mailing List , Jens Axboe Subject: Re: block: DMA alignment of IO buffer allocated from slab Message-ID: <20180921072511.GA8188@ming.t460p> References: <20180921015608.GA31060@dastard> <20180921070805.GC14529@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180921070805.GC14529@lst.de> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 21 Sep 2018 07:25:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 21, 2018 at 09:08:05AM +0200, Christoph Hellwig wrote: > On Fri, Sep 21, 2018 at 11:56:08AM +1000, Dave Chinner wrote: > > > 3) If slab can't guarantee to return 512-aligned buffer, how to fix > > > this data corruption issue? > > > > I think that the block layer needs to check the alignment of memory > > buffers passed to it and take appropriate action rather than > > corrupting random memory and returning a sucess status to the bad > > bio. > > Or just reject the I/O. But yes, we already have the > queue_dma_alignment helper in the block layer, we just don't do it > in the fast path. I think generic_make_request_checks needs to > check it, and print an error and return a warning if the alignment > requirement isn't met. That can be done in generic_make_request_checks(), but some cost may be introduced, because each bvec needs to be checked in the fast path. Thanks, Ming