Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3438024ybl; Fri, 20 Dec 2019 09:16:11 -0800 (PST) X-Google-Smtp-Source: APXvYqy0tKwgnjQra+dzuv66HZ7+kZOr+1ImmKas1Yetkl24F3OjQvOsJ3NiRdr07BA1z94nHCh3 X-Received: by 2002:a54:4895:: with SMTP id r21mr4596505oic.107.1576862171156; Fri, 20 Dec 2019 09:16:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576862171; cv=none; d=google.com; s=arc-20160816; b=ervQM7ym0KavjT2OHc7T3WM0/JbV7yNJLE8l/aCPWonujnHttC1dxMB/DYBaWDGfp+ rUa2vWcPB9kMMet1pO0Wud1ozwzgct9oJpG4BiEsrgtmUtlzrICdPei6puph6rT1lvxY V5gJLkj1v61EJwyNjW6/XYlIS32mY2pDi4oz19GRSKmLRvmYbz0xWYiyY7o1VIES+WQG aXppBJl4vN/Pgzz14t4iaTkUR78kl18OvRGaJeJCYrC3UJqUR9nCcPJJqgn88Tk08YA1 fd5AboOYi60yNbWwk1/zVewKc18VqjTR48F5DuJjjGL++3zL5NId+yP+1Bp8mXEZMm7X zJpA== 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:dkim-signature; bh=CWMLNuWoRKapPDrLtoeUFvhjshGIgztAHqDVEXQJ5Jo=; b=w4uTBL/KthkLXvEFBUk6IRPdhrMmmpCAKn48oYlEM6DFga6r6wa9BSEbfeHza5TPXH LjGnd15i5dtSffv5GiSfbwbrW7f2VWtj2Ga0HGYoeD1bZ8WCDujuOSxany45xqKsPyNX SQrtTcTB4kcBARyIYqN8CVEMonu9TSQ5yMZ9+wotXlrsV3tU3T5vTjla4MRPRSYywf9w 73YYIr0V13d+caHy6qyUImj1JDH1P70CPKkvZ2M0McVEo6V9ae4owIHWlWGoIk7hIXZl ty/LpojEwR5Xt3YWNyA63TQMQbd0Lddh7e6XnsHJTsilf536B0owUyofA1zp2d4b4gfN fOvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Sstg1BhJ; 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 a12si4823440oie.87.2019.12.20.09.15.58; Fri, 20 Dec 2019 09:16:11 -0800 (PST) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Sstg1BhJ; 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 S1727420AbfLTROY (ORCPT + 99 others); Fri, 20 Dec 2019 12:14:24 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58490 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727362AbfLTROY (ORCPT ); Fri, 20 Dec 2019 12:14:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CWMLNuWoRKapPDrLtoeUFvhjshGIgztAHqDVEXQJ5Jo=; b=Sstg1BhJ2zXAUsD1rwa7Tn7xl kLz2zyXnk8wGdadR9f4iP8vgQl0fa6IolhNyW8VYf/HplyMFGq6tUJtylPZlXQW2K/EyE8LBuasqb HQuTebHGYgNpURPXu3rD1kYIKPmnkfC0FVkmrIaHGyqLp5u8AaKbRmN9DwWqLuISGTCo4V+1vrjAE AfSIpio1XRCq6MsX1hCB+KTw9adW7qh4RSsYTgzseYQ9af1dRHHHQ7Kh5rJEzJv5crDYSx9cYJ4pW hoD9jUBiyTo0h/VH4OVdBVBCEmVo/nBnQfz5TYqkeWYL4IIzNsM5Ong16GGP/N/1uA/QPQPBkuCE/ u0RIsgRnQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiLqk-0006GU-16; Fri, 20 Dec 2019 17:14:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5A96D300DB7; Fri, 20 Dec 2019 18:12:35 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 61419203A6F24; Fri, 20 Dec 2019 18:13:59 +0100 (CET) Date: Fri, 20 Dec 2019 18:13:59 +0100 From: Peter Zijlstra To: Robin Murphy Cc: Marc Gonzalez , Greg Kroah-Hartman , Rafael Wysocki , LKML , Linux ARM , Dmitry Torokhov , Alexey Brodkin , Will Deacon , Russell King , Bjorn Andersson , Tejun Heo , Mark Brown Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for devm_kmalloc() Message-ID: <20191220171359.GP2827@hirez.programming.kicks-ass.net> References: <74ae22cd-08c1-d846-3e1d-cbc38db87442@free.fr> <20191220140655.GN2827@hirez.programming.kicks-ass.net> <9be1d523-e92c-836b-b79d-37e880d092a0@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9be1d523-e92c-836b-b79d-37e880d092a0@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 20, 2019 at 03:01:03PM +0000, Robin Murphy wrote: > On 2019-12-20 2:06 pm, Peter Zijlstra wrote: > > data = kmalloc(size + sizeof(struct devres), GFP_KERNEL); > > At this point, you'd still need to special-case devm_kmalloc() to ensure > size is rounded up to the next ARCH_KMALLOC_MINALIGN granule, or you'd go > back to the original problem of the struct devres fields potentially sharing > a cache line with the data buffer. That needs to be avoided, because if the > devres list is modified while the buffer is mapped for noncoherent DMA > (which could legitimately happen as they are nominally distinct allocations > with different owners) there's liable to be data corruption one way or the > other. Wait up, why are you allowing non-coherent DMA at less than page size granularity? Is that really sane? Is this really supported behaviour for devm ?