Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp309550imm; Fri, 21 Sep 2018 00:10:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFW09eGy+zqb0zzphBukGXZjhw+Ag0Nm2DgYA9pKfRwIjq8EFyJi7G7sOfc9V9JbGKpsut X-Received: by 2002:a17:902:c85:: with SMTP id 5-v6mr43074683plt.141.1537513805455; Fri, 21 Sep 2018 00:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537513805; cv=none; d=google.com; s=arc-20160816; b=X+zLIKhXSnJ07LpcPTty5tCt2dxsq3OsBshKEDgjhPbyON+EDSlVtC3+f+x4Ml+VZo W8dQ+dM/D5QiBI4ot7iKs4PtWJeOicpd6KEzt105cNIiCy27Zm1w7wlwzmbCGexbK4gJ LgOWEfGdkRrYjyDD7Ia4xMornmE72ptxodUlHksR/xEn4pQ/bQzF0rgV4W8yzQc7TJWq wyiJBiy2J76EdYXFdVMpzjiZG135ct6dwwcm4NskwncBqwan0E1MWxhju3KrKOu3t5G3 Ds6ZCBXAnARWF8yJC3Kb2ItI3BOrlGU/erj0DTnRwyztgQm94AmH/M8rQj53IWBn3G+p IoIg== 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=sToI/TUPWNHoFWru47t5zUH4KrOgKgDKcJElusTY9RY=; b=LnufueD9XP93Tb/4Vlhi90pzk8VSQGDRIugoMIMb93s5X+fIWfJcTDLwPtgzOG2VHH wCod9Ov8MGl//5csucaHoopQYD9EZFdqXortoCfATnlo+CBG4FcYJD7v55jCDrEmCJBH U54ifEbIHjQULsfftbdBWvgml3ljJ80OwLuQ/HKbVxlXyNKvuIpPunBuhBNes6tf9Fvv 2sRJjCl1gnGGD+jLswvUxIcqgDhP6melL82uaHCc/7MMkHao6OdRfGRKBexQcSmio136 xi7Nk4KLWvNXCbWfmHWLvySJzr7X2UYpKJCejPXGvo40YGMRuVahyRHEAwaS8rTYHIQW pHAg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x28-v6si1194537pgc.460.2018.09.21.00.09.49; Fri, 21 Sep 2018 00:10:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389231AbeIUMzg (ORCPT + 99 others); Fri, 21 Sep 2018 08:55:36 -0400 Received: from verein.lst.de ([213.95.11.211]:36351 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbeIUMzg (ORCPT ); Fri, 21 Sep 2018 08:55:36 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 2401368D80; Fri, 21 Sep 2018 09:08:05 +0200 (CEST) Date: Fri, 21 Sep 2018 09:08:05 +0200 From: Christoph Hellwig To: Dave Chinner Cc: Ming Lei , linux-block , linux-mm , Linux FS Devel , "open list:XFS FILESYSTEM" , Dave Chinner , Vitaly Kuznetsov , Linux Kernel Mailing List , Christoph Hellwig , Jens Axboe , Ming Lei Subject: Re: block: DMA alignment of IO buffer allocated from slab Message-ID: <20180921070805.GC14529@lst.de> References: <20180921015608.GA31060@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180921015608.GA31060@dastard> User-Agent: Mutt/1.5.17 (2007-11-01) 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 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.