Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick: Protect read-only bits of syscfg #91

Commits on Jul 15, 2024

  1. system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

    The Big QEMU Lock (BQL) has many names and they are confusing. The
    actual QemuMutex variable is called qemu_global_mutex but it's commonly
    referred to as the BQL in discussions and some code comments. The
    locking APIs, however, are called qemu_mutex_lock_iothread() and
    qemu_mutex_unlock_iothread().
    
    The "iothread" name is historic and comes from when the main thread was
    split into into KVM vcpu threads and the "iothread" (now called the main
    loop thread). I have contributed to the confusion myself by introducing
    a separate --object iothread, a separate concept unrelated to the BQL.
    
    The "iothread" name is no longer appropriate for the BQL. Rename the
    locking APIs to:
    - void bql_lock(void)
    - void bql_unlock(void)
    - bool bql_locked(void)
    
    There are more APIs with "iothread" in their names. Subsequent patches
    will rename them. There are also comments and documentation that will be
    updated in later patches.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Acked-by: Fabiano Rosas <farosas@suse.de>
    Acked-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Acked-by: Peter Xu <peterx@redhat.com>
    Acked-by: Eric Farman <farman@linux.ibm.com>
    Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
    Acked-by: Hyman Huang <yong.huang@smartx.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20240102153529.486531-2-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefanhaRH authored and quic-mathbern committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    4fe36c0 View commit details
    Browse the repository at this point in the history
  2. qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD

    The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL)
    instead, it is already widely used and unambiguous.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Acked-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20240102153529.486531-3-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefanhaRH authored and quic-mathbern committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    7c87f97 View commit details
    Browse the repository at this point in the history
  3. Switch to using BQL_LOCK_GUARD() macro

    This lock is scope-bound - so we will avoid errors when adding new early
    return statements.
    
    BQL_LOCK_GUARD is an architecture-independent QEMU idiom to replace the
    hexagon-specific {UN,}LOCK_IOTHREAD().  The hexagon-specific macro was
    a pseudo-nested lock but we don't seem to need that flexibility if we
    move the lock acquisition up to a consistent place high enough in the
    call stack.
    
    Signed-off-by: Brian Cain <bcain@quicinc.com>
    androm3da authored and quic-mathbern committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    608cc69 View commit details
    Browse the repository at this point in the history
  4. Protect read-only bits of syscfg.

    Users may do a read-modify-write to update syscfg.  Between
    the read of the original value of syscfg and the write of the new value
    another thread may do a k0lock/unlock or tlblock/unlock changing read-only
    bits k0 or tk.
    
    This patch protects those bits from being lost during the read-modify-write
    sequence.
    
    Signed-off-by: Sid Manning <sidneym@quicinc.com>
    SidManning authored and quic-mathbern committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    7f37344 View commit details
    Browse the repository at this point in the history