Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2150026imu; Wed, 12 Dec 2018 10:18:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/VGPucVZpXCTPb7/8zgrraCCHlyiiVMUtiZDVXkQPysVMxcYP/rGHSDJ1aG30Ph00of5MoZ X-Received: by 2002:a65:5c4b:: with SMTP id v11mr19007181pgr.333.1544638693284; Wed, 12 Dec 2018 10:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544638693; cv=none; d=google.com; s=arc-20160816; b=sIJ64ZgDMAHc9/WT/zC0Wg0fn97KptP5RFE4qshT4f2kbIG6xfGyB7aZrH3SFB4CPp 1tAeSDJszmR8xs2q0s8/GhnLTifJi3J44LkhSDGbKo7z3LlsIG8pgLXD95cW0jTiXjKn Og0O+991aF5zDlYETYTqjgDoisudTpO9onpz0eym2AzW3BUguusj2xVRr9TE2Sg76b6r ybFs+qehOX6mPBb7SU6iRuZbcNBET6fgeO+82c9c2LKqvUMs/i4BHJH2j8yOPx7yEMfN PheFWlEpPsSjUCZrgtiMvMyTEZMdwSmR/CSliImBxH2DFjzj4mCgTKFn1b0bhfRUIjRj 9hEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ngkr6G/hl19Sj13Zj9QNMWN2EVzwYXvhHfOeT6gw8Z4=; b=BW6cT6V8VLAJMGNMtMcSeDEyK5iFMXysE0MtPiSBd1YdaQUyi0Ab/Qa7yVa0H6dM6+ sSDcxL48UY7gka0AYi/Y/vV7fZ2KWLjMO4g2c1W+E3cFUHvx3q8tquN4Ff8oSLE2dFpJ 7roliQtcOBSUN+JCLLWIDW54n7z7o4sOJUOrhrWJ0FwSG4quyntIkQgXux6dPf6SUBHJ WV6hCjk3vIXhYzc0N1vUBOqVzK+jpXm7EuMxDvNE7ZnvI6KNyboKIzinSdGmKVmfYOOQ qcUuip4dBbDDSWqI7D5aiIhXbNgWnO8UBx7521O9ypbZL6DxRr+gba6yGgfZdAc4vjPI 1eqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FQHFkOAp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e125si16204707pfe.14.2018.12.12.10.17.51; Wed, 12 Dec 2018 10:18:13 -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=pass header.i=@linaro.org header.s=google header.b=FQHFkOAp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbeLLSPt (ORCPT + 99 others); Wed, 12 Dec 2018 13:15:49 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:35344 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeLLSPs (ORCPT ); Wed, 12 Dec 2018 13:15:48 -0500 Received: by mail-yw1-f66.google.com with SMTP id h32so7355622ywk.2 for ; Wed, 12 Dec 2018 10:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ngkr6G/hl19Sj13Zj9QNMWN2EVzwYXvhHfOeT6gw8Z4=; b=FQHFkOApPoRn1IVfb5rBQg3yZZCTcDX2Gx0DiU1nJPYNGK47eYma7KbHAsBnIA6Eti rn0i4inpeZRHpsYYULgcH5gxVKZzpo4OODYcnttcrSXR8jAFK6W+iHfK15DMR4UeDiG0 V/o8LBiODS84lnnQFdCCs1QgRvKPXovvWGcYY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ngkr6G/hl19Sj13Zj9QNMWN2EVzwYXvhHfOeT6gw8Z4=; b=MDjeX0bHgJX0Do/NTv5UBdhUvlMrFs4qSXzd69czhkSTc9fFWoDONyej6BaN7ppk54 Soyx0iqB4pHKjjWNmU/zxQ46BEuVZgSBsnTFMZqr6YWaNFbip5G4vk2WiB9Tx86a3ius 4BXePZxcJXpfmTQR/oI9d61eo4mVSQeXvK0RXOtka1Q64bY37Let1L17J5qWOskQnRQo 9RDZpd1SagXjEgl29Gd5FgxKc3DxrhFK4N7h+j5+Q03mgsNafe9qMqkV4BcueKSj02W4 3Ln2YZS5nFLu9B31BsdM4Bd123PsW48/lNjuNU8h5RLTEpVZB/Ghv1sJOdr4Hmfw8r6C uflQ== X-Gm-Message-State: AA+aEWZFt3jjoTWL6+29xlljBMdkyNeKfb/rPpG4fmAuZw1ylPK3Phzd if0rfdWIjV09kxqG8ztkWO9AhaCzQrDUtcNAXfSy9Q== X-Received: by 2002:a81:2bc2:: with SMTP id r185mr13475141ywr.425.1544638547427; Wed, 12 Dec 2018 10:15:47 -0800 (PST) MIME-Version: 1.0 References: <20181211103616.22137-1-anders.roxell@linaro.org> <613667c4-f850-d88c-7a2e-76dda5d966f5@arm.com> In-Reply-To: <613667c4-f850-d88c-7a2e-76dda5d966f5@arm.com> From: Anders Roxell Date: Wed, 12 Dec 2018 19:15:36 +0100 Message-ID: Subject: Re: [PATCH] dma-debug: fix soft lockup when a lot of debug are enabled To: robin.murphy@arm.com Cc: hch@lst.de, Marek Szyprowski , iommu@lists.linux-foundation.org, Linux Kernel Mailing List , rostedt@goodmis.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Dec 2018 at 12:51, Robin Murphy wrote: > > Hi Anders, Hi Robin, > > On 11/12/2018 10:36, Anders Roxell wrote: > > When running a kernel in qemu with enough debugging options (slub-debug, > > ftrace, kcov, kasan, ubsan, ...) enabled together, that results in a > > slow initcall. So a 'watchdog: BUG: soft lockup' happens: > > > > [ 44.105619] Call trace: > > [ 44.106709] __slab_alloc+0x70/0x88 > > [ 44.107757] kmem_cache_alloc_trace+0x13c/0x590 > > [ 44.108764] prealloc_memory+0xb8/0x240 > > [ 44.109768] dma_debug_init+0x174/0x1f0 > > [ 44.110725] do_one_initcall+0x430/0x8b0 > > [ 44.111719] do_initcall_level+0x548/0x5b4 > > [ 44.112672] do_initcalls+0x28/0x4c > > [ 44.113628] do_basic_setup+0x34/0x3c > > [ 44.114559] kernel_init_freeable+0x194/0x24c > > [ 44.115570] kernel_init+0x24/0x18c > > [ 44.116498] ret_from_fork+0x10/0x18 > > > > Rework to call cond_resched(), in the function prealloc_memory()'s > > for-loop. > > Funnily enough I've just done a bit of work in this area which should > make allocation a lot more efficient - would you mind giving this series > a spin on the same setup to see how much it helps the performance? > > https://lore.kernel.org/lkml/cover.1544447601.git.robin.murphy@arm.com/ I tried it on todays next tag and couldn't reproduce the soft lockup. Cheers, Anders > > Thanks, > Robin. > > > > > Signed-off-by: Anders Roxell > > --- > > kernel/dma/debug.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c > > index 231ca4628062..2abdc265aec4 100644 > > --- a/kernel/dma/debug.c > > +++ b/kernel/dma/debug.c > > @@ -767,6 +767,7 @@ static int prealloc_memory(u32 num_entries) > > int i; > > > > for (i = 0; i < num_entries; ++i) { > > + cond_resched(); > > entry = kzalloc(sizeof(*entry), GFP_KERNEL); > > if (!entry) > > goto out_err; > >