From: Mike Christie <mchristi@redhat.com>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH] scsi: tcmu: setup one timeout timer for each cmd
Date: Tue, 18 Sep 2018 16:42:31 +0000 [thread overview]
Message-ID: <5BA12AF7.7090004@redhat.com> (raw)
In-Reply-To: <20180918103255.15209-1-xiubli@redhat.com>
On 09/18/2018 05:32 AM, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> Currently there has one cmd timeout timer for each udev, and whenever
> there has any new coming cmd it will update the timer. And for some
> corner case the timer is always working only for the ringbuffer's
> newest cmd. That's to say the timer won't be fired even there has one
> cmd stuck for a very long time.
>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> drivers/target/target_core_user.c | 69 +++++++++++++++----------------
> 1 file changed, 34 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 9cd404acdb82..ed3d6f055037 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -157,7 +157,6 @@ struct tcmu_dev {
>
> struct idr commands;
>
> - struct timer_list cmd_timer;
> unsigned int cmd_time_out;
>
> struct timer_list qfull_timer;
> @@ -190,6 +189,7 @@ struct tcmu_cmd {
> uint32_t *dbi;
>
> unsigned long deadline;
> + struct timer_list cmd_timer;
>
I think you can fix this for qfull at the same time and we will not have
to do a mix of per cmd timer along with per device handling.
In tcmu_check_expired_cmd/check_timedout_devices add a next_deadline
variable and when we loop over all the cmds with the idr_for_each have
tcmu_check_expired_cmd return the cmd->deadline. check_timedout_devices
will then track the next timeout value to use and do a mod_timer to set it.
In tcmu_setup_cmd_timer you would only mod_timer if the timer is not
already pending already, so we do not keep resetting it like we do today.
next prev parent reply other threads:[~2018-09-18 16:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 10:32 [PATCH] scsi: tcmu: setup one timeout timer for each cmd xiubli
2018-09-18 16:42 ` Mike Christie [this message]
2018-09-19 3:04 ` Xiubo Li
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=5BA12AF7.7090004@redhat.com \
--to=mchristi@redhat.com \
--cc=target-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.