Re: [PATCH] hw/ptimer: Assert next_event is newer than last_event

2019-09-23 Thread Philippe Mathieu-Daudé
On 9/23/19 5:08 PM, Peter Maydell wrote: > On Mon, 23 Sep 2019 at 15:54, Philippe Mathieu-Daudé > wrote: >> >> On 9/23/19 4:40 PM, Peter Maydell wrote: >>> On Sat, 21 Sep 2019 at 11:17, Philippe Mathieu-Daudé >>> wrote: If the period is too big, the 'delta * period' product result >>>

Re: [PATCH] hw/ptimer: Assert next_event is newer than last_event

2019-09-23 Thread Peter Maydell
On Mon, 23 Sep 2019 at 15:54, Philippe Mathieu-Daudé wrote: > > On 9/23/19 4:40 PM, Peter Maydell wrote: > > On Sat, 21 Sep 2019 at 11:17, Philippe Mathieu-Daudé > > wrote: > >> > >> If the period is too big, the 'delta * period' product result > >> might overflow, resulting in a negative number

Re: [PATCH] hw/ptimer: Assert next_event is newer than last_event

2019-09-23 Thread Philippe Mathieu-Daudé
On 9/23/19 4:40 PM, Peter Maydell wrote: > On Sat, 21 Sep 2019 at 11:17, Philippe Mathieu-Daudé > wrote: >> >> If the period is too big, the 'delta * period' product result >> might overflow, resulting in a negative number, then the >> next_event ends before the last_event. This is buggy, as ther

Re: [PATCH] hw/ptimer: Assert next_event is newer than last_event

2019-09-23 Thread Peter Maydell
On Sat, 21 Sep 2019 at 11:17, Philippe Mathieu-Daudé wrote: > > If the period is too big, the 'delta * period' product result > might overflow, resulting in a negative number, then the > next_event ends before the last_event. This is buggy, as there > is no forward progress. Assert this can not ha

[PATCH] hw/ptimer: Assert next_event is newer than last_event

2019-09-21 Thread Philippe Mathieu-Daudé
If the period is too big, the 'delta * period' product result might overflow, resulting in a negative number, then the next_event ends before the last_event. This is buggy, as there is no forward progress. Assert this can not happen. Signed-off-by: Philippe Mathieu-Daudé --- hw/core/ptimer.c | 3