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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 2D74EC43603 for ; Fri, 20 Dec 2019 20:24:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F03E021655 for ; Fri, 20 Dec 2019 20:24:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HfMs65BI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F03E021655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P0+lAEUOrs6M2AKkVyuKXyH9/Wuujb3FtuO1oeQ53rw=; b=HfMs65BI9B0ngP 31cNUHT9NyyYXceNmtU23BXxd0aMNkpz6iFictv3tXKxG1WWVdaZvq41qxz8Kz4EqHE6H2YKK1cr8 cpszflvkz1r8dIx4xJyiZVPY2Ebgr0KLQnToP0pY/fHz+ylZCDqpR83B20XFIp2l69+kYxqEDusib fuR7gTq/AgPKbzJ8n8ozZ57Ror4fCVeh1q/lYX7Vk1pqPajx87oYyJaegRwadePbpeq8+FxSOJsM7 baPATCu+6B8VwY8qiUAQE1SCMXSkLxg+pGGZuxu7/sTKtdYntedo+8EjxxJPSAkEBdKQGQE2Oix0K 32Ce9/AIvs1s7LON0VrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiOoW-0006e9-CE; Fri, 20 Dec 2019 20:23:56 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiOoO-0006ZS-Cg; Fri, 20 Dec 2019 20:23:48 +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 F2FA33007F2; Fri, 20 Dec 2019 21:22:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 12A0C2024479A; Fri, 20 Dec 2019 21:23:46 +0100 (CET) Date: Fri, 20 Dec 2019 21:23:46 +0100 From: Peter Zijlstra To: Alexey Brodkin Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for devm_kmalloc() Message-ID: <20191220202346.GT2827@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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Marc Gonzalez , Eugeniy Paltsev , Greg Kroah-Hartman , Vineet Gupta , Dmitry Torokhov , Rafael Wysocki , LKML , Bjorn Andersson , Russell King , Mark Brown , Tejun Heo , arcml , Robin Murphy , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On Fri, Dec 20, 2019 at 07:32:16PM +0000, Alexey Brodkin wrote: > Well it somehow used to work for quite some time now with the data-buffer > being allocated with 4 words offset (which is 16 bytes for 32-bit platform 3 words, devres_node is 3 words. Which is exactly why we had to change it, the odd alignment caused ARC to explode. > and 32 for 64-bit which is still much less than mentioned 128 bytes). > Or we just never managed to identify those rare cases when data corruption > really happened? The races are rather rare methinks, you'd have to get a list-op concurrently with a DMA. If you get the list corrupted, I'm thinking the crash is fairly likely, albeit really difficuly to debug. > > No matter which way round you allocate devres and data, by necessity > > they're always going to consume the same total amount of memory. > > So then the next option I guess is to separate meta-data from data buffers > completely. Are there any reasons to not do that Dunno, should work just fine I think. > other than the hack we're > discussing here (meta-data in the beginning of the buffer) used to work OK-ish? If meta-data at the beginngin used to work, I don't see why meta-data at the end wouldn't work equally well. They'd be equally broken. But I'm still flabbergasted at the fact that they're doing non-coherent DMA to kmalloc memory, I thought we had a DMA api for that, with a special allocator and everything (but what do I know, I've never used that). _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc 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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 74E14C43603 for ; Fri, 20 Dec 2019 20:23:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 314E0206D8 for ; Fri, 20 Dec 2019 20:23:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NHmh4fgq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 314E0206D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oLh0ekNKVKJG+NgjSGR8J1TZslb+C6vP9f9LRYbPsMY=; b=NHmh4fgqE+rsHi 0mLUi5qKcjFEq+g90Hd35k5t31MiULm7O0ATutW0lBh/YXxYfDP5OZ6zK9wa/03xvM87LlAZfa4If w8PI1HCbzw3Hd7voWDmCWsZc86f3wNvG7VjJShH21qYxwkphbsKNx9Yg6bsPDs3Jw0jY/L/jzqwGX p6kOJzCnbgWInEbsIA/dAFK/bIXhpVjH8frG8Lp5fjG1P3gyjOP7ToorW4BSy2bvN7bsUm2xIO3XP aUK6rCKTLVlW9qlLumFmC65relcMBhdJhJrh5P5CpNiA7tMaUNJPlKe14eQDi+Ig9d2YdlhIrtw+d SG9UWtokXu0irGhgEV8A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiOoT-0006Zd-4t; Fri, 20 Dec 2019 20:23:53 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiOoO-0006ZS-Cg; Fri, 20 Dec 2019 20:23:48 +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 F2FA33007F2; Fri, 20 Dec 2019 21:22:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 12A0C2024479A; Fri, 20 Dec 2019 21:23:46 +0100 (CET) Date: Fri, 20 Dec 2019 21:23:46 +0100 From: Peter Zijlstra To: Alexey Brodkin Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for devm_kmalloc() Message-ID: <20191220202346.GT2827@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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Marc Gonzalez , Eugeniy Paltsev , Greg Kroah-Hartman , Vineet Gupta , Dmitry Torokhov , Rafael Wysocki , LKML , Bjorn Andersson , Russell King , Mark Brown , Tejun Heo , arcml , Robin Murphy , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 20, 2019 at 07:32:16PM +0000, Alexey Brodkin wrote: > Well it somehow used to work for quite some time now with the data-buffer > being allocated with 4 words offset (which is 16 bytes for 32-bit platform 3 words, devres_node is 3 words. Which is exactly why we had to change it, the odd alignment caused ARC to explode. > and 32 for 64-bit which is still much less than mentioned 128 bytes). > Or we just never managed to identify those rare cases when data corruption > really happened? The races are rather rare methinks, you'd have to get a list-op concurrently with a DMA. If you get the list corrupted, I'm thinking the crash is fairly likely, albeit really difficuly to debug. > > No matter which way round you allocate devres and data, by necessity > > they're always going to consume the same total amount of memory. > > So then the next option I guess is to separate meta-data from data buffers > completely. Are there any reasons to not do that Dunno, should work just fine I think. > other than the hack we're > discussing here (meta-data in the beginning of the buffer) used to work OK-ish? If meta-data at the beginngin used to work, I don't see why meta-data at the end wouldn't work equally well. They'd be equally broken. But I'm still flabbergasted at the fact that they're doing non-coherent DMA to kmalloc memory, I thought we had a DMA api for that, with a special allocator and everything (but what do I know, I've never used that). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 8F859C2D0D2 for ; Fri, 20 Dec 2019 20:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C700206D8 for ; Fri, 20 Dec 2019 20:24:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FV0ppH6c" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbfLTUYA (ORCPT ); Fri, 20 Dec 2019 15:24:00 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:37518 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbfLTUYA (ORCPT ); Fri, 20 Dec 2019 15:24:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=DgxQx9+28OG7P/tSoTPUj1RwIIkipr7p1feEqqcd1ig=; b=FV0ppH6cMvMfOYZcK2cAjPpro XAcw8l+Fo8vfo6cc0aXGtjdbs8NhjUA0aEsJiXVuXsJPZ2oiOEDsw5QGrL4FlbRKSbVLMWVa4kgnT 0mIqhgi909xSTmSgRZyZRJBPzFQnydtZqvfrLQ1AayVs2gQmGaB46x2jM0v3+5cdubGnDNuEcElon 6bUdPako3fOTHFvABl/qvWwPnke0y/7AsTnmm7ZVYJIbJsp+M9RHicZ0RUVnwe2Fk5Dk96o0mpmdL HrFEh8R9tvCLabSgtMn3dTO1Bwv4t0SVqFl2zBNFyQa8FskumqrsznpbSbRoRKkP0OhmvGQPmTv/N H6IjIA0Xw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiOoO-0006ZS-Cg; Fri, 20 Dec 2019 20:23:48 +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 F2FA33007F2; Fri, 20 Dec 2019 21:22:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 12A0C2024479A; Fri, 20 Dec 2019 21:23:46 +0100 (CET) Date: Fri, 20 Dec 2019 21:23:46 +0100 From: Peter Zijlstra To: Alexey Brodkin Cc: Robin Murphy , Marc Gonzalez , Greg Kroah-Hartman , Rafael Wysocki , LKML , Linux ARM , Dmitry Torokhov , Will Deacon , Russell King , Bjorn Andersson , Tejun Heo , Mark Brown , arcml , Vineet Gupta , Eugeniy Paltsev Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for devm_kmalloc() Message-ID: <20191220202346.GT2827@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: 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 07:32:16PM +0000, Alexey Brodkin wrote: > Well it somehow used to work for quite some time now with the data-buffer > being allocated with 4 words offset (which is 16 bytes for 32-bit platform 3 words, devres_node is 3 words. Which is exactly why we had to change it, the odd alignment caused ARC to explode. > and 32 for 64-bit which is still much less than mentioned 128 bytes). > Or we just never managed to identify those rare cases when data corruption > really happened? The races are rather rare methinks, you'd have to get a list-op concurrently with a DMA. If you get the list corrupted, I'm thinking the crash is fairly likely, albeit really difficuly to debug. > > No matter which way round you allocate devres and data, by necessity > > they're always going to consume the same total amount of memory. > > So then the next option I guess is to separate meta-data from data buffers > completely. Are there any reasons to not do that Dunno, should work just fine I think. > other than the hack we're > discussing here (meta-data in the beginning of the buffer) used to work OK-ish? If meta-data at the beginngin used to work, I don't see why meta-data at the end wouldn't work equally well. They'd be equally broken. But I'm still flabbergasted at the fact that they're doing non-coherent DMA to kmalloc memory, I thought we had a DMA api for that, with a special allocator and everything (but what do I know, I've never used that).