Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2518471pxa; Fri, 7 Aug 2020 13:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0SbCRY4gceZ1f5OjiZBB3SXxd/pbD7xPb48+VIxzcMQHbT/8kAUBCymyLacf35JSlCRVt X-Received: by 2002:aa7:d809:: with SMTP id v9mr10448860edq.94.1596831084831; Fri, 07 Aug 2020 13:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596831084; cv=none; d=google.com; s=arc-20160816; b=foN8J8LeY35vvTpKJC1+HexgbTkMuA9GQb5ZRsy0wU1XuM2XDFQTCz4lfsaeY33xQq NO5Zqlak6RgxhYhY6+RyR1oShUmltn4dISH/8NZWLBDGULXNdIpSZzTqU1XViaQIIJyG 7AwDfgs2CZM/8xlsHzxQ1GVeW7jc9E88b0fh7QVtcbf0dc+K/gqOaIbYUVsqtXUrUIRD GMci6vwYdUFaF2HP5Vrccasfw/dccDjHzj1X4N6d0nfbv0BTDoAsbsLnqDPmQblq6GO/ w0r2akHmJs0fQQjWdnAgl77CvAve13Fs5fglD8heldbvmJhZsbg1L6YJTrIpdglt69I1 1meQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UVk3YfTD+RcRn+piTHxLap6HVr+3FCmvlsWk/IZ++2M=; b=HO9H031x/vSVJ+7ZrRcnqLmhbBnTELZAhg3BqDcLS8F5i3ufS+Ssk2ODsjBqwB9IoY d+Wkk+rEm/1uSrNmHkSTavCo2bqnMZxtP/NPF7qqHDHVDGMTcdjZ/qEmf6YV7pcXpZ2H iSFn6K+nsKp5xwH8iJm7uFnehaTksiAHnBqHpQ5W4XqEySAUJ9ckSM+54bCSLGQQHtlB kpAWwkLr9848Cdc4dBpLH7LiP998MsUUTiFz/se6HJRkyVQCszPqJMmaZBN6D9Gmtllo ltyrI2W5E5/o49/5y0miw6HFPNjRM4MNOLA2gnbCu/duojdjIf9NY5mHDl19dlPTK8Hn tZww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dBC4Vibj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si5759709eju.121.2020.08.07.13.11.01; Fri, 07 Aug 2020 13:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dBC4Vibj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgHGUK1 (ORCPT + 99 others); Fri, 7 Aug 2020 16:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbgHGUKZ (ORCPT ); Fri, 7 Aug 2020 16:10:25 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31821C061756 for ; Fri, 7 Aug 2020 13:10:25 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id q9so2550092oth.5 for ; Fri, 07 Aug 2020 13:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UVk3YfTD+RcRn+piTHxLap6HVr+3FCmvlsWk/IZ++2M=; b=dBC4VibjdRNSQ1lyKWPhM3r96dR3Zb04I2oCuL5Hw3edbvf178VwhZZiysXkOJy/bZ tU7BmI+qYLpp5Bi+mwaLsY+alcQVk4NmtlT7ezwgnyCvqO9A0BqxuvsMppH39DnmIW/l 24kk4jnJlVDGVFKQIrtDr0gC7ncqIV80uOdJUGAcwvxC7L7JAOP+9r9fhXTEzxhfhVZ9 6Nhiq3Q1zDM9pOnftsHTfJutn5n39hbw9HHav4b51RaTh/dBqHfr95dB1EWo/3OPGb1Z Kxp77r9FAumwJS0Xy17C5B84iDuDanKMYjB0+DdJd6GdDNCVf/CtmKDjR4uLkfid9i/w fBTw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=UVk3YfTD+RcRn+piTHxLap6HVr+3FCmvlsWk/IZ++2M=; b=h18MqDils54nqPBjFNnSrOpS5dl30fE/8/0pe2F41voZFlshgy8XlIjDFUV6kIXF/z n0e1k4sFRY+jT3qOhHdFC6pgrJTgzuaruLQhqK/9DxaHAjNljsqUOU8c87G9b9NvMLHn 7C0NXlcEBCOr15FriDCyPmUf6zp4iVSBoWcflo27OPla9Rm3Nw5NxIuQrUlT9N0HVnnL yT9rTWyYmQlK59arZEdfo4zZiw1eCg70sdn51w51KArrZMIotHid0JmEHzImrZjkuBjx kIZ7qdG0/jCdr94CCg+QsWmApFd62egizrTH2fuvZnepXuOzx9afiwD5Py+cQyYovEVO R5sQ== X-Gm-Message-State: AOAM532kHWCgMJH738KStip9QXiK2/35o2t2s6E7ikbB0g9FTSoyKHbj ty9vWFbDvsOpvqIVQ2XIfLk= X-Received: by 2002:a9d:4b90:: with SMTP id k16mr12609702otf.69.1596831024585; Fri, 07 Aug 2020 13:10:24 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::af38]) by smtp.googlemail.com with ESMTPSA id s6sm1835794otq.75.2020.08.07.13.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 13:10:23 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [PATCH 6/7] dyndbg: add locking around zpool-add loop in zpool-init Date: Fri, 7 Aug 2020 14:09:53 -0600 Message-Id: <20200807200957.1269454-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200807200957.1269454-1-jim.cromie@gmail.com> References: <20200807200957.1269454-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit doesnt improve things, last commit was working, next one still breaks, despite this "fix". I keep it separate for the following review, which now stated, will be refuted as needed. ;-) Locking review: ddebug_zpool_init(), like other *_init() routines, does no locking itself. Unlike them, it runs later, at late_init. This patch doesnt fix the kernel panic that HEAD+1 does. ddebug_callsite_get/put() are called as a pair under mutex-lock for all 3 callsite users, 2: ddebug_change(), dynamic_emit_prefix(), do their own ABBA-ish LGPU (Lock-Get-Put-Unlock). ddebug_proc_show() does the GP part, and is wrapped by ddebug_proc_start|stop() with LU. ddebug_add_module() does LU to protect list_add(), HEAD~1 added ddebug_zpool_add() loop inside that protection. This commit adds locking to ddebug_zpool_init(), around the loop of ddebug_zpool_add(), to match the locking in ddebug_add_module(). Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index fdf52a26a504..701d3d1fb7e7 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1182,8 +1182,10 @@ static void __init ddebug_zpool_init(void) } /* add-module normally does this, but not in time for builtins */ + mutex_lock(&ddebug_lock); for (iter = __start___dyndbg; iter < __stop___dyndbg; iter++) ddebug_zpool_add(iter); + mutex_unlock(&ddebug_lock); v2pr_info("total pages: %lu compaction: %lu\n", zs_get_total_pages(dd_callsite_zpool), @@ -1280,4 +1282,3 @@ early_initcall(dynamic_debug_init); /* Debugfs setup must be done later */ fs_initcall(dynamic_debug_init_control); - -- 2.26.2