lkml.org 
[lkml]   [2011]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 10/11] dynamic_debug: call apply_pending_queries from ddebug_add_module
On Tue, Jun 28, 2011 at 9:09 AM, Jim Cromie <jim.cromie@gmail.com> wrote:
> +/* apply matching queries in pending-queries list */
> +static void apply_pending_queries(struct ddebug_table *dt)
> +{
> +       struct pending_query *pq, *pqnext;
> +       int nfound;
> +
> +       if (verbose)
> +               pr_info("pending_ct: %d\n", pending_ct);
> +
> +       list_for_each_entry_safe(pq, pqnext, &pending_queries, link) {
> +
> +               if (verbose)
> +                       pr_info("check: %s <-> %s\n",
> +                               dt->mod_name, show_pending_query(pq));
> +
> +               nfound = ddebug_change(&pq->query, pq->flags, pq->mask);
> +
> +               if (nfound) {
> +                       mutex_lock(&ddebug_lock);
> +                       list_del(&pq->link);
> +                       mutex_unlock(&ddebug_lock);
> +                       kfree(pq);
> +                       pending_ct--;
> +               }
> +               else if (verbose)
> +                       pr_info("no-match: %s\n", show_pending_query(pq));
> +       }

The above code doesn't look thread-safe to me. List walking, list
deletion and pending_ct manipulation all should be protected by the
ddebug_lock mutex instead of only list deletion.

Also, why to remove pending entries once a match has been found ? The
resulting behavior will be that when unloading and reloading a kernel
module repeatedly that only the first time a kernel module is loaded
the matching dynamic debug statements in the loaded module will be
enabled.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-07-03 10:41    [W:0.323 / U:1.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site