Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp619624ybt; Wed, 17 Jun 2020 09:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJUErgNGEE/B418AWmDgQliyO2l5tFP8wRkpGS7qdtaNum7AP28nyLibitf+2AUBCJmnE/ X-Received: by 2002:a05:6402:312a:: with SMTP id dd10mr11652edb.320.1592411537127; Wed, 17 Jun 2020 09:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592411537; cv=none; d=google.com; s=arc-20160816; b=rhYOw1Xr0WN/VVlY1lLSlEG3KVXzEOGgfUc02JPPWBYtNfeF3djoo1mQ4NnKSkxWVE h4FEcLTBXgrXTfmSblY3BVLS0165qMN0hSXOjfnJ5nq7kP1Zch1Nk9h2x1hTKV3k5JeJ pXIcPiePgfzVHTBgNn17MyGvpdvFmbcY6OFA0YRG/SCEFfEEkL3qJCaoxU+sT/wxIePr F3eOWAIfmP/4M8kjPLhBogaUHiB0pY7Nw/t/W96ZevbJ+UaO8Cc0YFogMR3XDsEsO1PZ Acg232CLQHSuxwNl2LLWvdA75bzbXBzTJzCfkRcK8VlfcvXYaiq3HTzGwN/LqURVnHK0 kpGA== 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=dk3pc8AeI0c3+wdEYp+hTZYx+ewWTm/IvoUeIkfxAsE=; b=oyFQ1A9drltzGTLqDw7JU46wF7FhbU566k23E1dfTxCcvb8DhAhhYegaKv/+w5pjmI K7pj6UwuNSBOcH6DNA8FJDHNZcJFERSP+ebvQSHyRdBfTfCK++J8+gZx/EjyIFxclzhC TA7KxlptGTu/JwfO7lRKzFV8c0WPYwVDJahb8ta+mhdhI6v1lxZ/9AEbP4Gjw6+blZZJ Z1qRwwDyhnr8UtCxA9q8ZYyHESw27TSGcgPM9wFPuRdROM/S9bqgRkrhKMUSLnZEvfG1 jDSExwS5mBBPN/DEifKfe6tJUzjOa0bv0uXIGKzPaXptat7Xkt55uhdmdaxhq27BT3tU vrXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nG+nuav8; 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 j7si221015ejb.289.2020.06.17.09.31.53; Wed, 17 Jun 2020 09:32:17 -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=nG+nuav8; 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 S1727844AbgFQQ1T (ORCPT + 99 others); Wed, 17 Jun 2020 12:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbgFQQ01 (ORCPT ); Wed, 17 Jun 2020 12:26:27 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14831C0613ED for ; Wed, 17 Jun 2020 09:26:27 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id v13so2103016otp.4 for ; Wed, 17 Jun 2020 09:26:27 -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=dk3pc8AeI0c3+wdEYp+hTZYx+ewWTm/IvoUeIkfxAsE=; b=nG+nuav8Qw6xBb23T2t9tWvMzUDdAcso2xuwHW3zG0/KAAmHHffC3dgtlW/jK5H5uF 0H0WW5/lFA1J7jQj3qZdLWZ2KdkqtAwzezF0+L2hzmt09jTWp7KUh+ErbuHgZuoClKPD w2DtAj8nf4hugN5yM9ABahO9fYEBM9Rm91W8jv2xKbf7bmDrGQobDUqNUb4rOqMRK7kr vVE9yYZvDHZ5/v3+nNJZl7Z1OGocZOsNsuiQZYIZtlLYlaZ1QoOTS8ueNFVPsjNVkvwa Q0Mopc4NZp4Tl4GMOFhoo1FKCm7Dg61wb5h4DqGsFR8s6LiDlGchJICrYcDdR/RQYqlC vnJw== 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=dk3pc8AeI0c3+wdEYp+hTZYx+ewWTm/IvoUeIkfxAsE=; b=PQYYCqSl+zT2rXHEk6JceaWw0BHyIDLr/10wGiewYn8x4BXY9KqGoS/Dgv5v1gLst1 EPvAXjN9qY76s6rAY5zHDhKYin1XkCu89LfJIvzMp+r7FVxf/LBky7uGiqtIRpFWhLRZ Zz2RF8s7SDLcn4pTQ1UW/avtIINXTKyc14tib8r7cOy7Mvboffai1dXbqcXCXLapD5py iFcK1NRmlVBnhvMhPixWvmDwIhq5WkoQusMpkfiMGKGeU16br79QoJ3uNU4IZxAzhN9I LfyLZXudM32ovNmGIXKjhwkHQymZVHN462WtKgv9l4u+A5QwinhQmhQg2h7qSdDDqChP w9Sg== X-Gm-Message-State: AOAM5329ZApPTXMZVCjiaZ+iuXSjGm9SxHLzkrwhbFRGCrDtTALn0bHU S5NDMYJtY6hh2KFuchNrsJY= X-Received: by 2002:a9d:2de6:: with SMTP id g93mr7924661otb.28.1592411186443; Wed, 17 Jun 2020 09:26:26 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::ae4b]) by smtp.googlemail.com with ESMTPSA id h7sm95877otk.48.2020.06.17.09.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 09:26:25 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH v3 15/21] dyndbg: export ddebug_exec_queries Date: Wed, 17 Jun 2020 10:25:30 -0600 Message-Id: <20200617162536.611386-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617162536.611386-1-jim.cromie@gmail.com> References: <20200617162536.611386-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 Exporting ddebug_exec_queries will allow module authors using dynamic debug to actually control/enable/disable their own pr-debug callsites dynamically. With it, module authors can tie any update of their internal debug variables to a corresponding ddebug_exec_queries invocation, which will modify all their selected callsites accordingly. Generally, authors would exec +p or -p on some subsets of their set of callsites, and leave fmlt flags for user to choose the appropriate amount of structural context desired in the logs. Depending upon the user needs, the module might be known, and therefore a waste of screen width, function would be valuable, file would be long and familiar to the author, etc.. That said, author could harness the message-prefix facility if they saw fit to do so. Any author preferences can be overridden with echo >control Is it safe ? ddebug_exec_queries() is currently 'exposed' to user space in several limited ways; 1 it is called from module-load callback, where it implements the $modname.dyndbg=+p "fake" parameter provided to all modules. 2 it handles query input from >control directly IOW, it is "fully" exposed to local root user; exposing the same functionality to other kernel modules is no additional risk. The other big issue to check is locking: dyndbg has a single mutex, taken by ddebug_change to handle >control, and by ddebug_proc_(start|stop) to span `cat control`. ISTM this proposed export presents no locking problems. drm use case: drm.debug=0x03 appears to be a kernel boot-arg example, setting 2 internal debug flags. Each bit is probably controlling a separate subset of all debug-prints, they may be overlapping subsets. Those subsets are *definitely* expressible as a few dyndbg queries each. Any arbitrary subset is. drm.dyndbg='file drm_gem_* +p' # gem debug drm.dyndbg='file *_gem_* +p' # *gem debug With this proposed export, drm authors could exec these examples, most likely in the callback that handles updates to the drm.debug variable. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e1dd96178f18..ff97938b5849 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -547,6 +547,7 @@ static int ddebug_exec_queries(char *query, const char *modname) return exitcode; return nfound; } +EXPORT_SYMBOL(ddebug_exec_queries); #define PREFIX_SIZE 64 -- 2.26.2