qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v16 07/16] hw/ptimer: Add "continuous trigger" policy
Date: Wed, 21 Sep 2016 00:06:32 +0300	[thread overview]
Message-ID: <daf3308b-729c-5cf8-7a41-0aed37df3168@gmail.com> (raw)
In-Reply-To: <CAFEAcA_QoFRgBvHTJzpVERJ2y_EiT=w483ep5atbe604U2WByQ@mail.gmail.com>

On 20.09.2016 20:21, Peter Maydell wrote:
> On 7 September 2016 at 14:22, Dmitry Osipenko <digetx@gmail.com> wrote:
>> Currently, periodic timer that has load = delta = 0 performs trigger
>> on timer reload and stops, printing a "period zero" error message.
>> Introduce new policy that makes periodic timer to continuously trigger
>> with a period interval in case of load = 0.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  hw/core/ptimer.c    | 18 +++++++++++++++++-
>>  include/hw/ptimer.h |  4 ++++
>>  2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
>> index e9b2e15..97ce8ae 100644
>> --- a/hw/core/ptimer.c
>> +++ b/hw/core/ptimer.c
>> @@ -45,7 +45,8 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
>>          ptimer_trigger(s);
>>          delta = s->delta = s->limit;
>>      }
>> -    if (delta == 0 || s->period == 0) {
>> +
>> +    if (s->period == 0) {
>>          if (!qtest_enabled()) {
>>              fprintf(stderr, "Timer with period zero, disabling\n");
>>          }
>> @@ -58,6 +59,21 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
>>          delta += delta_adjust;
>>      }
>>
>> +    if (delta == 0 && (s->policy_mask & PTIMER_POLICY_CONTINUOUS_TRIGGER)) {
>> +        if (s->enabled == 1) {
>> +            delta = 1;
>> +        }
>> +    }
>> +
>> +    if (delta == 0) {
>> +        if (!qtest_enabled()) {
>> +            fprintf(stderr, "Timer with delta zero, disabling\n");
>> +        }
>> +        timer_del(s->timer);
>> +        s->enabled = 0;
>> +        return;
>> +    }
>> +
> 
> Again, this looks like it's affecting behaviour even when the
> policy flag isn't set.
> 

No, the old behaviour is "to error out" when the delta = 0 and it's still the
same with this patch applied. This patch splits the "(delta == 0 || s->period ==
0)" check, so it won't error out if delta was changed to 1 in case of the
"continuous trigger" policy being used.

-- 
Dmitry

  reply	other threads:[~2016-09-20 21:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 13:22 [Qemu-devel] [PATCH v16 00/16] PTimer fixes/features and ARM MPTimer conversion Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 01/16] hw/ptimer: Actually stop the timer in case of error Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 02/16] hw/ptimer: Introduce timer policy feature Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 03/16] tests: Add ptimer tests Dmitry Osipenko
2016-09-07 21:32   ` Eric Blake
2016-09-07 22:32     ` Dmitry Osipenko
2016-09-07 23:04       ` Peter Maydell
2016-09-07 23:25         ` Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 04/16] hw/ptimer: Suppress error messages under qtest Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 05/16] hw/ptimer: Add "wraparound after one period" policy Dmitry Osipenko
2016-09-20 17:20   ` Peter Maydell
2016-09-20 20:57     ` Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 06/16] tests: ptimer: Add tests for " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 07/16] hw/ptimer: Add "continuous trigger" policy Dmitry Osipenko
2016-09-20 17:21   ` Peter Maydell
2016-09-20 21:06     ` Dmitry Osipenko [this message]
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 08/16] tests: ptimer: Add tests for " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 09/16] hw/ptimer: Add "no immediate " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 10/16] tests: ptimer: Add tests for " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 11/16] hw/ptimer: Add "no immediate reload" policy Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 12/16] tests: ptimer: Add tests for " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 13/16] hw/ptimer: Add "no counter round down" policy Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 14/16] tests: ptimer: Add tests for " Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 15/16] arm_mptimer: Convert to use ptimer Dmitry Osipenko
2016-09-07 13:22 ` [Qemu-devel] [PATCH v16 16/16] tests: Add tests for the ARM MPTimer Dmitry Osipenko
2016-09-20 17:25 ` [Qemu-devel] [PATCH v16 00/16] PTimer fixes/features and ARM MPTimer conversion Peter Maydell

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=daf3308b-729c-5cf8-7a41-0aed37df3168@gmail.com \
    --to=digetx@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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).