Skip to content
Snippets Groups Projects
  1. Apr 20, 2023
  2. Mar 15, 2023
  3. Mar 07, 2023
    • Avihai Horon's avatar
      docs/devel: Document VFIO device dirty page tracking · 333f988d
      Avihai Horon authored
      
      Adjust the VFIO dirty page tracking documentation and add a section to
      describe device dirty page tracking.
      
      Signed-off-by: default avatarAvihai Horon <avihaih@nvidia.com>
      Signed-off-by: default avatarJoao Martins <joao.m.martins@oracle.com>
      Reviewed-by: default avatarCédric Le Goater <clg@redhat.com>
      Link: https://lore.kernel.org/r/20230307125450.62409-16-joao.m.martins@oracle.com
      
      
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      333f988d
    • Paolo Bonzini's avatar
      qatomic: add smp_mb__before/after_rmw() · ff00bed1
      Paolo Bonzini authored
      
      On ARM, seqcst loads and stores (which QEMU does not use) are compiled
      respectively as LDAR and STLR instructions.  Even though LDAR is
      also used for load-acquire operations, it also waits for all STLRs to
      leave the store buffer.  Thus, LDAR and STLR alone are load-acquire
      and store-release operations, but LDAR also provides store-against-load
      ordering as long as the previous store is a STLR.
      
      Compare this to ARMv7, where store-release is DMB+STR and load-acquire
      is LDR+DMB, but an additional DMB is needed between store-seqcst and
      load-seqcst (e.g. DMB+STR+DMB+LDR+DMB); or with x86, where MOV provides
      load-acquire and store-release semantics and the two can be reordered.
      
      Likewise, on ARM sequentially consistent read-modify-write operations only
      need to use LDAXR and STLXR respectively for the load and the store, while
      on x86 they need to use the stronger LOCK prefix.
      
      In a strange twist of events, however, the _stronger_ semantics
      of the ARM instructions can end up causing bugs on ARM, not on x86.
      The problems occur when seqcst atomics are mixed with relaxed atomics.
      
      QEMU's atomics try to bridge the Linux API (that most of the developers
      are familiar with) and the C11 API, and the two have a substantial
      difference:
      
      - in Linux, strongly-ordered atomics such as atomic_add_return() affect
        the global ordering of _all_ memory operations, including for example
        READ_ONCE()/WRITE_ONCE()
      
      - in C11, sequentially consistent atomics (except for seq-cst fences)
        only affect the ordering of sequentially consistent operations.
        In particular, since relaxed loads are done with LDR on ARM, they are
        not ordered against seqcst stores (which are done with STLR).
      
      QEMU implements high-level synchronization primitives with the idea that
      the primitives contain the necessary memory barriers, and the callers can
      use relaxed atomics (qatomic_read/qatomic_set) or even regular accesses.
      This is very much incompatible with the C11 view that seqcst accesses
      are only ordered against other seqcst accesses, and requires using seqcst
      fences as in the following example:
      
         qatomic_set(&y, 1);            qatomic_set(&x, 1);
         smp_mb();                      smp_mb();
         ... qatomic_read(&x) ...       ... qatomic_read(&y) ...
      
      When a qatomic_*() read-modify write operation is used instead of one
      or both stores, developers that are more familiar with the Linux API may
      be tempted to omit the smp_mb(), which will work on x86 but not on ARM.
      
      This nasty difference between Linux and C11 read-modify-write operations
      has already caused issues in util/async.c and more are being found.
      Provide something similar to Linux smp_mb__before/after_atomic(); this
      has the double function of documenting clearly why there is a memory
      barrier, and avoiding a double barrier on x86 and s390x systems.
      
      The new macro can already be put to use in qatomic_mb_set().
      
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ff00bed1
  4. Mar 05, 2023
  5. Mar 01, 2023
  6. Feb 27, 2023
  7. Feb 23, 2023
  8. Feb 17, 2023
  9. Feb 16, 2023
  10. Feb 06, 2023
  11. Feb 02, 2023
  12. Jan 16, 2023
  13. Jan 08, 2023
  14. Jan 05, 2023
    • Mark Cave-Ayland's avatar
      tcg: convert tcg/README to rst · 5e97a28a
      Mark Cave-Ayland authored
      
      Convert tcg/README to rst and move it to docs/devel as a new "TCG Intermediate
      Representation" page. There are a few minor changes to improve the aesthetic
      of the final output which are as follows:
      
        - Rename the title from "Tiny Code Generator - Fabrice Bellard" to "TCG
          Intermediate Representation"
      
        - Remove the section numbering
      
        - Add the missing parameters to the ssadd_vec operations in the "Host
          vector operations" section
      
        - Change the path to the Atomic Operations document to use a proper
          reference
      
        - Replace tcg/README in tcg.rst with a proper reference to the new document
      
      Signed-off-by: default avatarMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Reviewed-by: default avatarFabiano Rosas <farosas@suse.de>
      Message-Id: <20221130100434.64207-2-mark.cave-ayland@ilande.co.uk>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      5e97a28a
  15. Dec 21, 2022
  16. Dec 15, 2022
  17. Dec 13, 2022
    • Markus Armbruster's avatar
      qapi: Start to elide redundant has_FOO in generated C · 44ea9d9b
      Markus Armbruster authored
      
      In QAPI, absent optional members are distinct from any present value.
      We thus represent an optional schema member FOO as two C members: a
      FOO with the member's type, and a bool has_FOO.  Likewise for function
      arguments.
      
      However, has_FOO is actually redundant for a pointer-valued FOO, which
      can be null only when has_FOO is false, i.e. has_FOO == !!FOO.  Except
      for arrays, where we a null FOO can also be a present empty array.
      
      The redundant has_FOO are a nuisance to work with.  Improve the
      generator to elide them.  Uses of has_FOO need to be replaced as
      follows.
      
      Tests of has_FOO become the equivalent comparison of FOO with null.
      For brevity, this is commonly done by implicit conversion to bool.
      
      Assignments to has_FOO get dropped.
      
      Likewise for arguments to has_FOO parameters.
      
      Beware: code may violate the invariant has_FOO == !!FOO before the
      transformation, and get away with it.  The above transformation can
      then break things.  Two cases:
      
      * Absent: if code ignores FOO entirely when !has_FOO (except for
        freeing it if necessary), even non-null / uninitialized FOO works.
        Such code is known to exist.
      
      * Present: if code ignores FOO entirely when has_FOO, even null FOO
        works.  Such code should not exist.
      
      In both cases, replacing tests of has_FOO by FOO reverts their sense.
      We have to fix the value of FOO then.
      
      To facilitate review of the necessary updates to handwritten code, add
      means to opt out of this change, and opt out for all QAPI schema
      modules where the change requires updates to handwritten code.  The
      next few commits will remove these opt-outs in reviewable chunks, then
      drop the means to opt out.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20221104160712.3005652-5-armbru@redhat.com>
      44ea9d9b
    • Markus Armbruster's avatar
      docs/devel/qapi-code-gen: Extend example for next commit's change · 94f9bd33
      Markus Armbruster authored
      
      The next commit will change the code generated for some optional
      members.  The example schema contains an optional member affected by
      the change.  Add one that is not affected.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20221104160712.3005652-4-armbru@redhat.com>
      94f9bd33
    • Markus Armbruster's avatar
      qapi: Tidy up whitespace in generated code · 7df18461
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20221104160712.3005652-3-armbru@redhat.com>
      7df18461
    • Markus Armbruster's avatar
      docs/devel/qapi-code-gen: Update example to match current code · a680ea07
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20221104160712.3005652-2-armbru@redhat.com>
      a680ea07
  18. Nov 22, 2022
  19. Nov 17, 2022
  20. Nov 11, 2022
  21. Nov 05, 2022
  22. Nov 02, 2022
  23. Oct 27, 2022
  24. Oct 06, 2022
Loading