public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Daniel Wagner <daniel.wagner@oss.bmw-carit.de>
Cc: linux-rt-users@vger.kernel.org,
	Daniel Wagner <daniel.wagner@bmw-carit.de>
Subject: Re: [RFC v1 1/3] work-simple: Simple work queue implemenation
Date: Fri, 13 Feb 2015 13:09:21 +0100	[thread overview]
Message-ID: <20150213120921.GA5482@linutronix.de> (raw)
In-Reply-To: <1405085173-20449-2-git-send-email-daniel.wagner@oss.bmw-carit.de>

* Daniel Wagner | 2014-07-11 15:26:11 [+0200]:

>diff --git a/kernel/sched/work-simple.c b/kernel/sched/work-simple.c
>--- /dev/null
>+++ b/kernel/sched/work-simple.c
>+static int swork_kthread(void *arg)
>+{
>+	struct sworker *sw = arg;
>+	struct swork_event *ev;
>+
>+	pr_info("swork_kthread enter\n");
>+
>+	for (;;) {
>+		swait_event_interruptible(sw->wq,
>+					swork_readable(sw));
>+		if (kthread_should_stop())
>+			break;
>+
>+		raw_spin_lock(&sw->lock);

why not the _irq() suffix?

>+		while (!list_empty(&sw->events)) {
>+			ev = list_first_entry(&sw->events,
>+					struct swork_event, list);
>+			list_del_init(&ev->list);
>+
>+			raw_spin_unlock(&sw->lock);
>+
>+			ev->func(ev);
>+			xchg(&ev->flags, 0);

I've been looking at this for a while and this won't work in longterm.
Why do you bother using xchg if you don't look at the return value?
Also, you need to clear that flag _before_ invoking ->func() because
while that function is beeing executed someone might do another
queue_work() and expects that that work item invoked again. Atleast this
is how queue_work() behaves and I would want the same here.

But don't worry. I fix this up to me needs so there is nothing you need
to worry about. The remaining part is simple. Thanks.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-02-13 12:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 13:26 [RFC v1 0/3] Add simple work framework Daniel Wagner
2014-07-11 13:26 ` [RFC v1 1/3] work-simple: Simple work queue implemenation Daniel Wagner
2015-02-13 12:09   ` Sebastian Andrzej Siewior [this message]
2015-02-16  6:45     ` Daniel Wagner
2014-07-11 13:26 ` [RFC v1 2/3] x86/mce: Defer mce wakeups to threads for PREEMPT_RT Daniel Wagner
2014-07-11 13:26 ` [RFC v1 3/3] thermal: Defer thermal wakups to threads Daniel Wagner

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=20150213120921.GA5482@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=daniel.wagner@oss.bmw-carit.de \
    --cc=linux-rt-users@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