Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2195428rwb; Fri, 5 Aug 2022 15:27:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NqMXpYHnsmx9mxzwvz08v+f/4WA7EL866EfFw1Zrql2FWtl5UtCHbOr7EoNPcUFqKSoxg X-Received: by 2002:a05:6402:84e:b0:440:4bac:be5a with SMTP id b14-20020a056402084e00b004404bacbe5amr1569086edz.103.1659738435069; Fri, 05 Aug 2022 15:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659738435; cv=none; d=google.com; s=arc-20160816; b=WRtjOMcflzFK5QgT4tX7yfhhTpACDlDeaGQ1iYQGfqgV4cAyjdOf3KmBBt+bmWZzQ8 c1w8bLoKny8Q9SNZS7+NmKWpZGvla+l9ylySzDj8o6v5iUuh/HJnv+BeTySSxX+AbEr6 wPYGdZ4Gjzq5ot0sGJBljGQDSDsaUkvWSUc2/0i1saONuKqjxJrhb97WdBOk2cIlI3PG xYZw/pa4YhDFwTZukNjBRLSFNnSAgktMjFUcskjWRb23K2ld1Ds8o3WlKhECr0qf9S0A GSnrnuPG3rEBq4y5pgXkqMHB3gQz7BloRnpxyX4rl3vWMBBIHHbTv6357KD+DkCvDhfc wGOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8o46kS926x+QNuy5c4uBrvlsDlM/ABLoibmgwB6shD8=; b=rmCzOKZXQCoJhUyvpCnPTfkT3wrMtL4RVydfE2FGx4JAN7OuGOfau+ETTVFMDRWga9 9YiwHuWR+CUPuFZswENzYKoGixS6Ai3My2VNwqxNxQ9GBOCn7B8PqOt1djTJcQpwc3ug 4Puuaypk56t228RUdBuJh7SX/DigjnoPt7oE1u3c+hWgq19qjX7IJaGRkbzqa05yHIel Prj7mMF+Irtm6dfi9BXYiZ7Qy+SFT3ftyzgYmTYZFziqNyVrmGPzm7Ch+mzHkhSAKbNA ebLf771gMUIEQTrydlTUUYXaN3o21yJLOb1KOOBDgzsA0smPCOh6wsc3Ih4Bj9s67wok VBoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lCM46axr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020aa7d984000000b0043bb806f5c2si700183eds.134.2022.08.05.15.26.50; Fri, 05 Aug 2022 15:27:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lCM46axr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241568AbiHEVyW (ORCPT + 99 others); Fri, 5 Aug 2022 17:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241497AbiHEVyN (ORCPT ); Fri, 5 Aug 2022 17:54:13 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA4DEC43; Fri, 5 Aug 2022 14:54:11 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id p82so2864379iod.2; Fri, 05 Aug 2022 14:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=8o46kS926x+QNuy5c4uBrvlsDlM/ABLoibmgwB6shD8=; b=lCM46axrhDjSPX2DcnzhMibG89Bub0Ejuetk3i4ZBIR4SKCTxg15/vbM+20ToloihC 5jJiPEBFpAYYsXVKLemc1F/6Fml/cnNqToitEQ7LP7jGmZGwrFUe80YvURLB4CE8UFmL 0T6/KfGyyq2L+pxXcJk/NFZVoOy4bAeINZaSVm+k6eQyztxe6FxW6QSllYUcNAHv8hoU O9yQgZtxinxHzbgXYMwmvu/KTIro5W39ChI58qjUIfAeJtBrt69zS23Cb+HdPV1ZWhnc JaZbhuEPr4rm39f9bibgDkng3eX1JX7n13q9Zu9wfECZ4hf7vy6yT71yq+UNFpTwV50w JpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=8o46kS926x+QNuy5c4uBrvlsDlM/ABLoibmgwB6shD8=; b=RrM/Y9vzZj2q/VewZK2pkV3klo3Yfzmw8L/Nc592QKjXxmoYxXzo9sGe+TINi9YLd/ D4nj/JhWPytOYzOxepDtibhTI0BFyu0HfASrX2lfo6c3dFu9k8DZ95O9yO/g4R3suLmK NSDsaKlHGUYfcxRi2mpNgWIf/yL+gAljLuzzPUmgJMGqADoIYuUE90xK8koDuD9yAidz GUqOKNDFLnUsugD7/F7qViPIM1otJ0JGGtsPm3259blLFilZchX1F0H3BoG1263g013a pOVxoR+Jy8Brv8meGbYkTyb5oXsoT1Ys+zrCkk3ANAeNJWXLZ4FdcyTtnexX6bovmZwm IF0A== X-Gm-Message-State: ACgBeo0+k9VJlBocc0GQxRbvdFHtl5fqHx3agzfeg69LBhqEm/mgh22C fBG6W5Oot0jnPj4e4RruL0dbYQQoewx8HA== X-Received: by 2002:a05:6638:3387:b0:33c:9f9e:5a17 with SMTP id h7-20020a056638338700b0033c9f9e5a17mr3896561jav.12.1659736450608; Fri, 05 Aug 2022 14:54:10 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e12-20020a056602044c00b0067c09fd0b53sm1765532iov.21.2022.08.05.14.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 14:54:10 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie , vincent.whitchurch@axis.com Subject: [PATCH v5 01/33] dyndbg: fix static_branch manipulation Date: Fri, 5 Aug 2022 15:53:23 -0600 Message-Id: <20220805215355.3509287-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220805215355.3509287-1-jim.cromie@gmail.com> References: <20220805215355.3509287-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In https://lore.kernel.org/lkml/20211209150910.GA23668@axis.com/ Vincent's patch commented on, and worked around, a bug toggling static_branch's, when a 2nd PRINTK-ish flag was added. The bug results in a premature static_branch_disable when the 1st of 2 flags was disabled. The cited commit computed newflags, but then in the JUMP_LABEL block, failed to use that result, instead using just one of the terms in it. Using newflags instead made the code work properly. This is Vincents test-case, reduced. It needs the 2nd flag to demonstrate the bug, but it's explanatory here. pt_test() { echo 5 > /sys/module/dynamic_debug/verbose site="module tcp" # just one callsite echo " $site =_ " > /proc/dynamic_debug/control # clear it # A B ~A ~B for flg in +T +p "-T #broke here" -p; do echo " $site $flg " > /proc/dynamic_debug/control done; # A B ~B ~A for flg in +T +p "-p #broke here" -T; do echo " $site $flg " > /proc/dynamic_debug/control done } pt_test Fixes: 84da83a6ffc0 dyndbg: combine flags & mask into a struct, simplify with it CC: vincent.whitchurch@axis.com Signed-off-by: Jim Cromie Acked-by: Jason Baron --- .drop @stable, no exposed bug. .add jbaron ack --- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index dd7f56af9aed..a56c1286ffa4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -211,10 +211,11 @@ static int ddebug_change(const struct ddebug_query *query, continue; #ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) + if (!(newflags & _DPRINTK_FLAGS_PRINT)) static_branch_disable(&dp->key.dd_key_true); - } else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + } else if (newflags & _DPRINTK_FLAGS_PRINT) { static_branch_enable(&dp->key.dd_key_true); + } #endif dp->flags = newflags; v4pr_info("changed %s:%d [%s]%s =%s\n", -- 2.37.1