public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	joerg.roedel@amd.com
Subject: Re: [PATCH 1/4] dma-debug: add variables and checks for driver filter
Date: Mon, 1 Jun 2009 14:55:02 -0700	[thread overview]
Message-ID: <20090601145502.0653f979.akpm@linux-foundation.org> (raw)
In-Reply-To: <1243523971-12681-2-git-send-email-joerg.roedel@amd.com>

On Thu, 28 May 2009 17:19:28 +0200
Joerg Roedel <joerg.roedel@amd.com> wrote:

> This patch adds the state variables for the driver filter and a function
> to check if the filter is enabled and matches to the current device. The
> check is built into the err_printk function.
> 

The path by which lib/dma-debug.c patches get into mainline seems to
be largely random.  Is it a dwmw2 tree?  An Ingo tree?  A Joerg tree? -mm?


> @@ -128,9 +137,47 @@ static inline void dump_entry_trace(struct dma_debug_entry *entry)
>  #endif
>  }
>  
> +static inline bool driver_filter(struct device *dev)
> +{
> +	/* driver filter off */
> +	if (likely(!current_driver_name[0]))
> +		return true;
> +
> +	/* driver filter on and initialized */
> +	if (current_driver && dev->driver == current_driver)
> +		return true;
> +
> +	/* driver filter on but not yet initialized */
> +	if (!current_driver && current_driver_name[0]) {
> +		struct device_driver *drv = get_driver(dev->driver);
> +		unsigned long flags;
> +		bool ret = false;
> +
> +		if (!drv)
> +			return false;
> +
> +		/* lock to protect against change of current_driver_name */
> +		read_lock_irqsave(&driver_name_lock, flags);
> +
> +		if (drv->name &&
> +		    strncmp(current_driver_name, drv->name, 63) == 0) {
> +			current_driver = drv;
> +			ret = true;
> +		}
> +
> +		read_unlock_irqrestore(&driver_name_lock, flags);
> +		put_driver(drv);
> +
> +		return ret;
> +	}
> +
> +	return false;
> +}
> +
>  #define err_printk(dev, entry, format, arg...) do {		\
>  		error_count += 1;				\
> -		if (show_all_errors || show_num_errors > 0) {	\
> +		if (driver_filter(dev) &&			\
> +		    (show_all_errors || show_num_errors > 0)) {	\
>  			WARN(1, "%s %s: " format,		\
>  			     dev_driver_string(dev),		\
>  			     dev_name(dev) , ## arg);		\

The patch attempts to inline the very large driver_filter() into every
err_printk() callsite.  That's not at all desirable!


  reply	other threads:[~2009-06-01 21:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 15:19 [PATCH 0/4] dma-debug: driver filter Joerg Roedel
2009-05-28 15:19 ` [PATCH 1/4] dma-debug: add variables and checks for " Joerg Roedel
2009-06-01 21:55   ` Andrew Morton [this message]
2009-06-02  8:27     ` Joerg Roedel
2009-05-28 15:19 ` [PATCH 2/4] dma-debug: add debugfs file " Joerg Roedel
2009-06-01 22:04   ` Andrew Morton
2009-06-02  8:55     ` Joerg Roedel
2009-06-02 13:33     ` Joerg Roedel
2009-05-28 15:19 ` [PATCH 3/4] dma-debug: add dma_debug_driver kernel command line Joerg Roedel
2009-06-01 22:08   ` Andrew Morton
2009-06-02  8:57     ` Joerg Roedel
2009-05-28 15:19 ` [PATCH 4/4] dma-debug: add documentation for the driver filter Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2009-06-02 14:36 [PATCH 0/4] dma-debug: driver filter v2 Joerg Roedel
2009-06-02 14:36 ` [PATCH 1/4] dma-debug: add variables and checks for driver filter Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090601145502.0653f979.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox