Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp509124imu; Tue, 27 Nov 2018 02:01:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/UTxmx5iUvyyxi2heLtFta31RrOQZqU4X1w+w9I+ygzrVDOUQVG2Uxpsf6Ct22zEHc/u3F3 X-Received: by 2002:a63:66c6:: with SMTP id a189mr28649802pgc.167.1543312894712; Tue, 27 Nov 2018 02:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543312894; cv=none; d=google.com; s=arc-20160816; b=rojkpd+WFp76uc1RL2kBc1i3Jd/7xv0COirl/ttfALQhh3wamK+gldK/Ihv2byQ1d4 avFG86XbRcjc8+OPMT05dELrbgibzv0qlBYQi6fSoerGGV2RcJuDFrXcwO7jVXoP/4Fm yFSfFdtnBzF24cUvGGUNNg1b1LNxCwSVWDNpJc7PPiD5dXZuZT4WlJYHf6/JjQJhxf7X BHr8qpw6aJu9wfClZUG9NcPAK9u5qGX/WAP6iK37+NAiotuGpnWki+MVjjvh2ubnchLa pgpl0bYlX/L6HkgmBGCsdoIULqDp2oAegrpUSjXZY4R7bd8tWa5cHEAm06/tsV9twiEd M7LA== 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=x5lWrBa8xNq7LtXzT47TLI8OQMc1MQ4KXEEov1Nj9YQ=; b=uufYo+d/uj8dcUWYX2OOKea0iuvXYh18zt+BpLCV/aAZFYyPfT40x+5k5yhYxdBWn/ +1kFGbB+8RJX0YlwXPH4KU3xh2Ppv/U4LcV8Ah2m8AW7Smigr1ubA7d7cswfq0QEByl/ 1gIaIjDL+TInD5Mb19w9H0gNoIxyKWSKkbRN7SDsULKIvDe+GOcbsSTaDyzkLIQCvVxa L0rHghY2tE/msNturIWY1Z2HZXq251WIMmQb8WEd3J6gRGRQ2f74mxTBDcr1/HBsuIRb MB3+MuddZPTcoAZikYf6jO2rOYZtIydCupxtj0y9SqGT7JQwVAy/ecdv2FSzMccPzOio mMcA== 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 d6-v6si3319412plo.184.2018.11.27.02.01.17; Tue, 27 Nov 2018 02:01:34 -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; 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 S1730427AbeK0U4R (ORCPT + 99 others); Tue, 27 Nov 2018 15:56:17 -0500 Received: from mail.bootlin.com ([62.4.15.54]:33520 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726437AbeK0U4R (ORCPT ); Tue, 27 Nov 2018 15:56:17 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id A9EBA207A8; Tue, 27 Nov 2018 10:58:53 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 7808E206D8; Tue, 27 Nov 2018 10:58:43 +0100 (CET) Date: Tue, 27 Nov 2018 10:58:43 +0100 From: Alexandre Belloni To: richard.genoud@gmail.com Cc: Ludovic Desroches , Nicolas Ferre , Maxime Ripard , Vinod Koul , "linux-arm-kernel@lists.infradead.org" , dmaengine@vger.kernel.org, Linux Kernel , "linux-serial@vger.kernel.org" , Mario Forner Subject: Re: DMA: atmel_serial: Opening and closing the serial device repeatedly causes kmalloc-32 slab leak Message-ID: <20181127095843.GF19871@piout.net> References: <22061488.b0eNpyQjWt@linux-7rm0> <83753d21-f3c8-c8dd-75d7-741cb597d1a3@sorico.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83753d21-f3c8-c8dd-75d7-741cb597d1a3@sorico.fr> 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 Hello Richard, On 27/11/2018 10:51:13+0100, richard.genoud@gmail.com wrote: > Hi all, > > I reproduced the memory leak on my board (at91sam9g35-cm) with a 4.20-rc3. > > It triggered an OOM after a couple of hours running a code like this: > #include > #include > #include > #include > > > int main(int argc, char **argv) > { > int fd; > do { > fd = open("/dev/ttyS1", O_RDONLY); > close(fd); > } while (true); > return 0; > } > > As Mario pointed out, this only happens when atmel,use-dma-{r,t}x are > used in the device-tree. > > Adding: > CONFIG_DEBUG_SLAB=y > CONFIG_DEBUG_SLAB_LEAK=y > Doesn't show anything suspect in /proc/slab_allocators > > From what I found until now, it's something done in : > dma_request_slave_channel(); > that leaks kmalloc-32 > Mabe I missed something, but it seems that everything DMA related is > deallocated in atmel_release_{tx,rx}_dma(). > > Is this ringing a bell ? > Yes, this is known issue and it has yet to be worked on. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com