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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 261C4ECE562 for ; Fri, 21 Sep 2018 07:25:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8893206B5 for ; Fri, 21 Sep 2018 07:25:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8893206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389378AbeIUNNC (ORCPT ); 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