From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Rupesh Gujare <rupesh.gujare@atmel.com>
Cc: devel@linuxdriverproject.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH 4/4] staging: ozwpan: Create deferred work to destroy PD object.
Date: Thu, 22 Aug 2013 21:45:55 +0400 [thread overview]
Message-ID: <52164E53.9000700@cogentembedded.com> (raw)
In-Reply-To: <1377189531-24950-4-git-send-email-rupesh.gujare@atmel.com>
Hello.
On 08/22/2013 08:38 PM, Rupesh Gujare wrote:
> Currently we call oz_pd_destroy() from softirq context, where we
> try to destroy relevant data structures, as well we kill a tasklet
> which always result in following kernel warning.
> [12279.262194] Attempt to kill tasklet from interrupt
> [12279.262202] Attempt to kill tasklet from interrupt
> This patch defers deallocation of data structures to work queue.
> Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
> ---
> drivers/staging/ozwpan/ozpd.c | 28 +++++++++++++++++++++++-----
> drivers/staging/ozwpan/ozpd.h | 1 +
> 2 files changed, 24 insertions(+), 5 deletions(-)
> diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
> index 2514d79..06004c8 100644
> --- a/drivers/staging/ozwpan/ozpd.c
> +++ b/drivers/staging/ozwpan/ozpd.c
[...]
> @@ -259,6 +257,26 @@ void oz_pd_destroy(struct oz_pd *pd)
> }
>
> /*------------------------------------------------------------------------------
> + * Context: softirq or Process
> + */
> +void oz_pd_destroy(struct oz_pd *pd)
> +{
> + int ret;
> +
> + if (hrtimer_active(&pd->timeout))
> + hrtimer_cancel(&pd->timeout);
> + if (hrtimer_active(&pd->heartbeat))
> + hrtimer_cancel(&pd->heartbeat);
> +
> + memset(&pd->workitem, 0, sizeof(pd->workitem));
> + INIT_WORK(&pd->workitem, oz_pd_free);
Hm, memset(), then INIT_WORK()? Is memset() necessary?
> + ret = schedule_work(&pd->workitem);
> +
Don't think empty line is needed here.
> + if (ret)
> + oz_pd_dbg(pd, ON, "failed to schedule workitem\n");
> +}
> +
> +/*------------------------------------------------------------------------------
> * Context: softirq-serialized
> */
> int oz_services_start(struct oz_pd *pd, u16 apps, int resume)
> diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h
> index 996ef65..12c7129 100644
> --- a/drivers/staging/ozwpan/ozpd.h
> +++ b/drivers/staging/ozwpan/ozpd.h
> @@ -99,6 +99,7 @@ struct oz_pd {
> u8 timeout_type;
> struct tasklet_struct heartbeat_tasklet;
> struct tasklet_struct timeout_tasklet;
> + struct work_struct workitem;
Er, other field names seem aligned, what about this one?
> };
WBR, Sergei
next prev parent reply other threads:[~2013-08-22 17:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 16:38 [PATCH 1/4] ozwpan: staging: Fix crash for race condition Rupesh Gujare
2013-08-22 16:38 ` [PATCH 2/4] staging: ozwpan: Check error condition before creating endpoint Rupesh Gujare
2013-08-22 16:38 ` [PATCH 3/4] staging: ozwpan: Increment reference counter Rupesh Gujare
2013-08-22 16:38 ` [PATCH 4/4] staging: ozwpan: Create deferred work to destroy PD object Rupesh Gujare
2013-08-22 17:45 ` Sergei Shtylyov [this message]
2013-08-23 10:38 ` Rupesh Gujare
2013-08-23 9:05 ` Dan Carpenter
2013-08-23 11:18 ` Rupesh Gujare
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=52164E53.9000700@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rupesh.gujare@atmel.com \
/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
Powered by JetHome