Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4840629ybg; Tue, 29 Oct 2019 13:13:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1eFXukpw3ecW0mbsDiF2wMlFi9T7YZVunKSQzfdkD+O9QVTV9UKzvAf4c1UhZks9jVdsS X-Received: by 2002:aa7:cd5b:: with SMTP id v27mr8621901edw.174.1572380002134; Tue, 29 Oct 2019 13:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572380002; cv=none; d=google.com; s=arc-20160816; b=aF6OuwTKlJQDu/b6TxjMCIAfGWl1mxLpnXHwPHDShJ485dqunDz/I2q9fyaSg65mQm x+O3tiT0GwVCcIlvNqalWQOIuFrLsK/K2i52wFEA2gXkTT7WMYRMXh1Vpa7B4mfCDXZP zyimzjd8B7Gqxd43Y2BdvBFyiE1SMxDYZI60zUXbQmYSH4377dzB/jCcQ2JakVLsvUJr VvD0jvle8A5395VCM1mDdwzphpKKqMPdk4R3jPwcESqr5je5Hx2qnhPEngAKLVzTKOzK ap9Rkt1CCQPB9oAsilsGaXBGvzsUaJvW89qCyBHXECmZgJIBkyjCeqPvwmD7ke+uWv07 bWBg== 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=z4hr0FMxfA+kYkgm3Ro1D5BbnteVX2yo0/0yuGrjRdA=; b=ZFaKwvvz42/XBulv9I7Usw0vIsxiOMDcN7REEWuE+4ZMZTodI3U6P4AflMMm3GXLCJ 7zcHPn7W8HpGocIii0Kylk4PdHjGo1T/b9cvsxMq+TESJZ4w/tI3vbPaEPiawK3wBBxK moxv0RqanrHvGTVKtcG/MpQ+UKkJvH21sJVbrEMZEpC5JY9BxPCb9wzvOD52h1hC7dpN pJB5yvq56DhzvjxKY11MsnA0ySjUVTH8ubL3mhgulVIndTcYfp9111PJB6vj8hzQ4b7z 7vuxOg2BAJXNcjZbHtPQrjwbbjhjKuAb7h777fyIk6WLbdDqYzKygWfq6eARLLEcUDsD wvAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X3sbd4Oe; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d44si11652418ede.149.2019.10.29.13.12.58; Tue, 29 Oct 2019 13:13:22 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=X3sbd4Oe; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729395AbfJ2UBv (ORCPT + 99 others); Tue, 29 Oct 2019 16:01:51 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:45064 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbfJ2UBu (ORCPT ); Tue, 29 Oct 2019 16:01:50 -0400 Received: by mail-io1-f67.google.com with SMTP id s17so9073953iol.12; Tue, 29 Oct 2019 13:01:50 -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:mime-version :content-transfer-encoding; bh=z4hr0FMxfA+kYkgm3Ro1D5BbnteVX2yo0/0yuGrjRdA=; b=X3sbd4OeC6FrppO2Pg9wCkdRUI39oEJdQ5xobYASHaOm4HesmYJUMjOyJAhRipuYJM atctOwga15+8JWc/HVovyN2m62TFr8c5jEo8pc8b1cjjuB2T7HBKX5vF4cmXBAYG/5qZ FBjO+3udauyMc1aui3GghRNXt7a+cDSgmKvtkKR1sUA5JGsC4Yd14iInGkLVZxrQODdS sJWqjwy7So4b5V4D8EwtHaXYS4pzXPXOH/AIT/MlAApxYlnD7SKKQe/8gf6Sik3+ZsKi gRtEGtvbgPnZ7mwyDSYVBk4GPLp5UAlk6ct2pzcWfrUljmTv64jW43tSxmsyda8Q3Roz 5cMQ== 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=z4hr0FMxfA+kYkgm3Ro1D5BbnteVX2yo0/0yuGrjRdA=; b=Py98NmrpLbkQ8lBPy4I+4ILIDdQQFNcis3f9Jqw0j+biZ5BxBBjxoDniWakHJzMZVA KnOo0FRZWTBKCisoGh/qo2CzY6MVgWYIUbGkCWinsjMNy7q1U1H9lqZlV3LoZ387Odq1 eqNzIJUKL6nmBS4VayiHuk9OiXPOxb6pDKtSdNjF9M5SXJpddpR7JGqumK3MmXfhEAO2 PpxXIB0CL6avE5oE+8x4s8i8PHk2nU3fLGN/vBwlnJuMcw5SlWV4WxDUEwt5uTjFSij0 drdWOhyu+btIy/xEFmmfDeUKENpDI+A3bGgVqpXa4FehdU+yp1zJr/vZ+vMWixWxhq1H SbRw== X-Gm-Message-State: APjAAAViX+m/pM01G7w+s0t90Ysb61wX4xXnAMGgwPLBD8Y62I4d3uVW SFSpdCAs1tH6quvjmMH3Rjc= X-Received: by 2002:a6b:5503:: with SMTP id j3mr5643169iob.151.1572379309543; Tue, 29 Oct 2019 13:01:49 -0700 (PDT) Received: from localhost.localdomain (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id l24sm3615ioh.6.2019.10.29.13.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 13:01:48 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org Cc: linux@rasmusvillemoes.dk, greg@kroah.com, Jim Cromie , Jonathan Corbet , Randy Dunlap , linux-doc@vger.kernel.org Subject: [PATCH 16/16] dyndbg: allow inverted-flag-chars in modflags Date: Tue, 29 Oct 2019 14:01:42 -0600 Message-Id: <20191029200143.10421-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.21.0 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 Extend flags modifications to allow [PFMLT_XYZ] inverted flags. This allows control-queries like: #> Q () { echo file inode.c $* > control } # to type less #> Q -P # same as +p #> Q +X # same as -x #> Q xyz-P # same as xyz+p This allows flags in a callsite to be simultaneously set and cleared, while still starting with the current flagstate (with +- ops). Generally, you chose -p or +p 1st, then set or clear flags accordingly. # enable print on callsites with 'xy'; and re-mark with just 'z' #> Q xy+pXYz Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 8 +++++--- lib/dynamic_debug.c | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 5404e23eeac8..493e74a14bdd 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -250,9 +250,11 @@ only callsites with x&y cleared. Flagsets cannot contain ``xX`` etc, a flag cannot be true and false. -modflags containing upper-case flags is reserved/undefined for now. -inverted-flags are currently ignored, usage gets trickier if given -``-pXy``, it should leave x set. +modflags may contain upper-case flags also, using these lets you +invert the flag setting implied by the OP; '-pX' means disable +printing, and mark that callsite with usr-x flag to create a group, +for optional further manipulation. Generally, '+p' and '-p' is your +main choice, and use of inverted flags in modflags is rare. Notes:: diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index f1ff7e30753e..4e14fc588b4d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -474,15 +474,17 @@ static int ddebug_parse_flags(const char *str, /* calculate final mods: flags, mask based upon op */ switch (op) { + unsigned int tmp; case '=': mods->mask = 0; break; case '+': - mods->mask = ~0U; + mods->mask = ~mods->mask; break; case '-': + tmp = mods->mask; mods->mask = ~mods->flags; - mods->flags = 0; + mods->flags = tmp; break; } -- 2.21.0