Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp800822ybg; Wed, 10 Jun 2020 14:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGsNzN+MM6Yq7v3aZ7rRUdkFAQY+wjYqtE32BJHev/5ZPIImrhGe/Bg9cSn0/t/Ml87LZh X-Received: by 2002:a17:906:b845:: with SMTP id ga5mr5249331ejb.300.1591823544781; Wed, 10 Jun 2020 14:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591823544; cv=none; d=google.com; s=arc-20160816; b=KAfx4QjhNKgKsjSrWbQyPDYCPCI+JooxLdt323pbvdmGX3fX3yzRQCUpdypuRtDF8J vgZ7CXUfHAY+vrG0ufM3BpmyR+nKJO7Se29Gdh6AmlC1Kc/Q0rxLAy5gEHIfI4CE5G/q /nalnGBjKL+/KsFZLEujSRkULf7Y0xpadgNSCL6LGns7oScWyamUh9H/drwy0LONc1d0 HdAn8X91hbuxOJrm/xTnA9aGEfC+Ob6t0Bd/0NMSaLrnMKZofxCqz9LLpYFNuvjK1QQi sr+LJmhDn7xIL/7NxFcM6L8yht6Ik+49+XAs1OkwtNDs039vYXhh3/eVOaSMrL6pSSOW mQNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GGyy3CO8by6rtbdLVnfCEmk/inhvOgbRGBcLBUPWXjg=; b=LOrrw9F7LgT9LOpARKP5Az0zNEtyI6+7Y8Dn8qJJaYIKiD9ACmVcSykHxfrhXPhr4e v1KVY09XG8Gn2hivSVhCp7khWEphOosRDuqtyZn9rxw6LGttH60eYEYBcnxsQMDaaAhQ t4+fJqNgmHfiZF/oY0N/uiVPX68VqF9nN70yj40XhfoXQgsB2BPObaZ2+5vmEUKP4/yP u8WplMlTe+Mzby3vwPpvlsXHw2S3ZQBbopbufYFBehexIA65KR7Z+PEC0MgHIYPwia4H uS8CG4hgQT/ItgqmOCn/VVFCvAXSVUxBPTMEtNk5jLhHVVGvj42XmYSxrWEs23k/AavD mmaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZynGCI6U; 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 f12si726734ejt.70.2020.06.10.14.12.01; Wed, 10 Jun 2020 14:12: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=ZynGCI6U; 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 S1729017AbgFJSdL (ORCPT + 99 others); Wed, 10 Jun 2020 14:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727078AbgFJSdK (ORCPT ); Wed, 10 Jun 2020 14:33:10 -0400 Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B262C03E96B for ; Wed, 10 Jun 2020 11:33:10 -0700 (PDT) Received: by mail-ua1-x942.google.com with SMTP id c9so1192676uao.11 for ; Wed, 10 Jun 2020 11:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GGyy3CO8by6rtbdLVnfCEmk/inhvOgbRGBcLBUPWXjg=; b=ZynGCI6UZvGi1T1Lo6Nhhh/Zb77Vo/06xc1iPkoeYqXl0v0Divn5OlgSdLmC6cakks TUR3Or9Ci3LXrrFic5hJx/o/z5pjQpdczHomgInozaiU4IHEisKNQC11phbUeU3tqzgV lAJMasMquH4aaO7yUyEVXShGcrMXqxjfhVtJ5lIITOFReXXc1XBcwMR/uGxmjiMvaSwm ErKreBlPKYGUD3GmhVDhWYWlg15Fws6LfXe9DvNGNMdgq7IbQDbzaEBVgsy+W0l2wQhO oLbnFWWODYz/0PMb8vGiCWi2Z3LIeemf5QCuk5n/m5KdNJCPp9dOVNf7r9Xab2b4hEWV ixJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GGyy3CO8by6rtbdLVnfCEmk/inhvOgbRGBcLBUPWXjg=; b=E7oWs2dj49ZP05VZeF/5FqR2R+XTILr5Ok5HfTk21v2XSUeDEDi5rpxQMBNlve7BPQ p6ec1ZHq+S/Lyqyrri0iHpsnqNwCxbS6C2F0jou45wUNXXrsGSS1aV1duyGeFNTZiMTg LGqYFjCzpBpcztIauapo+GzLsC/UTMUAyIw+dDBjwm/V5ALH5uSheI/h6ylpz9iIKkdz uCAHDqvwNaoyJFncWNRdjiEix9Mw2EOuopdQE62PqBi1fJmPOYTKTCR7Akdr/5KLhNri iHT1gkbMVWYY90884ekB+kTz2nQ1Luy0BGgJ/pcnDobPsh8BNw/e3DI7j+2XmjnU8usK 9d+A== X-Gm-Message-State: AOAM531rSxKZcr+kiMPWyjDGUFMt8HjWWcOJf9CnkbHBxhY7D81w9LOt yNgxg20bxjbFB/iIw8PfBWJ4PkgS1TZWcXMX4vk= X-Received: by 2002:a9f:31cb:: with SMTP id w11mr3631980uad.128.1591813988984; Wed, 10 Jun 2020 11:33:08 -0700 (PDT) MIME-Version: 1.0 References: <20200609104604.1594-1-stanimir.varbanov@linaro.org> <20200609104604.1594-7-stanimir.varbanov@linaro.org> In-Reply-To: <20200609104604.1594-7-stanimir.varbanov@linaro.org> From: jim.cromie@gmail.com Date: Wed, 10 Jun 2020 12:32:42 -0600 Message-ID: Subject: WIP generic module->debug_flags and dynamic_debug To: Stanimir Varbanov , Rasmus Villemoes , Joe Perches Cc: LKML , Greg Kroah-Hartman , Jason Baron , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org so Ive got a WIP / broken / partial approach to giving all modules a u32 flagset, and enabling pr_debug based upon it. I leave out the "pr_debug_typed( bitpos )" for now. For Stanimir, bits 1,2,3 could be high, middle, low. ATM its broken on my lack of container_of() skills. Im trying to use it to get a struct module* using its name value thats been copied into a ddebug_table member. Im relying on cdf6d006968 dynamic_debug: don't duplicate modname in ddebug_add_module to have the same value in both structs but Im clearly missing a few things besides the likely future trouble with .rodata builtin modules (after compile prob solved) It seems container_of wants me to use struct ddebug_table instead, but I dont want a *ddebug_table. Ive blindly guessed at adding & and * to 1st param, w/o understanding. can anyone diagnose my problem ? [jimc@frodo build-virtme]$ git diff diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a5d76f8f6b40..2bfd1aa083b3 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -20,6 +20,7 @@ struct _ddebug { const char *function; const char *filename; const char *format; + u32 reqd_flags; /*misleading name todo, probly should hold just a single type-bit */ unsigned int lineno:18; /* * The flags field controls the behaviour at the callsite. diff --git a/include/linux/module.h b/include/linux/module.h index 1ad393e62bef..06eeef438fd3 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -429,6 +429,7 @@ struct module { struct mod_arch_specific arch; unsigned long taints; /* same bits as kernel:taint_flags */ + u32 debugflags; #ifdef CONFIG_GENERIC_BUG /* Support for BUG */ diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 63ae6f77a0e4..965ee96630b5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -202,6 +202,20 @@ static int ddebug_change(const struct ddebug_query *query, if ((~dp->flags & filter->mask) != filter->mask) continue; + /* screen on module->debugflags */ + if (query->module) { + /* dt->modname is known == module->name */ + struct module *m = + container_of((&(dt->mod_name)), + struct module, name); + if (m->debugflags && + ((m->debugflags & dp->reqd_flags) + != dp->reqd_flags)) + continue; + vpr_info("%s module-debugflags: 0x%x\n", + dt->mod_name, dp->reqd_flags); + } + nfound++; newflags = (dp->flags & mods->mask) | mods->flags; (END)