Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2781826imm; Mon, 24 Sep 2018 09:48:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV61kE0Ef81IfNy1fjQvx6PPY+ESmevQuwBNGw3W5CXqJpgh/ASXBZF8aAmrLpILenkt7dMCx X-Received: by 2002:a63:fe49:: with SMTP id x9-v6mr10284473pgj.152.1537807714796; Mon, 24 Sep 2018 09:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537807714; cv=none; d=google.com; s=arc-20160816; b=W2dC6yP0IiNz/jxvb4ruSVms/CUgLUl5OByuTLerTNR9Ly5TjZ2PsVXJKlLJyPVWTf lvC9pK1VaKWiL41iSy6rnKCiLu2WS5Jaru25wFv3+nixJvCUtxf0YgulWsW6pDsh4xLu RAxs1bxlEQFg4SdZGjAO+bRQKZy1trkm0kdtEObHfpVSfhZ2Hp3KxwONiQ9pENGrUzjd 1mE4/qY1fPClYhb5qbk240l5pQ5i5feMPp5w8lTcpxNSQABSFb5RL2gSjkUThE6Sp4AM K/6kD2Q4kZOVWOMIQ3xXS/nuXEQT5cMksWcqWHkJq3tV2lwgtybh6wW1WKya6egxI8DI ZjMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=0mzsxHIVM4CkekhvHVvw2d24wgk7W5TUwSrQKfCvH2A=; b=K8QyaxOxCbRiqlgAfAQPhNsu6zbcDmhrIQsPg1iVubStR+XVSHOy7FRpTP/6MkMZ7Y EQg1oKA37PCzPXOn3QfvxRDdXk4eLOsAgCtbKwK8jS4PP99ezBu6s3t0CPYSeE7Wswn6 t4mLL+6cC6MVGw7TvFtIG+3eOFs6+Egm5Pp48fkflY0hs511WFWJ16NdIrh8hcy3I95k u3CCVALkNPC1/dJk1q7Rg5r2VrG0L7TN+uRc39b00Qh4m7ILsnefkHHtcEzSmJWgx8TJ DRdV3ChCaxuNCapaKPKa9xtfQBk9Cvv5ne+WpD6+WnP/hfULywhS0ohNGQ+alyAwO343 +/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b="EXDNbKa/"; 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 a24-v6si30544784pgi.515.2018.09.24.09.48.19; Mon, 24 Sep 2018 09:48:34 -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; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b="EXDNbKa/"; 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 S1732449AbeIXWu4 (ORCPT + 99 others); Mon, 24 Sep 2018 18:50:56 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:58040 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728006AbeIXWu4 (ORCPT ); Mon, 24 Sep 2018 18:50:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1537807673; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=0mzsxHIVM4CkekhvHVvw2d24wgk7W5TUwSrQKfCvH2A=; b=EXDNbKa/hgEdfsnQ27z42aRCBao6L070aNTUbxijBUpLIT7wy6dXcdpfiFYbOGZI LAS8ADUfbQRKq7ZmaKPjESUDq8g/qi4nDTCaY4jOXMu6qJ9y8cVwfGcqtuC3EpSXmWj sSkWAlG97OMcbX5OED5DJ4Yjy8hnvtKpHNHw2V3Q= Date: Mon, 24 Sep 2018 16:47:53 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Bart Van Assche cc: Andrey Ryabinin , Ming Lei , Vitaly Kuznetsov , Christoph Hellwig , Ming Lei , linux-block , linux-mm , Linux FS Devel , "open list:XFS FILESYSTEM" , Dave Chinner , Linux Kernel Mailing List , Jens Axboe , Linus Torvalds , Greg Kroah-Hartman Subject: Re: block: DMA alignment of IO buffer allocated from slab In-Reply-To: <1537805984.195115.14.camel@acm.org> Message-ID: <010001660c7ae798-2c446e83-392a-40bd-a89d-8da2f20dd1b8-000000@email.amazonses.com> References: <20180920063129.GB12913@lst.de> <87h8ij0zot.fsf@vitty.brq.redhat.com> <20180923224206.GA13618@ming.t460p> <38c03920-0fd0-0a39-2a6e-70cd8cb4ef34@virtuozzo.com> <20a20568-5089-541d-3cee-546e549a0bc8@acm.org> <12eee877-affa-c822-c9d5-fda3aa0a50da@virtuozzo.com> <1537801706.195115.7.camel@acm.org> <1537804720.195115.9.camel@acm.org> <10c706fd-2252-f11b-312e-ae0d97d9a538@virtuozzo.com> <1537805984.195115.14.camel@acm.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-SES-Outgoing: 2018.09.24-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Sep 2018, Bart Van Assche wrote: > That means that two buffers allocated with kmalloc() may share a cache line on > x86-64. Since it is allowed to use a buffer allocated by kmalloc() for DMA, can > this lead to data corruption, e.g. if the CPU writes into one buffer allocated > with kmalloc() and a device performs a DMA write to another kmalloc() buffer and > both write operations affect the same cache line? The devices writes to the cacheline through the processor which serializes access appropriately. The DMA device cannot write directly to memory after all on current Intel processors. Other architectures have bus protocols that prevent situations like that.