From patchwork Tue Dec 11 10:36:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 153416 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp455240ljp; Tue, 11 Dec 2018 02:36:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/WnZ0G/VNLgxZ4WXwwu2jGQC8blRaOwbYDUZwUmVCej8Wm3HxNxrP4nk9O9Ptzma7Nh3nBM X-Received: by 2002:a63:f444:: with SMTP id p4mr13959076pgk.124.1544524588390; Tue, 11 Dec 2018 02:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544524588; cv=none; d=google.com; s=arc-20160816; b=ntUB5al6qbjrRHfKDx9cVwNLYI1luhrAEqotL3gThewYXSg0TW6lXjALy5hNhe+JBu 8FFdB2oieOV7xMFUEzHY5wLVQyM3kqQepDW1lvy0rH9XKjItlsqwolLWf63l3v27quhi kzT3z8QF+LnGuVSuf671bWe5mPr/IALkIC0g68h8oRVNJ9ZTkM87yTVHqCh5qTgMysv7 Ug3qDlRQOg0FWWQ3LD/O/vacDMgrnfhQt5vz3tM7iRjHqDVeD5Pvjjj5JP3jZK34LWiX zp9wZPI9qBodI6m460iFsVX2eoMDwisYJbrLy3LuL5zUtQnj9XI4cbjrQscg1+fkL0F/ Sq8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Wf2D+An8STpqHZf/qaAI2vHrjnNZQXc99ukZ3AdxPrg=; b=Pn9b1bKmOSlzvoGdds90fEjy8FZ6tZuJgsYhir98LOCgigiFSvaylh7eRYuDHHRkT9 YwSgmlQwED6PtFn0ARe537CGd2Lr8Qd+DHeCUfWNtxSG00heIkl1NCQRCikAgjkNYcjD b/cMbDryod4Ah9w0ukBLVKnGaFZIMmSweVaglpEQXTNDtyjPgWOXgqmlJ5NMA/qEx2p1 M9eAp/ausg262cemhVqXdJsARz1Qd4ZGZs1v7RRc4VxyVTF3Z0e4xppccp9X6kC0wWtf HYp7sHNqa6R/SDZQQyMk0A5B0CtgxMOTjKI3fLie0EkhD2seazaoK1Jdju3To2jBs9kZ 14tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jLPoKvET; 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 a17si12633923pfn.213.2018.12.11.02.36.28; Tue, 11 Dec 2018 02:36:28 -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=jLPoKvET; 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 S1726310AbeLKKgZ (ORCPT + 31 others); Tue, 11 Dec 2018 05:36:25 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33226 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbeLKKgZ (ORCPT ); Tue, 11 Dec 2018 05:36:25 -0500 Received: by mail-lj1-f195.google.com with SMTP id v1-v6so12526007ljd.0 for ; Tue, 11 Dec 2018 02:36:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Wf2D+An8STpqHZf/qaAI2vHrjnNZQXc99ukZ3AdxPrg=; b=jLPoKvETB+88mgEPM/i5i0IOynbOp2fTkz05nlYOXsAwA2dncMxwM2SYZ0hvNeCo2r RIHCmjooddPCRMMYpsGCjBMNqly07ul6WoYTxsL4U7dUj8RQqDtFmWL+Q8si4bs0RSsf 4nAFpDpXco4T8CxYsYGD3Gx9HfwpmryC0NoB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Wf2D+An8STpqHZf/qaAI2vHrjnNZQXc99ukZ3AdxPrg=; b=myAmuqXdDU7IeVOldRfknWVwazq3EE7GCbC2ybWUdGdDUw6qBE/mmJ0dB16s9UUmZ1 75EKQ2cCEaoQwuis5uUrbHFrRBhAN/kzB1LNZZ1+jGOkVDHJZ6xE6MOfTHOwzRESMw35 tzBbnANpomU9uUI8A3+A9kHFKzWKqxDfYPvTCkhJQBlAgOkclYR1auKqXoPPYeboET1a AiXmnvZHXm8BTM+wDFFsIY66Kf6aNI3373Biowsfc7tH7Tyah9TEoILpdbLz3hFouTmE 92R715asmwkzGPgjX/kWU8+baFF2sJN6z5judzWPCU/bYfGX8WLT1r/FoRqiQFRh+Cia 2ZDw== X-Gm-Message-State: AA+aEWb+c0yVuuKPKdexc6WHK20oyAbtAS1jmscAtI3KPN7yD2jTezUI Wj5Q6QpMdakyFHgvTmK5bhBajA== X-Received: by 2002:a2e:5747:: with SMTP id r7-v6mr9181316ljd.141.1544524583163; Tue, 11 Dec 2018 02:36:23 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id t9-v6sm2623024ljj.87.2018.12.11.02.36.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 02:36:22 -0800 (PST) From: Anders Roxell To: hch@lst.de Cc: m.szyprowski@samsung.com, robin.murphy@arm.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, Anders Roxell Subject: [PATCH] dma-debug: fix soft lockup when a lot of debug are enabled Date: Tue, 11 Dec 2018 11:36:16 +0100 Message-Id: <20181211103616.22137-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Anders Roxell --- kernel/dma/debug.c | 1 + 1 file changed, 1 insertion(+) -- 2.19.2 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;