Messages in this thread | | | From | Bart Van Assche <> | Date | Sun, 3 Jul 2011 10:37:59 +0200 | Subject | Re: [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/
| |