linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl patch 3/4] query_fw_finish_status: get rid of redundant variable
Date: Mon, 28 Oct 2019 17:28:06 -0400	[thread overview]
Message-ID: <x49zhhk36hl.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20191028211338.GA9826@iweiny-DESK2.sc.intel.com> (Ira Weiny's message of "Mon, 28 Oct 2019 14:13:39 -0700")

Ira Weiny <ira.weiny@intel.com> writes:

> On Mon, Oct 28, 2019 at 03:37:48PM -0400, Jeff Moyer wrote:
>> Ira Weiny <ira.weiny@intel.com> writes:
>> 
>> >> (Watching the unit test run fall into an infinite loop..) Nope, the
>> >> break is in the switch scope, the while loop needs the 'goto out'.
>> >> 
>> >> Yes this bit definitely needs to be refactored :)
>> >
>> > How about this patch instead?  Untested.
>> 
>> I'm not a fan of the looping with gotos.
>
> Me either... But... the logic here is not the same.
>
>>
>> I think separating out the
>> waiting for busy to its own function would make this more clear.
>> Looking more closely, there are other issues.  The timeout code looks at
>> the seconds, but ignores the fractions, so you could be off by almost an
>> entire second, there.
>
> For this operation that is probably not a big deal.  We should be waiting much
> longer than the operation should take anyway.
>
>>
>> It also doens't retry the sleep if interrupted.
>
> This could be an issue.
>
>> Finally, I find the variables names to be highly confusing.
>> 
>> I've decided not to fix those last two bugs just yet, but here's a patch
>> that shows the dirction I think it should go.  Compile-tested only for
>> now.  Let me know what you think.
>
> I thought about doing something similar but to make the logic the same it
> becomes a bit awkward.

[...]

>> +	wait_for_cmd_completion(cmd, fw, &start);
>
> wait_for_cmd_completion() does not call ndctl_cmd_submit()
>
> Now I find it odd that we need to resubmit the command but I assume the logic
> is correct.  Therefore we need to go back and call ndctl_cmd_submit() again.
>
> Or is this not required?

Ah.  Stupid mistake.  Yes, it definitely looks like the status query
command needs to be resubmitted, and that's the whole point of the
timeout between calls.  You can't ask too often.  ;-)

> anyway that is why I went ahead and used the goto...

I'll take another look.  Thanks for pointing out that obvious thinko.

-Jeff
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  reply	other threads:[~2019-10-28 21:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 20:22 [ndctl patch 0/4] misc. cleanups Jeff Moyer
2019-10-18 20:22 ` [ndctl patch 1/4] util/abspath: cleanup prefix_filename Jeff Moyer
2019-10-18 20:55   ` Ira Weiny
2019-10-18 20:23 ` [ndctl patch 2/4] fix building of tags tables Jeff Moyer
2019-10-18 20:56   ` Ira Weiny
2019-10-18 20:23 ` [ndctl patch 3/4] query_fw_finish_status: get rid of redundant variable Jeff Moyer
2019-10-18 20:54   ` Ira Weiny
2019-10-18 21:06     ` Jeff Moyer
2019-10-18 22:49       ` Ira Weiny
2019-10-21 17:11         ` Verma, Vishal L
2019-10-23 22:28       ` Verma, Vishal L
2019-10-23 22:51         ` Verma, Vishal L
2019-10-25 22:21           ` Ira Weiny
2019-10-25 23:51             ` Verma, Vishal L
2019-10-28 19:37             ` Jeff Moyer
2019-10-28 21:13               ` Ira Weiny
2019-10-28 21:28                 ` Jeff Moyer [this message]
2019-10-28 22:12                 ` Jeff Moyer
2019-10-29 16:15                   ` Ira Weiny
2019-10-18 20:23 ` [ndctl patch 4/4] load-keys: get rid of duplicate assignment Jeff Moyer
2019-10-18 20:57   ` Ira Weiny

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=x49zhhk36hl.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-nvdimm@lists.01.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;
as well as URLs for NNTP newsgroup(s).