[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 09/21] block: Add average I/O queue depth to
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v3 09/21] block: Add average I/O queue depth to BlockDeviceTimedStats |
Date: |
Fri, 23 Oct 2015 15:47:52 +0200 |
User-agent: |
Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) |
On Fri 23 Oct 2015 03:31:38 PM CEST, Stefan Hajnoczi <address@hidden> wrote:
>> +uint64_t timed_average_sum(TimedAverage *ta, uint64_t *elapsed)
>> +{
>> + TimedAverageWindow *w;
>> + check_expirations(ta);
>> + w = current_window(ta);
>> + if (elapsed != NULL) {
>> + int64_t remaining = w->expiration -
>> qemu_clock_get_ns(ta->clock_type);
>> + *elapsed = ta->period - remaining;
>
> There is no guarantee that qemu_clock_get_ns(ta->clock_type) executes
> quickly after check_expirations(ta). If the system is under heavy load
> and swapping, maybe significant amounts of time have passed. This race
> condition could result in bad elapsed values being calculated.
>
> We need to be careful about elapsed <= 0 values, especially if the
> caller divides by elapsed and is exposed to Divide By 0 exceptions.
>
> Either check_expirations() needs to integrate qemu_clock_get_ns() or we
> simply need to deal with bogus values here.
Good catch, thanks!
I think having check_expirations() return the time is probably the best
option.
Berto
- [Qemu-devel] [PATCH v3 07/21] block: Allow configuring whether to account failed and invalid ops, (continued)
- [Qemu-devel] [PATCH v3 07/21] block: Allow configuring whether to account failed and invalid ops, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 08/21] block: Compute minimum, maximum and average I/O latencies, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 02/21] ide: Account for write operations correctly, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 03/21] block: define 'clock_type' for the accounting code, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 06/21] block: Add statistics for failed and invalid I/O operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 05/21] block: Add idle_time_ns to BlockDeviceStats, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 04/21] util: Infrastructure for computing recent averages, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 09/21] block: Add average I/O queue depth to BlockDeviceTimedStats, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 21/21] block: Update copyright of the accounting code, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 12/21] block: Use QEMU_CLOCK_VIRTUAL for the accounting code in qtest mode, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 15/21] virtio-blk: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 19/21] macio: Account for failed operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 14/21] nvme: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 18/21] ide: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 17/21] atapi: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 11/21] qemu-io: Account for failed, invalid and flush operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 20/21] scsi-disk: Account for failed operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 13/21] iotests: Add test for the block device statistics, Alberto Garcia, 2015/10/22