All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01
@ 2017-06-01 17:07 Paolo Bonzini
  2017-06-01 17:07 ` [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-06-01 17:07 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 56821559f0ba682fe6b367815572e6f974d329ab:

  Merge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging (2017-05-18 13:36:15 +0100)

are available in the git repository at:

  git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to f3c3ad2dc98c6610152355f6a4de1445efc87421:

  cpus: reset throttle_thread_scheduled after sleep (2017-06-01 18:01:05 +0200)

----------------------------------------------------------------
* virtio-scsi use-after-free fix (Fam)
* vhost-user-scsi support (Felipe)
* SMM fixes and improvements for TCG (myself, Mihail)
* irqchip and AddressSpaceDispatch cleanups and fixes (Peter)
* Coverity fix (Stefano)
* NBD cleanups and fixes (Vladimir, Eric, myself)
* RTC accuracy improvements and code cleanups (Guangrong+Yunfang)
* socket error reporting improvement (Daniel)
* GDB XML description for SSE registers (Abdallah)
* kvmclock update fix (Denis)
* SMM memory savings (Gonglei)
* -cpu 486 fix (Paolo)
* various bugfixes (Roman, Peter, myself, Thomas)
* rtc-test improvement (Guangrong)
* migration throttling fix (Felipe)

----------------------------------------------------------------

Fixed patchew build failure, added another patch.

Abdallah Bouassida (1):
      target/i386: Add GDB XML description for SSE registers

Daniel P. Berrange (1):
      sockets: improve error reporting if UNIX socket path is too long

Denis Plotnikov (1):
      kvmclock: update system_time_msr address forcibly

Eric Blake (1):
      nbd: Fully initialize client in case of failed negotiation

Fam Zheng (1):
      virtio-scsi: Unset hotplug handler when unrealize

Felipe Franciosi (3):
      vhost-user-scsi: Introduce vhost-user-scsi host device
      vhost-user-scsi: Introduce a vhost-user-scsi sample application
      cpus: reset throttle_thread_scheduled after sleep

Gonglei (1):
      kvm: don't register smram_listener when smm is off

Mihail Abakumov (1):
      i386: fix read/write cr with icount option

Paolo Bonzini (5):
      target/i386: enable A20 automatically in system management mode
      target/i386: use multiple CPU AddressSpaces
      linuxboot_dma: compile for i486
      edu: fix memory leak on msi_broken platforms
      nbd: make it thread-safe, fix qcow2 over nbd

Peter Xu (5):
      kvm: irqchip: trace changes on msi add/remove
      msix: trace control bit write op
      kvm: irqchip: skip update msi when disabled
      exec: simplify phys_page_find() params
      exec: fix address_space_get_iotlb_entry page mask

Roman Pen (1):
      i386/kvm: do not zero out segment flags if segment is unusable or not present

Stefano Stabellini (1):
      Check the return value of fcntl in qemu_set_cloexec

Tai Yunfang (1):
      mc146818rtc: precisely count the clock for periodic timer

Thomas Huth (1):
      hw/core: nmi.c can be compiled as common-obj nowadays

Vladimir Sementsov-Ogievskiy (5):
      nbd: strict nbd_wr_syncv
      nbd: read_sync and friends: return 0 on success
      nbd: add errp parameter to nbd_wr_syncv()
      nbd: add errp to read_sync, write_sync and drop_sync
      nbd/client.c: use errp instead of LOG

Xiao Guangrong (5):
      mc146818rtc: update periodic timer only if it is needed
      mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386
      mc146818rtc: drop unnecessary '#ifdef TARGET_I386'
      mc146818rtc: embrace all x86 specific code
      qtest: add rtc periodic timer test

 .gitignore                                |   1 +
 Makefile                                  |   3 +
 Makefile.objs                             |   4 +
 block/nbd-client.c                        |  41 +-
 configure                                 |   4 +-
 contrib/libvhost-user/libvhost-user.h     |  11 +-
 contrib/vhost-user-scsi/Makefile.objs     |   1 +
 contrib/vhost-user-scsi/vhost-user-scsi.c | 886 ++++++++++++++++++++++++++++++
 cpus.c                                    |   2 +-
 default-configs/pci.mak                   |   1 +
 default-configs/s390x-softmmu.mak         |   1 +
 exec.c                                    |  27 +-
 gdb-xml/i386-32bit-sse.xml                |  52 ++
 gdb-xml/i386-32bit.xml                    |  14 +
 gdb-xml/i386-64bit-sse.xml                |  60 ++
 gdb-xml/i386-64bit.xml                    |  14 +
 hw/core/Makefile.objs                     |   2 +-
 hw/i386/kvm/clock.c                       |   3 +
 hw/misc/edu.c                             |  12 +-
 hw/pci/msix.c                             |  11 +-
 hw/pci/trace-events                       |   3 +
 hw/scsi/Makefile.objs                     |   1 +
 hw/scsi/vhost-scsi-common.c               |   1 -
 hw/scsi/vhost-user-scsi.c                 | 211 +++++++
 hw/scsi/virtio-scsi.c                     |   3 +
 hw/timer/mc146818rtc.c                    | 203 ++++---
 hw/virtio/virtio-pci.c                    |  54 ++
 hw/virtio/virtio-pci.h                    |  11 +
 include/block/nbd.h                       |   8 +-
 include/hw/timer/mc146818rtc_regs.h       |  20 +
 include/hw/virtio/vhost-user-scsi.h       |  35 ++
 include/hw/virtio/virtio-scsi.h           |   2 +
 kvm-all.c                                 |   8 +-
 nbd/client.c                              | 125 ++---
 nbd/common.c                              |  23 +-
 nbd/nbd-internal.h                        |  40 +-
 nbd/server.c                              | 100 ++--
 pc-bios/linuxboot_dma.bin                 | Bin 1536 -> 1536 bytes
 pc-bios/optionrom/Makefile                |   1 +
 qemu-nbd.c                                |   5 +-
 target/i386/arch_memory_mapping.c         |  18 +-
 target/i386/cpu.c                         |  23 +-
 target/i386/cpu.h                         |  20 +-
 target/i386/helper.c                      |  96 ++--
 target/i386/kvm.c                         |  36 +-
 target/i386/machine.c                     |   4 -
 target/i386/smm_helper.c                  |  18 -
 target/i386/translate.c                   |  12 +
 tests/qemu-iotests/083.out                |   2 +
 tests/rtc-test.c                          |  49 ++
 trace-events                              |   3 +-
 util/oslib-posix.c                        |   4 +-
 util/qemu-sockets.c                       |  68 ++-
 53 files changed, 1956 insertions(+), 401 deletions(-)
 create mode 100644 contrib/vhost-user-scsi/Makefile.objs
 create mode 100644 contrib/vhost-user-scsi/vhost-user-scsi.c
 create mode 100644 gdb-xml/i386-32bit-sse.xml
 create mode 100644 gdb-xml/i386-32bit.xml
 create mode 100644 gdb-xml/i386-64bit-sse.xml
 create mode 100644 gdb-xml/i386-64bit.xml
 create mode 100644 hw/scsi/vhost-user-scsi.c
 create mode 100644 include/hw/virtio/vhost-user-scsi.h
-- 
2.13.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test
  2017-06-01 17:07 [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Paolo Bonzini
@ 2017-06-01 17:07 ` Paolo Bonzini
  2017-06-01 17:07 ` [Qemu-devel] [PULL 34/34] cpus: reset throttle_thread_scheduled after sleep Paolo Bonzini
  2017-06-01 17:53 ` [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Peter Maydell
  2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-06-01 17:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <xiaoguangrong@tencent.com>

It tests the accuracy of rtc periodic timer which is recently
improved & fixed by commit 7ffcb539a3 ("mc146818rtc: precisely count
the clock for periodic timer", 2017-05-19).

Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
Message-Id: <20170527025301.23499-1-xiaoguangrong@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/timer/mc146818rtc.c              | 15 +++---------
 include/hw/timer/mc146818rtc_regs.h | 20 +++++++++++++++
 tests/rtc-test.c                    | 49 +++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 542cd09bc1..1b8d3d7d4c 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -120,7 +120,7 @@ static void rtc_coalesced_timer_update(RTCState *s)
         /* divide each RTC interval to 2 - 8 smaller intervals */
         int c = MIN(s->irq_coalesced, 7) + 1; 
         int64_t next_clock = qemu_clock_get_ns(rtc_clock) +
-            muldiv64(s->period / c, NANOSECONDS_PER_SECOND, RTC_CLOCK_RATE);
+            periodic_clock_to_ns(s->period / c);
         timer_mod(s->coalesced_timer, next_clock);
     }
 }
@@ -178,16 +178,8 @@ static uint32_t rtc_periodic_clock_ticks(RTCState *s)
      }
 
     period_code = s->cmos_data[RTC_REG_A] & 0x0f;
-    if (!period_code) {
-        return 0;
-    }
-
-    if (period_code <= 2) {
-        period_code += 7;
-    }
 
-    /* period in 32 Khz cycles */
-    return 1 << (period_code - 1);
+    return periodic_period_to_clock(period_code);
 }
 
 /*
@@ -260,8 +252,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period)
         assert(lost_clock >= 0 && lost_clock <= period);
 
         next_irq_clock = cur_clock + period - lost_clock;
-        s->next_periodic_time = muldiv64(next_irq_clock, NANOSECONDS_PER_SECOND,
-                                         RTC_CLOCK_RATE) + 1;
+        s->next_periodic_time = periodic_clock_to_ns(next_irq_clock) + 1;
         timer_mod(s->periodic_timer, s->next_periodic_time);
     } else {
         s->irq_coalesced = 0;
diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/timer/mc146818rtc_regs.h
index 6ede6c832e..c62f17bf2d 100644
--- a/include/hw/timer/mc146818rtc_regs.h
+++ b/include/hw/timer/mc146818rtc_regs.h
@@ -65,4 +65,24 @@
 #define REG_C_AF   0x20
 #define REG_C_MASK 0x70
 
+static inline uint32_t periodic_period_to_clock(int period_code)
+{
+    if (!period_code) {
+        return 0;
+   }
+
+    if (period_code <= 2) {
+        period_code += 7;
+    }
+    /* period in 32 Khz cycles */
+   return 1 << (period_code - 1);
+}
+
+#define RTC_CLOCK_RATE            32768
+
+static inline int64_t periodic_clock_to_ns(int64_t clocks)
+{
+    return muldiv64(clocks, NANOSECONDS_PER_SECOND, RTC_CLOCK_RATE);
+}
+
 #endif
diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index a086efd120..e78f701afb 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -14,6 +14,7 @@
 #include "qemu/osdep.h"
 
 #include "libqtest.h"
+#include "qemu/timer.h"
 #include "hw/timer/mc146818rtc_regs.h"
 
 static uint8_t base = 0x70;
@@ -542,6 +543,52 @@ static void register_b_set_flag(void)
     g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
 }
 
+#define RTC_PERIOD_CODE1    13   /* 8 Hz */
+#define RTC_PERIOD_CODE2    15   /* 2 Hz */
+
+#define RTC_PERIOD_TEST_NR  50
+
+static uint64_t wait_periodic_interrupt(uint64_t real_time)
+{
+    while (!get_irq(RTC_ISA_IRQ)) {
+        real_time = clock_step_next();
+    }
+
+    g_assert((cmos_read(RTC_REG_C) & REG_C_PF) != 0);
+    return real_time;
+}
+
+static void periodic_timer(void)
+{
+    int i;
+    uint64_t period_clocks, period_time, start_time, real_time;
+
+    /* disable all interrupts. */
+    cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) &
+                                   ~(REG_B_PIE | REG_B_AIE | REG_B_UIE));
+    cmos_write(RTC_REG_A, RTC_PERIOD_CODE1);
+    /* enable periodic interrupt after properly configure the period. */
+    cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) | REG_B_PIE);
+
+    start_time = real_time = clock_step_next();
+
+    for (i = 0; i < RTC_PERIOD_TEST_NR; i++) {
+        cmos_write(RTC_REG_A, RTC_PERIOD_CODE1);
+        real_time = wait_periodic_interrupt(real_time);
+        cmos_write(RTC_REG_A, RTC_PERIOD_CODE2);
+        real_time = wait_periodic_interrupt(real_time);
+    }
+
+    period_clocks = periodic_period_to_clock(RTC_PERIOD_CODE1) +
+                       periodic_period_to_clock(RTC_PERIOD_CODE2);
+    period_clocks *= RTC_PERIOD_TEST_NR;
+    period_time = periodic_clock_to_ns(period_clocks);
+
+    real_time -= start_time;
+    g_assert_cmpint(ABS((int64_t)(real_time - period_time)), <=,
+                    NANOSECONDS_PER_SECOND * 0.5);
+}
+
 int main(int argc, char **argv)
 {
     QTestState *s = NULL;
@@ -564,6 +611,8 @@ int main(int argc, char **argv)
     qtest_add_func("/rtc/set-year/1980", set_year_1980);
     qtest_add_func("/rtc/misc/register_b_set_flag", register_b_set_flag);
     qtest_add_func("/rtc/misc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/rtc/periodic/interrupt", periodic_timer);
+
     ret = g_test_run();
 
     if (s) {
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 34/34] cpus: reset throttle_thread_scheduled after sleep
  2017-06-01 17:07 [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Paolo Bonzini
  2017-06-01 17:07 ` [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test Paolo Bonzini
@ 2017-06-01 17:07 ` Paolo Bonzini
  2017-06-01 17:53 ` [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Peter Maydell
  2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-06-01 17:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Felipe Franciosi, Malcolm Crossley

From: Felipe Franciosi <felipe@nutanix.com>

Currently, the throttle_thread_scheduled flag is reset back to 0 before
sleeping (as part of the throttling logic). Given that throttle_timer
(well, any timer) may tick with a slight delay, it so happens that under
heavy throttling (ie. close or on CPU_THROTTLE_PCT_MAX) the tick may
schedule a further cpu_throttle_thread() work item after the flag reset,
but before the previous sleep completed. This results on the vCPU thread
sleeping continuously for potentially several seconds in a row.

The chances of that happening can be drastically minimised by resetting
the flag after the sleep.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Signed-off-by: Malcolm Crossley <malcolm@nutanix.com>
Message-Id: <1495229390-18909-1-git-send-email-felipe@nutanix.com>
Acked-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpus.c b/cpus.c
index 516e5cbac1..f42eebda91 100644
--- a/cpus.c
+++ b/cpus.c
@@ -677,9 +677,9 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque)
     sleeptime_ns = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE_NS);
 
     qemu_mutex_unlock_iothread();
-    atomic_set(&cpu->throttle_thread_scheduled, 0);
     g_usleep(sleeptime_ns / 1000); /* Convert ns to us for usleep call */
     qemu_mutex_lock_iothread();
+    atomic_set(&cpu->throttle_thread_scheduled, 0);
 }
 
 static void cpu_throttle_timer_tick(void *opaque)
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01
  2017-06-01 17:07 [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Paolo Bonzini
  2017-06-01 17:07 ` [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test Paolo Bonzini
  2017-06-01 17:07 ` [Qemu-devel] [PULL 34/34] cpus: reset throttle_thread_scheduled after sleep Paolo Bonzini
@ 2017-06-01 17:53 ` Peter Maydell
  2017-06-01 17:56   ` Peter Maydell
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2017-06-01 17:53 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 1 June 2017 at 18:07, Paolo Bonzini <pbonzini@redhat.com> wrote:
> The following changes since commit 56821559f0ba682fe6b367815572e6f974d329ab:
>
>   Merge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging (2017-05-18 13:36:15 +0100)
>
> are available in the git repository at:
>
>   git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to f3c3ad2dc98c6610152355f6a4de1445efc87421:
>
>   cpus: reset throttle_thread_scheduled after sleep (2017-06-01 18:01:05 +0200)
>
> ----------------------------------------------------------------
> * virtio-scsi use-after-free fix (Fam)
> * vhost-user-scsi support (Felipe)
> * SMM fixes and improvements for TCG (myself, Mihail)
> * irqchip and AddressSpaceDispatch cleanups and fixes (Peter)
> * Coverity fix (Stefano)
> * NBD cleanups and fixes (Vladimir, Eric, myself)
> * RTC accuracy improvements and code cleanups (Guangrong+Yunfang)
> * socket error reporting improvement (Daniel)
> * GDB XML description for SSE registers (Abdallah)
> * kvmclock update fix (Denis)
> * SMM memory savings (Gonglei)
> * -cpu 486 fix (Paolo)
> * various bugfixes (Roman, Peter, myself, Thomas)
> * rtc-test improvement (Guangrong)
> * migration throttling fix (Felipe)

Test failure on OSX:

TEST: tests/device-introspect-test... (pid=66373)
  /aarch64/device/introspect/list:                                     OK
  /aarch64/device/introspect/none:                                     OK
  /aarch64/device/introspect/abstract:                                 OK
  /aarch64/device/introspect/concrete:                                 **
ERROR:/root/qemu/qom/object.c:364:object_initialize_with_type:
assertion failed: (type != NULL)
Broken pipe

Test failures on FreeBSD:
  GTESTER check-qtest-aarch64
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S8983f4bd019deabaf27dbf8281490ab9
  GTESTER check-qtest-alpha
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S5ba80c00f420a9cbe79b7926bc90901c
  GTESTER check-qtest-arm
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S9a3f10d16d54467f421a79a355a25714
  GTESTER check-qtest-cris
  GTESTER check-qtest-i386
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S29797c8935576bfd6237cce3e02075c9
  GTESTER check-qtest-lm32
  GTESTER check-qtest-m68k
  GTESTER check-qtest-microblaze
  GTESTER check-qtest-microblazeel
  GTESTER check-qtest-mips
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S1d5b7d14f648cc07be3bfc003b7c66a2
  GTESTER check-qtest-mips64
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S6c9d59bd8f80319effd07c498108c129
  GTESTER check-qtest-mips64el
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S530b42302d04c589e6a5f1fc49268dcb
  GTESTER check-qtest-mipsel
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S404f19f557f26102621573b7b8641871
  GTESTER check-qtest-moxie
  GTESTER check-qtest-nios2
  GTESTER check-qtest-or1k
  GTESTER check-qtest-ppc
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S8a9874d645fde55f36b7df0204c82959
  GTESTER check-qtest-ppc64
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S1bf51dd7caadd650ac3be82bd21cbae5
  GTESTER check-qtest-ppcemb
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02Sbb3adb4867092ddb73e7fc0ecfe68c96
  GTESTER check-qtest-s390x
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S2e85df237abb737f12c5aba4c0592c41
  GTESTER check-qtest-sh4
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S36667c3c9283bf56a54f105edfd951c4
  GTESTER check-qtest-sh4eb
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S7a8f453c29b24767afcbf5af6c890072
  GTESTER check-qtest-sparc
  GTESTER check-qtest-sparc64
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02Scf61ab29a9f9630cf0661370bca2f09d
  GTESTER check-qtest-tricore
  GTESTER check-qtest-unicore32
  GTESTER check-qtest-x86_64
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
"kvm" accelerator not found.
**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
GTester: last random seed: R02S1639c5bd5af52de8b1b097d44666b889
  GTESTER check-qtest-xtensa
  GTESTER check-qtest-xtensaeb

(Yes, the test's error messages are pretty useless.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01
  2017-06-01 17:53 ` [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Peter Maydell
@ 2017-06-01 17:56   ` Peter Maydell
  2017-06-02  8:06     ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2017-06-01 17:56 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 1 June 2017 at 18:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> Test failure on OSX:
>
> TEST: tests/device-introspect-test... (pid=66373)
>   /aarch64/device/introspect/list:                                     OK
>   /aarch64/device/introspect/none:                                     OK
>   /aarch64/device/introspect/abstract:                                 OK
>   /aarch64/device/introspect/concrete:                                 **
> ERROR:/root/qemu/qom/object.c:364:object_initialize_with_type:
> assertion failed: (type != NULL)
> Broken pipe

Got those the wrong way round -- this is the FreeBSD failure
and the other lot are OSX. Pretty sure it's the same error,
though -- it's just that for some reason my OSX setup doesn't
actually cause make to exit with an error when a test fails,
so it goes on to hit what's probably the same bug in all the
other check-qtest-$ARCH targets rather than bailing out.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01
  2017-06-01 17:56   ` Peter Maydell
@ 2017-06-02  8:06     ` Paolo Bonzini
  2017-06-02 16:45       ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2017-06-02  8:06 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

On 01/06/2017 19:56, Peter Maydell wrote:
> On 1 June 2017 at 18:53, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Test failure on OSX:
>>
>> TEST: tests/device-introspect-test... (pid=66373)
>>   /aarch64/device/introspect/list:                                     OK
>>   /aarch64/device/introspect/none:                                     OK
>>   /aarch64/device/introspect/abstract:                                 OK
>>   /aarch64/device/introspect/concrete:                                 **
>> ERROR:/root/qemu/qom/object.c:364:object_initialize_with_type:
>> assertion failed: (type != NULL)
>> Broken pipe
> 
> Got those the wrong way round -- this is the FreeBSD failure
> and the other lot are OSX. Pretty sure it's the same error,
> though -- it's just that for some reason my OSX setup doesn't
> actually cause make to exit with an error when a test fails,
> so it goes on to hit what's probably the same bug in all the
> other check-qtest-$ARCH targets rather than bailing out.

Thanks, any chance you can bisect these?  I'll install a FreeBSD VM next
week.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01
  2017-06-02  8:06     ` Paolo Bonzini
@ 2017-06-02 16:45       ` Peter Maydell
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2017-06-02 16:45 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 2 June 2017 at 09:06, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 01/06/2017 19:56, Peter Maydell wrote:
>> On 1 June 2017 at 18:53, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> Test failure on OSX:
>>>
>>> TEST: tests/device-introspect-test... (pid=66373)
>>>   /aarch64/device/introspect/list:                                     OK
>>>   /aarch64/device/introspect/none:                                     OK
>>>   /aarch64/device/introspect/abstract:                                 OK
>>>   /aarch64/device/introspect/concrete:                                 **
>>> ERROR:/root/qemu/qom/object.c:364:object_initialize_with_type:
>>> assertion failed: (type != NULL)
>>> Broken pipe
>>
>> Got those the wrong way round -- this is the FreeBSD failure
>> and the other lot are OSX. Pretty sure it's the same error,
>> though -- it's just that for some reason my OSX setup doesn't
>> actually cause make to exit with an error when a test fails,
>> so it goes on to hit what's probably the same bug in all the
>> other check-qtest-$ARCH targets rather than bailing out.
>
> Thanks, any chance you can bisect these?  I'll install a FreeBSD VM next
> week.

No bisection, but using QTEST_LOG:

QTEST_LOG=1 QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64
QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
255 + 1))} gtester -k --verbose -m=quick tests/device-introspect-test
-p=/aarch64/device/introspect/concrete
[...]
{"return": "/machine (none-machine)\r\n  /peripheral (container)\r\n
/peripheral-anon (container)\r\n  /unattached (container)\r\n
/io[0] (qemu:memory-region)\r\n    /sysbus (System)\r\n    /system[0]
(qemu:memory-region)\r\n"}{"execute": "device-list-properties",
"arguments": {"typename": "vhost-user-scsi-pci"}}

**
ERROR:/Users/pm215/src/qemu-for-merges/qom/object.c:364:void
object_initialize_with_type(void *, size_t, TypeImpl *): assertion
failed: (type != NULL)
Broken pipe
FAIL

suggests that there's a bug in the new vhost-user-scsi-pci
device. Specifically in commit 550811c37e0f2
("vhost-user-scsi: Introduce vhost-user-scsi host device")
hw/virtio/virtio-pci.c is changed to unconditionally call
type_register_static(&vhost_user_scsi_pci_info), whose
instance_init method tries to use TYPE_VHOST_USER_SCSI,
but hw/scsi/vhost-user-scsi.c (where that type is defined)
is only compiled if CONFIG_VHOST_USER_SCSI is set (which
only happens for Linux).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test
  2017-06-01 16:03 Paolo Bonzini
@ 2017-06-01 16:03 ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-06-01 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <xiaoguangrong@tencent.com>

It tests the accuracy of rtc periodic timer which is recently
improved & fixed by commit 7ffcb539a3 ("mc146818rtc: precisely count
the clock for periodic timer", 2017-05-19).

Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
Message-Id: <20170527025301.23499-1-xiaoguangrong@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/timer/mc146818rtc.c              | 15 +++---------
 include/hw/timer/mc146818rtc_regs.h | 20 +++++++++++++++
 tests/rtc-test.c                    | 49 +++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 542cd09bc1..1b8d3d7d4c 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -120,7 +120,7 @@ static void rtc_coalesced_timer_update(RTCState *s)
         /* divide each RTC interval to 2 - 8 smaller intervals */
         int c = MIN(s->irq_coalesced, 7) + 1; 
         int64_t next_clock = qemu_clock_get_ns(rtc_clock) +
-            muldiv64(s->period / c, NANOSECONDS_PER_SECOND, RTC_CLOCK_RATE);
+            periodic_clock_to_ns(s->period / c);
         timer_mod(s->coalesced_timer, next_clock);
     }
 }
@@ -178,16 +178,8 @@ static uint32_t rtc_periodic_clock_ticks(RTCState *s)
      }
 
     period_code = s->cmos_data[RTC_REG_A] & 0x0f;
-    if (!period_code) {
-        return 0;
-    }
-
-    if (period_code <= 2) {
-        period_code += 7;
-    }
 
-    /* period in 32 Khz cycles */
-    return 1 << (period_code - 1);
+    return periodic_period_to_clock(period_code);
 }
 
 /*
@@ -260,8 +252,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period)
         assert(lost_clock >= 0 && lost_clock <= period);
 
         next_irq_clock = cur_clock + period - lost_clock;
-        s->next_periodic_time = muldiv64(next_irq_clock, NANOSECONDS_PER_SECOND,
-                                         RTC_CLOCK_RATE) + 1;
+        s->next_periodic_time = periodic_clock_to_ns(next_irq_clock) + 1;
         timer_mod(s->periodic_timer, s->next_periodic_time);
     } else {
         s->irq_coalesced = 0;
diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/timer/mc146818rtc_regs.h
index 6ede6c832e..c62f17bf2d 100644
--- a/include/hw/timer/mc146818rtc_regs.h
+++ b/include/hw/timer/mc146818rtc_regs.h
@@ -65,4 +65,24 @@
 #define REG_C_AF   0x20
 #define REG_C_MASK 0x70
 
+static inline uint32_t periodic_period_to_clock(int period_code)
+{
+    if (!period_code) {
+        return 0;
+   }
+
+    if (period_code <= 2) {
+        period_code += 7;
+    }
+    /* period in 32 Khz cycles */
+   return 1 << (period_code - 1);
+}
+
+#define RTC_CLOCK_RATE            32768
+
+static inline int64_t periodic_clock_to_ns(int64_t clocks)
+{
+    return muldiv64(clocks, NANOSECONDS_PER_SECOND, RTC_CLOCK_RATE);
+}
+
 #endif
diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index a086efd120..e78f701afb 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -14,6 +14,7 @@
 #include "qemu/osdep.h"
 
 #include "libqtest.h"
+#include "qemu/timer.h"
 #include "hw/timer/mc146818rtc_regs.h"
 
 static uint8_t base = 0x70;
@@ -542,6 +543,52 @@ static void register_b_set_flag(void)
     g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
 }
 
+#define RTC_PERIOD_CODE1    13   /* 8 Hz */
+#define RTC_PERIOD_CODE2    15   /* 2 Hz */
+
+#define RTC_PERIOD_TEST_NR  50
+
+static uint64_t wait_periodic_interrupt(uint64_t real_time)
+{
+    while (!get_irq(RTC_ISA_IRQ)) {
+        real_time = clock_step_next();
+    }
+
+    g_assert((cmos_read(RTC_REG_C) & REG_C_PF) != 0);
+    return real_time;
+}
+
+static void periodic_timer(void)
+{
+    int i;
+    uint64_t period_clocks, period_time, start_time, real_time;
+
+    /* disable all interrupts. */
+    cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) &
+                                   ~(REG_B_PIE | REG_B_AIE | REG_B_UIE));
+    cmos_write(RTC_REG_A, RTC_PERIOD_CODE1);
+    /* enable periodic interrupt after properly configure the period. */
+    cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) | REG_B_PIE);
+
+    start_time = real_time = clock_step_next();
+
+    for (i = 0; i < RTC_PERIOD_TEST_NR; i++) {
+        cmos_write(RTC_REG_A, RTC_PERIOD_CODE1);
+        real_time = wait_periodic_interrupt(real_time);
+        cmos_write(RTC_REG_A, RTC_PERIOD_CODE2);
+        real_time = wait_periodic_interrupt(real_time);
+    }
+
+    period_clocks = periodic_period_to_clock(RTC_PERIOD_CODE1) +
+                       periodic_period_to_clock(RTC_PERIOD_CODE2);
+    period_clocks *= RTC_PERIOD_TEST_NR;
+    period_time = periodic_clock_to_ns(period_clocks);
+
+    real_time -= start_time;
+    g_assert_cmpint(ABS((int64_t)(real_time - period_time)), <=,
+                    NANOSECONDS_PER_SECOND * 0.5);
+}
+
 int main(int argc, char **argv)
 {
     QTestState *s = NULL;
@@ -564,6 +611,8 @@ int main(int argc, char **argv)
     qtest_add_func("/rtc/set-year/1980", set_year_1980);
     qtest_add_func("/rtc/misc/register_b_set_flag", register_b_set_flag);
     qtest_add_func("/rtc/misc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/rtc/periodic/interrupt", periodic_timer);
+
     ret = g_test_run();
 
     if (s) {
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-02 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-01 17:07 [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Paolo Bonzini
2017-06-01 17:07 ` [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test Paolo Bonzini
2017-06-01 17:07 ` [Qemu-devel] [PULL 34/34] cpus: reset throttle_thread_scheduled after sleep Paolo Bonzini
2017-06-01 17:53 ` [Qemu-devel] [PULL v2 00/34] Misc patches for 2016-06-01 Peter Maydell
2017-06-01 17:56   ` Peter Maydell
2017-06-02  8:06     ` Paolo Bonzini
2017-06-02 16:45       ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2017-06-01 16:03 Paolo Bonzini
2017-06-01 16:03 ` [Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test Paolo Bonzini

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.