From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623143; cv=none; d=zohomail.com; s=zohoarc; b=TLNdPc0Ti/R714gOMVNwBvVQ7vZsOI+7LbgU4CN5CK/zolO/Sp8Ayb8cz5UyyVJbPeyJ6f3EyMpf+hDXF9iSreRO7ln48ZWQKHNPYuQGcO7L4LINB/XR07CPLiVkdWnH13aKkQfccSUkKPTqYhcBNsHoAn3f4DVgZ+/5kSc3+8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623143; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kbuSBHr1MC6PAa/zfDpEwyHM5lMDqO3acWiR6BPy9jk=; b=JadO7//rqeUYyib0fhtWRbL6CsAAlVGaL0qB+hl/BZe23Mwip2Jt0Gt37D+OMJsZ25PiK6307aGLQbRTc/4pQe1gPXdllDLa0XxSvpKFlSAPIlmqlT0fucMKFFP7/kRmzmws0/Xy0VBYW1SsouQd8E3PWsCLSlFuIuETJ38UA0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623143956953.4616323673989; Tue, 9 May 2023 02:05:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHR-0005EQ-8f; Tue, 09 May 2023 05:05:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHN-0005DU-2U for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHL-0004ip-8i for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:04 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-xrKvDfkBO7eOCGd77_-8WQ-1; Tue, 09 May 2023 05:05:01 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-969ea6699fdso70885466b.3 for ; Tue, 09 May 2023 02:05:01 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id gf25-20020a170906e21900b0094edfbd475csm1035216ejb.127.2023.05.09.02.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kbuSBHr1MC6PAa/zfDpEwyHM5lMDqO3acWiR6BPy9jk=; b=Y9LzrMerE9CJw+UNXwzhXZ+caHRh4lCSmWWPR6O+iq10cf3LrFH7OxZR7TFZvvqvjcWdYx B7OEnv5iErS0CUvpupbOh0v1+I7CzTpl/kLNLHhwH7qP0XwylXioUuaE0Pxrm3tUmvyvrN ZTZZ+GUMPIpk6B763Vw0R98Oni/xpt0= X-MC-Unique: xrKvDfkBO7eOCGd77_-8WQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623099; x=1686215099; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kbuSBHr1MC6PAa/zfDpEwyHM5lMDqO3acWiR6BPy9jk=; b=E7ahUv3gw9wjFdhAMQz0PO9319LfgxDxGz7c8/4I+5JbnfEAHN+rfktEhWa2sp9E7r K6wbvwtWNzFV35nPnquT3cDrkLn3APKJhGTcMiVozbu86MQ4eAO0HvarxiF9BFEolTXb wEbAZGT3GEjMFayoKfTXHf4Kfu8rs8j2LHmx8wnKlBSU4BbhkX7AORXcqjeJ0XDAXljA woVioKropENKQghTOWJj84SwpUKesMakYLAYqyJ5+VRC3Y3n+l+z5o+uiBK1odYuqFd4 lFCXVAYuErHCtFpde5V239kqB6GDQO+kWn1qb6+qPEo/W3pyc21urOBNb4D8ialjVfoT WXxg== X-Gm-Message-State: AC+VfDzx1QU1eULHbEydOeyaFbcnsefofE5FZrgNU75tA7zL2qmUH1uQ Jzg2RiazkldCGTrDEAk4geCdmywU/TUKkJpMPAbUee6RAggiqJzS5si6lWZkaBgCxW2froXAna5 eisE7+zj9fnP9WsqMhBACQhzbYqmSRTUeQZMX9+29htW23z3UeFHHXDaZYcgLC93sQVPQkh/SWH 0= X-Received: by 2002:a17:907:6d0b:b0:965:5cba:4a16 with SMTP id sa11-20020a1709076d0b00b009655cba4a16mr11999489ejc.77.1683623099564; Tue, 09 May 2023 02:04:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LWxvhnVXExdpEpRa5LmpZydZ0TKL8B5LRAuqbFL3lgh5w83DCZuU7JBz1YJNTpSiJnMi/BQ== X-Received: by 2002:a17:907:6d0b:b0:965:5cba:4a16 with SMTP id sa11-20020a1709076d0b00b009655cba4a16mr11999466ejc.77.1683623099196; Tue, 09 May 2023 02:04:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 01/16] rcu: remove qatomic_mb_set, expand comments Date: Tue, 9 May 2023 11:04:38 +0200 Message-Id: <20230509090453.37884-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623145967100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- include/qemu/rcu.h | 5 ++++- util/rcu.c | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 313fc414bc2a..661c1a146872 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -87,7 +87,10 @@ static inline void rcu_read_lock(void) ctr =3D qatomic_read(&rcu_gp_ctr); qatomic_set(&p_rcu_reader->ctr, ctr); =20 - /* Write p_rcu_reader->ctr before reading RCU-protected pointers. */ + /* + * Read rcu_gp_ptr and write p_rcu_reader->ctr before reading + * RCU-protected pointers. + */ smp_mb_placeholder(); } =20 diff --git a/util/rcu.c b/util/rcu.c index b6d6c71cff5c..e5b6e52be6f8 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -83,12 +83,6 @@ static void wait_for_readers(void) */ qemu_event_reset(&rcu_gp_event); =20 - /* Instead of using qatomic_mb_set for index->waiting, and - * qatomic_mb_read for index->ctr, memory barriers are placed - * manually since writes to different threads are independent. - * qemu_event_reset has acquire semantics, so no memory barrier - * is needed here. - */ QLIST_FOREACH(index, ®istry, node) { qatomic_set(&index->waiting, true); } @@ -96,6 +90,10 @@ static void wait_for_readers(void) /* Here, order the stores to index->waiting before the loads of * index->ctr. Pairs with smp_mb_placeholder() in rcu_read_unlock= (), * ensuring that the loads of index->ctr are sequentially consiste= nt. + * + * If this is the last iteration, this barrier also prevents + * frees from seeping upwards, and orders the two wait phases + * on architectures with 32-bit longs; see synchronize_rcu(). */ smp_mb_global(); =20 @@ -104,7 +102,7 @@ static void wait_for_readers(void) QLIST_REMOVE(index, node); QLIST_INSERT_HEAD(&qsreaders, index, node); =20 - /* No need for mb_set here, worst of all we + /* No need for memory barriers here, worst of all we * get some extra futex wakeups. */ qatomic_set(&index->waiting, false); @@ -149,26 +147,26 @@ void synchronize_rcu(void) =20 /* Write RCU-protected pointers before reading p_rcu_reader->ctr. * Pairs with smp_mb_placeholder() in rcu_read_lock(). + * + * Also orders write to RCU-protected pointers before + * write to rcu_gp_ctr. */ smp_mb_global(); =20 QEMU_LOCK_GUARD(&rcu_registry_lock); if (!QLIST_EMPTY(®istry)) { - /* In either case, the qatomic_mb_set below blocks stores that free - * old RCU-protected pointers. - */ if (sizeof(rcu_gp_ctr) < 8) { /* For architectures with 32-bit longs, a two-subphases algori= thm * ensures we do not encounter overflow bugs. * * Switch parity: 0 -> 1, 1 -> 0. */ - qatomic_mb_set(&rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR); + qatomic_set(&rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR); wait_for_readers(); - qatomic_mb_set(&rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR); + qatomic_set(&rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR); } else { /* Increment current grace period. */ - qatomic_mb_set(&rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR); + qatomic_set(&rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR); } =20 wait_for_readers(); --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623246; cv=none; d=zohomail.com; s=zohoarc; b=K9oYU8mMscknMNBSkfsYEVr111sd/hexJXitGdb+AE6qPdVyhtFOhADB3lzzoTuihJMO0suUUNGpZX5ceYJY9NVrUbPYLMzdFDoBpR9AHk4IDbCmFkaxnE3UMZCzF8u1/cIgK2krzn9ntkn+3sKseGrLUs6s5z+WWjAxoWK8JrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623246; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2AXNk+ndwJjysIemRlvuC+YOxR25apRxDcvjMuMZg/k=; b=QbgEO7lm/iYWVaHS/aVRalLN8ibdRcfV4v5Q99PoR286ouSjxpfCyq36RDNSwIGMlhDtP5PG+EaQo35Y6A89czd4dj6v/UkDZFBcASaJF4nDpRwsTO4vBSawJ96nWOFpTqDKCTdOVwrEvZ2mn94WXI6ErZMMBVF3tpkcKAwfQTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623246356758.8368491747063; Tue, 9 May 2023 02:07:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHP-0005E9-T6; Tue, 09 May 2023 05:05:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHP-0005E0-32 for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHN-0004tZ-BF for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:06 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-KxSB7CSOPmu67gB9uvxGeQ-1; Tue, 09 May 2023 05:05:03 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a348facbbso691896066b.1 for ; Tue, 09 May 2023 02:05:03 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id k21-20020a170906055500b009584c5bcbc7sm1048636eja.49.2023.05.09.02.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2AXNk+ndwJjysIemRlvuC+YOxR25apRxDcvjMuMZg/k=; b=X9yC+E26zlozM/+EJRPxPR4MaenMcV1vubD86zGZRAk7bFP3VXC16/DMIfsPlOT1INMSPf jAY4kOf44hDE8u8GFabFi/iOn0mBRlFpd9BPXio5EotxtHdNlq8S8QT1kUHucc7Y4ZJi0Z z1AaWT8lliw31q+T0Ln9PvJD6STFZRQ= X-MC-Unique: KxSB7CSOPmu67gB9uvxGeQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623101; x=1686215101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2AXNk+ndwJjysIemRlvuC+YOxR25apRxDcvjMuMZg/k=; b=LJ40nZYbE1k8c2HVT449JTdaY3SKIDzU6LDsYMBylrxcI8vIh+viHCxU3M6/cIzR2g MMn6uOKOAd7kO3LGBt8BzNnAYraeVzhbJ6/r7gIxrQk7zxQCIxywmDUvzfLxnGQHc2xR W7Y8JBtrzD38jSvaCNbEcRLDrqjL7S/CCj8pZdN8o3xrOh+KYT10FwiY1yeje8hAUHy7 5iW9CUVxUIaqpg8C5hoGIaxbZ3DsU6KZYZCsIjXoPkue3m6LYeuvvOvCtdB0BQHyozcy +y++273Mkdt4wiI6gUaM0bda75dppQ7RZojVC/RA+Ff7gvTnh6XpB2kUkqV7NbpepkWj nWtA== X-Gm-Message-State: AC+VfDzZKvC7dIvs6Lb4sW+2g2DKrgxMP2WTaAPZ2MDvDFKd7bV1SXCC F1yNIXGtr80xu0VnOe2fMYygKSMc5v3OyLYLHd790ycYK4QiJ180oP8A8Yzp5WP/sRlJau4uAjV +/CsXXbPbS4rPIFNRnlLPb29yICeIEj+FCDTCHbI7FPNTj39cVd5K3V6925/tNlt5kC+roMb/Vs Y= X-Received: by 2002:a17:907:d91:b0:933:4d37:82b2 with SMTP id go17-20020a1709070d9100b009334d3782b2mr11763681ejc.57.1683623101695; Tue, 09 May 2023 02:05:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QxyHyTj3d0VhcgPnV6Ga4cbJ3JMigAgHDfztaQJjsipwsvbRkLkw1qZlhkXTKqafYXc9BHQ== X-Received: by 2002:a17:907:d91:b0:933:4d37:82b2 with SMTP id go17-20020a1709070d9100b009334d3782b2mr11763668ejc.57.1683623101433; Tue, 09 May 2023 02:05:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 02/16] test-aio-multithread: do not use mb_read/mb_set for simple flags Date: Tue, 9 May 2023 11:04:39 +0200 Message-Id: <20230509090453.37884-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623247874100001 Content-Type: text/plain; charset="utf-8" The remaining use of mb_read/mb_set is just to force a thread to exit eventually. It does not order two memory accesses and therefore can be just read/set. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- tests/unit/test-aio-multithread.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-aio-multithread.c b/tests/unit/test-aio-multit= hread.c index a555cc883505..3c61526a0b46 100644 --- a/tests/unit/test-aio-multithread.c +++ b/tests/unit/test-aio-multithread.c @@ -202,7 +202,7 @@ static CoMutex comutex; =20 static void coroutine_fn test_multi_co_mutex_entry(void *opaque) { - while (!qatomic_mb_read(&now_stopping)) { + while (!qatomic_read(&now_stopping)) { qemu_co_mutex_lock(&comutex); counter++; qemu_co_mutex_unlock(&comutex); @@ -236,7 +236,7 @@ static void test_multi_co_mutex(int threads, int second= s) =20 g_usleep(seconds * 1000000); =20 - qatomic_mb_set(&now_stopping, true); + qatomic_set(&now_stopping, true); while (running > 0) { g_usleep(100000); } @@ -327,7 +327,7 @@ static void mcs_mutex_unlock(void) =20 static void test_multi_fair_mutex_entry(void *opaque) { - while (!qatomic_mb_read(&now_stopping)) { + while (!qatomic_read(&now_stopping)) { mcs_mutex_lock(); counter++; mcs_mutex_unlock(); @@ -355,7 +355,7 @@ static void test_multi_fair_mutex(int threads, int seco= nds) =20 g_usleep(seconds * 1000000); =20 - qatomic_mb_set(&now_stopping, true); + qatomic_set(&now_stopping, true); while (running > 0) { g_usleep(100000); } @@ -383,7 +383,7 @@ static QemuMutex mutex; =20 static void test_multi_mutex_entry(void *opaque) { - while (!qatomic_mb_read(&now_stopping)) { + while (!qatomic_read(&now_stopping)) { qemu_mutex_lock(&mutex); counter++; qemu_mutex_unlock(&mutex); @@ -411,7 +411,7 @@ static void test_multi_mutex(int threads, int seconds) =20 g_usleep(seconds * 1000000); =20 - qatomic_mb_set(&now_stopping, true); + qatomic_set(&now_stopping, true); while (running > 0) { g_usleep(100000); } --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623174; cv=none; d=zohomail.com; s=zohoarc; b=FFoBbqlR4rBCe1qNzVly/4rWbkAtBfhVIFNGgmXi/m0v3Z4r35TNSEwjZLE4pfdvGBwEf/hd5H4uXTD1GEzs1YTMRyAIwQYDxeieGgBPjmtMLP4GmLCvAu0zniqoM1MYzfApzkiTyssuMNWYfCfGqw3vLxmuce3jjIKQm1IcYiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623174; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kl80vY+VUw7NnwTzuUpG42syLJf//UlV3zS0xxo1J/8=; b=eWreMgmd6iNeIoWbo6Xsx9KMXNtLD0CXrKKxW8+auNTab3XYR1qr0tCDmhcpc/vgWcE7JdPAtrx7jaEXQzuV40yTjB9fA8XcxF+T6wx8zE8pUo+Jzg3SV0H4lDfwDJnSW6/tA2XxqFijUE2WCmXY28yvskilWHR0suTAD3GAnEg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623174130101.40176076658986; Tue, 9 May 2023 02:06:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHW-0005Ez-ML; Tue, 09 May 2023 05:05:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHV-0005Eq-QG for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHQ-0004uB-Ca for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:10 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-DGiR_VcKPtuanirqRJafwg-1; Tue, 09 May 2023 05:05:05 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50bc57d7967so6441811a12.2 for ; Tue, 09 May 2023 02:05:05 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id t5-20020a05640203c500b0050d82f96860sm533070edw.59.2023.05.09.02.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kl80vY+VUw7NnwTzuUpG42syLJf//UlV3zS0xxo1J/8=; b=Mrpu557CQJWO63VLuSMFUv49NM+td0zroXe5RR8L12wJRT1tcTLMYEbrYfAEPIj46ZeyAY l9rbjrxPZ4LfTemO6NIb2krjacXbJ4wqa5AZFFyqzMTZrzUcUjT3T3RAFIs7tdR/gLiMht aC1HXLjl6PxE7O/9eC0avBQaCnx6kXI= X-MC-Unique: DGiR_VcKPtuanirqRJafwg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623104; x=1686215104; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kl80vY+VUw7NnwTzuUpG42syLJf//UlV3zS0xxo1J/8=; b=aU6sOnypjykcDzhREkvqAKrfyH9cJgVcntlcH4xzwWoWiaatF7Y71Z0CwgnnND2a7Z o5UIperB5Ox2lHJdwT2f49NJzHOg0iNlaqpd03pwyXXGs4aaD0is3PVWPxsDcCmQ/lha 6+WncBBubocf8a+9+eWgN9vCkoDYIjfCPCR67f7gx5xCQrJJq2hbWMh18WbDKYwSVEus vgjdPJglsZYHDBF6wFzuXro8V/+no6L0nZL7SztgMwrlL18cvDZ1RoE+ULLQh2YDUQAg yK0Nu8wp7+zyhx7lZm7G2DkBOEJTmc2YOApuLnD2Ct+ViovVzI0mc4zk2PQMdGCXBxqr xPVg== X-Gm-Message-State: AC+VfDxRfqzJzs9E2iOr1Bq0MGK/TKqDsq/NTFE3RK9jUxgVlgb7QIQ6 7scrHML99sBspaq2a0+G6vC8b66E+un7IoqmTVSNPyvICAmf9ukCKdSepxJh9P7m5aX5PWuc88j m5TnN9Ni7QpvlS4tG5jnLKXVr3dhPkyeCCPjN9x+px/0u2q5JR/XRwcT0Y08zHKPF784H/5pMEG E= X-Received: by 2002:aa7:d609:0:b0:50d:8894:8c11 with SMTP id c9-20020aa7d609000000b0050d88948c11mr7819558edr.11.1683623104107; Tue, 09 May 2023 02:05:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7yCN15aHIjtCpPyhBlnILQ+LQu8SBAt8LWMbB/5iyVWvO/3D1EJ14cuc5kA9Ja4aaxxxAN0Q== X-Received: by 2002:aa7:d609:0:b0:50d:8894:8c11 with SMTP id c9-20020aa7d609000000b0050d88948c11mr7819546edr.11.1683623103719; Tue, 09 May 2023 02:05:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi Subject: [PULL 03/16] test-aio-multithread: simplify test_multi_co_schedule Date: Tue, 9 May 2023 11:04:40 +0200 Message-Id: <20230509090453.37884-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623175885100003 Content-Type: text/plain; charset="utf-8" Instead of using qatomic_mb_{read,set} mindlessly, just use a per-coroutine flag that requires no synchronization. Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- tests/unit/test-aio-multithread.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-aio-multithread.c b/tests/unit/test-aio-multit= hread.c index 3c61526a0b46..80c5d4e2e6e3 100644 --- a/tests/unit/test-aio-multithread.c +++ b/tests/unit/test-aio-multithread.c @@ -107,8 +107,7 @@ static void test_lifecycle(void) /* aio_co_schedule test. */ =20 static Coroutine *to_schedule[NUM_CONTEXTS]; - -static bool now_stopping; +static bool stop[NUM_CONTEXTS]; =20 static int count_retry; static int count_here; @@ -136,6 +135,7 @@ static bool schedule_next(int n) =20 static void finish_cb(void *opaque) { + stop[id] =3D true; schedule_next(id); } =20 @@ -143,13 +143,19 @@ static coroutine_fn void test_multi_co_schedule_entry= (void *opaque) { g_assert(to_schedule[id] =3D=3D NULL); =20 - while (!qatomic_mb_read(&now_stopping)) { + /* + * The next iteration will set to_schedule[id] again, but once finish_= cb + * is scheduled there is no guarantee that it will actually be woken u= p, + * so at that point it must not go to sleep. + */ + while (!stop[id]) { int n; =20 n =3D g_test_rand_int_range(0, NUM_CONTEXTS); schedule_next(n); =20 qatomic_mb_set(&to_schedule[id], qemu_coroutine_self()); + /* finish_cb can run here. */ qemu_coroutine_yield(); g_assert(to_schedule[id] =3D=3D NULL); } @@ -161,7 +167,6 @@ static void test_multi_co_schedule(int seconds) int i; =20 count_here =3D count_other =3D count_retry =3D 0; - now_stopping =3D false; =20 create_aio_contexts(); for (i =3D 0; i < NUM_CONTEXTS; i++) { @@ -171,10 +176,10 @@ static void test_multi_co_schedule(int seconds) =20 g_usleep(seconds * 1000000); =20 - qatomic_mb_set(&now_stopping, true); + /* Guarantee that each AioContext is woken up from its last wait. */ for (i =3D 0; i < NUM_CONTEXTS; i++) { ctx_run(i, finish_cb, NULL); - to_schedule[i] =3D NULL; + g_assert(to_schedule[i] =3D=3D NULL); } =20 join_aio_contexts(); @@ -199,6 +204,7 @@ static uint32_t atomic_counter; static uint32_t running; static uint32_t counter; static CoMutex comutex; +static bool now_stopping; =20 static void coroutine_fn test_multi_co_mutex_entry(void *opaque) { --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623215; cv=none; d=zohomail.com; s=zohoarc; b=jQAmo576S9e07/e1dVjZZxRnKnbVbn8E3mm4FjQx3YoqAl5OKhXKh30TnIMt9lJ2HkJ3at3DgtNm5wyUoD8X4XGEPrjTFAMPAwjJstSTIrsLjxW3klMp+ezXbg4RynkbM1Ai4mb0nmEZs5dcBLME0GqmvuGJ3h5gNahd9uSkYSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623215; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7G0JGRJuNzOy08wxI94uhJe0IVFxaXWeMU7b25jAV+E=; b=P+JCL7mcK7PHc8YCvaZ4ko2n+B988AD79roTMAXusKTwVtEAgD2NIcvGs4qwSKNHZQ6+Y8RNbWVl7c9moCIrvB48gPr2HjQ8uySlvE3QAZf3Y1nmmO/m1AclZpfs+7W9wlrp/lkkP/IzCXpENdyr8uGLA6PlrMvUo+7zsUllhLY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168362321507947.444366190560345; Tue, 9 May 2023 02:06:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHY-0005Fh-Ml; Tue, 09 May 2023 05:05:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHW-0005Er-TA for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHR-0004uO-5b for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:12 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-0KkK-_LAMIevSfmMp0YZhA-1; Tue, 09 May 2023 05:05:07 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a355cf318so646341566b.2 for ; Tue, 09 May 2023 02:05:07 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id e19-20020a056402089300b0050bd9d3ddf3sm515052edy.42.2023.05.09.02.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7G0JGRJuNzOy08wxI94uhJe0IVFxaXWeMU7b25jAV+E=; b=WPsYeXPAOfC4VpF16RGMRY3wXOrYX88bqLAI6qP3KkV8C/pje3CrUc9gqFxGekp5dFavT8 LYzk9Pxr0axi6nQ9Hd0VOHgo5EWVXUlEGrMk3C3nzGatwzaogUmps7n8dm/dfcrzmQQt60 YaDXaAPwgPSzbdGGgvct0WT5fULsUrY= X-MC-Unique: 0KkK-_LAMIevSfmMp0YZhA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623105; x=1686215105; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7G0JGRJuNzOy08wxI94uhJe0IVFxaXWeMU7b25jAV+E=; b=PJU0mUvLo4Us+is/YQARfgPjeAHKTZb7YT4rwvxTPyjBc7c4S/7HQarrIT0YoWBLHG UmW8jAFsSMsCcFAhfrMlJSxfX0X4b5wmp/3hLC7fJKjKS3+hvWHuQOb1rHpZUO5lfm2y LSSH6ALlPIzP0hNsBSVQmz5FSgf1u3KjSVKfc9r5QgE1dJE/tjXvuyY6fdTaDS8PCnQ+ mAL7f12HbVJiAvaIQMk7ntniJajI3gLCcbWtP21cfne7cMARRMykHfGNhmDPm8yRm/JU 6jPd2Q6bzs9M5eDju44Eim1BsOvKM6Yy8LrkRFjVJAA2bbjTVXJ+leF3gmiPr5z1GbQS FaKQ== X-Gm-Message-State: AC+VfDygQd/pWT17r6smfY4U3rD4xZXvrGtVDw6V/Da5CAlv3rfqKpRc ZzgLXyo/Z/F72w3TV0rD1ziujOsLHwlxG3wknuy5WvflP0jUd4EpFHhE+Z2nIw3a97B3I0znPv/ k+IFiBtq6Fo3Qomq/v0fuCiXMWQXjLmAILzgBrLNBy1lEvbsDXT/XFwAHlgs457qH5SARSqh76s I= X-Received: by 2002:a17:907:9718:b0:966:c09:1c57 with SMTP id jg24-20020a170907971800b009660c091c57mr10250180ejc.65.1683623105598; Tue, 09 May 2023 02:05:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bMef7WgTQWa7iaG3to+nl5dibZJ8I3YSiY55JUrhGJovmTRs03E0ddAVAvSH4gXeA6NcldQ== X-Received: by 2002:a17:907:9718:b0:966:c09:1c57 with SMTP id jg24-20020a170907971800b009660c091c57mr10250146ejc.65.1683623105216; Tue, 09 May 2023 02:05:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 04/16] call_rcu: stop using mb_set/mb_read Date: Tue, 9 May 2023 11:04:41 +0200 Message-Id: <20230509090453.37884-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623215705100001 Content-Type: text/plain; charset="utf-8" Use a store-release when enqueuing a new call_rcu, and a load-acquire when dequeuing; and read the tail after checking that node->next is consistent, which is the standard message passing pattern and it is clearer than mb_read/mb_set. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- util/rcu.c | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/util/rcu.c b/util/rcu.c index e5b6e52be6f8..30a7e220264a 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -189,8 +189,22 @@ static void enqueue(struct rcu_head *node) struct rcu_head **old_tail; =20 node->next =3D NULL; + + /* + * Make this node the tail of the list. The node will be + * used by further enqueue operations, but it will not + * be dequeued yet... + */ old_tail =3D qatomic_xchg(&tail, &node->next); - qatomic_mb_set(old_tail, node); + + /* + * ... until it is pointed to from another item in the list. + * In the meantime, try_dequeue() will find a NULL next pointer + * and loop. + * + * Synchronizes with qatomic_load_acquire() in try_dequeue(). + */ + qatomic_store_release(old_tail, node); } =20 static struct rcu_head *try_dequeue(void) @@ -198,26 +212,31 @@ static struct rcu_head *try_dequeue(void) struct rcu_head *node, *next; =20 retry: - /* Test for an empty list, which we do not expect. Note that for + /* Head is only written by this thread, so no need for barriers. */ + node =3D head; + + /* + * If the head node has NULL in its next pointer, the value is + * wrong and we need to wait until its enqueuer finishes the update. + */ + next =3D qatomic_load_acquire(&node->next); + if (!next) { + return NULL; + } + + /* + * Test for an empty list, which we do not expect. Note that for * the consumer head and tail are always consistent. The head * is consistent because only the consumer reads/writes it. * The tail, because it is the first step in the enqueuing. * It is only the next pointers that might be inconsistent. */ - if (head =3D=3D &dummy && qatomic_mb_read(&tail) =3D=3D &dummy.next) { + if (head =3D=3D &dummy && qatomic_read(&tail) =3D=3D &dummy.next) { abort(); } =20 - /* If the head node has NULL in its next pointer, the value is - * wrong and we need to wait until its enqueuer finishes the update. - */ - node =3D head; - next =3D qatomic_mb_read(&head->next); - if (!next) { - return NULL; - } - - /* Since we are the sole consumer, and we excluded the empty case + /* + * Since we are the sole consumer, and we excluded the empty case * above, the queue will always have at least two nodes: the * dummy node, and the one being removed. So we do not need to update * the tail pointer. --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623228; cv=none; d=zohomail.com; s=zohoarc; b=ka4FUiWzkY0p5wloRVL3qo8uMHRPdnIzzb81O1EHP/bH5qa1Df9Fp1/zOt7OJ6P8R2oiQAfjrh9uL1A2JXxiHTLtV9rsQ9VzagDgYPEclXJT/ekJy6ohZm3zH3i971KVpKjk+pQuZkrfTqD7GwQeZI4NreVzXrbx13iM0kSpAAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k+Hy7863bVVg2b9P3/Vu2bssKtfYLZ8Nym6z4eY/5m0=; b=Iy+AWVvNQ0SrXpNRxAzRohqwOJ5m7FgUdyDF/8L/Wqs9vOqZ2MM/uiWXGcAa+FY6hQZg+KHsUGoq6coXZSrrPUraAjf22mlrXNoYcPcL0CjCGmmBtRHAzGC4FDm1XiaT2/8KyniwBSS2Obffm+MGKhrFnOigvWS7KkgJ+LWQQp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623228433974.1368933879164; Tue, 9 May 2023 02:07:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHc-0005GK-48; Tue, 09 May 2023 05:05:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHa-0005Fo-ES for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHV-0004up-Jw for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:18 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-EO7W7GGhOqmt5Ym0KlHNoQ-1; Tue, 09 May 2023 05:05:08 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-94a341ee4fcso694836866b.0 for ; Tue, 09 May 2023 02:05:08 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id ia6-20020a170907a06600b00969c3a9769csm891938ejc.201.2023.05.09.02.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+Hy7863bVVg2b9P3/Vu2bssKtfYLZ8Nym6z4eY/5m0=; b=W++dyYLF3kAwMfWehG37SwBu8bdHJxkWsX9v5feohkL/5HVJNBQH10zqjs5CMoMZYbqKOk HMw78SnS9u7CXoXXr019qXkZ6xPhAAHB4IKk3WpaQCKITlUkmlgdfJuLVj3iEhmAmy9AdF lUmsLnhOE1i16F01kcKsD/smS1odFOg= X-MC-Unique: EO7W7GGhOqmt5Ym0KlHNoQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623107; x=1686215107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k+Hy7863bVVg2b9P3/Vu2bssKtfYLZ8Nym6z4eY/5m0=; b=h6H8X/UooAMAL8ZvW8rVCedYA8EoWwcl5gi7pAzvVms50vJ4ayEQ172HISPiiTkaZV nRuqxpReFGBkxirQr5UznNjoko5L3H4z2ucy03SJr1VZXgrwIdn7Sz+17+kG/ez6MHlF LCnY2RvZ4ksmWJtJoQFmwylUlLPqwtPQpJCO9Eanp3xmJ9ctA0Wwxbskjwn5otcKgv3h SfMJof6/BjjBc/nMFkHCd8IIib8NS9s10qYOAP5mNWHka3twzF3Ce0NjsjuMRPNibkXw v5FD3jbIqAYnr+EkW1h8hlul4CLtB4d60ewIaIXqJrB2h3qzfceAUk25nUzGZ60zHPxn NWxw== X-Gm-Message-State: AC+VfDy35sziqFTSqNLfGr4d2fIRyMyGnWYGMnbMF+Lr/iCbA5HQaPt0 BD77vB1lyrErWCf7LiSHhmson5e5swsgwZ8VK7buWL+7tHzG7tmMVk0ZDEkRdfCvDQSxa/xHb9C HcHT449j1fGquOI5zRMEX538ZZDuBckd+1b7dj5cRjwy0V8tI+/W8Ewne4kId5699AmQHZSWQ/o 8= X-Received: by 2002:a17:906:ef04:b0:94a:4eba:45d3 with SMTP id f4-20020a170906ef0400b0094a4eba45d3mr10165701ejs.30.1683623106971; Tue, 09 May 2023 02:05:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67d4TBaODHtMI5WYC56BF/VYtiKygmHpPL5b1yn38xffVG5L3iOQdBrTFDzm3pmAjLFz+pWQ== X-Received: by 2002:a17:906:ef04:b0:94a:4eba:45d3 with SMTP id f4-20020a170906ef0400b0094a4eba45d3mr10165690ejs.30.1683623106724; Tue, 09 May 2023 02:05:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 05/16] tb-maint: do not use mb_read/mb_set Date: Tue, 9 May 2023 11:04:42 +0200 Message-Id: <20230509090453.37884-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623230424100011 Content-Type: text/plain; charset="utf-8" The load side can use a relaxed load, which will surely happen before the work item is run by async_safe_run_on_cpu() or before double-checking under mmap_lock. The store side can use an atomic RMW operation. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- accel/tcg/tb-maint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index cb1f806f00d4..0dd173fbf048 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -746,7 +746,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data = tb_flush_count) =20 tcg_region_reset_all(); /* XXX: flush processor icache at this point if cache flush is expensi= ve */ - qatomic_mb_set(&tb_ctx.tb_flush_count, tb_ctx.tb_flush_count + 1); + qatomic_inc(&tb_ctx.tb_flush_count); =20 done: mmap_unlock(); @@ -758,7 +758,7 @@ done: void tb_flush(CPUState *cpu) { if (tcg_enabled()) { - unsigned tb_flush_count =3D qatomic_mb_read(&tb_ctx.tb_flush_count= ); + unsigned tb_flush_count =3D qatomic_read(&tb_ctx.tb_flush_count); =20 if (cpu_in_exclusive_context(cpu)) { do_tb_flush(cpu, RUN_ON_CPU_HOST_INT(tb_flush_count)); --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623187; cv=none; d=zohomail.com; s=zohoarc; b=JjBmgYl92tf5SgnBWW7DOpeVsJlXxaXVl6y3DF0hN7Am/7OLtE6nCTrHBwFf+D1xcV32R6TUeyzW7Nv2NZvDSwO/7H5jQegpnmzKLDAsbfTcYR4DlyCSXpj58Dcyq9/rosIMNfbrs/BiEqU5DnnKFHcB+jDCnBoJ4k5LuYI7CDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623187; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XF+9trcgwcQ5RKOh8bKidL0/LjIKx4RL/4OZJgAfRtA=; b=L+wudzlMgdOXyNIa8O3C0H/5/Tbbrfg9XS7xUGelzCmgfGmM0IKSB/jSaNu37Sfyl7imd1DP1r72jApdId82e/iHzIL2ctzZrY1zVF1ue+0n0Id9QIoFrmoXTidwakUY35xoXwbHw9/62bR+cwhzBLEZw3B3KMemdoApzTwXnt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623187614921.0613151169424; Tue, 9 May 2023 02:06:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHf-0005Ho-RH; Tue, 09 May 2023 05:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHb-0005G5-Jz for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHV-0004v1-Qs for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:19 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-38-P4bVdj1sPkidpf9vPVN-eg-1; Tue, 09 May 2023 05:05:10 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50a094d5876so6423750a12.3 for ; Tue, 09 May 2023 02:05:09 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id m26-20020a50ef1a000000b0050690bc07a3sm533192eds.18.2023.05.09.02.05.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XF+9trcgwcQ5RKOh8bKidL0/LjIKx4RL/4OZJgAfRtA=; b=Rl2jwCzeuW9Y+2EWKhTy3TMvBYLuwbxUIyEypiDBIiRo0L2DcOKcRGN7crxgdeZ8uAHYc2 Xj2x+MylDOpz4sP4dsOaeZSiN5IPojRpCJFLZLg1XRNu7tOipR/KOmAiUnTN69BcmqQsyY sLlloXcICR8fjxFovVap05+PxGajo5A= X-MC-Unique: P4bVdj1sPkidpf9vPVN-eg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623108; x=1686215108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XF+9trcgwcQ5RKOh8bKidL0/LjIKx4RL/4OZJgAfRtA=; b=g9BBz7lz5Ewlioeva2LMACETZEbzHTwK5NGD5RvYhcWTiw8oPmJt5q73niHtwzaChg NxEq0ieO7GG7k+NNH0RxUxV6glKSRqQ6mYMFZM318+XFCh+tSbnvmoXA5XDt+tyhPhm+ elQJh84bOQV0nhtI61dY5geopDhqKrJ6KgvEbGN+EuLIzcXEmXDQlq9aJW2m5g2G6J5V oLM1kjF0fXl8jaQjsIMKmubmvcGUeyd8i9qT2YIq1GT/etqau3c48zpjS3mpXIuSLYVF 19R4TD+JJ8PhSj9dJGHhXW/oMVQjeaJEhuyOiZ6/OuxojQ+DFKrIRksZDlLjRUALjeq6 O6Kw== X-Gm-Message-State: AC+VfDzTHr8dibik0DmyMthVknVWDg0ghdREZSt9cJPyC5vA1tt0xkoI GHBmGgMhCd40Eg9cMr8IakJBETMLpnl0UMElNPSINM/vF4nRxswifrbXOb8TdbZLT3BcLsIf8a5 cO5h7KXBZK1fjEmg2rnLuXbV+QcZzWbgaxIdYIfZSc2YGCqUO62CVGS1drFyDjEyRRwBDmeRBn+ o= X-Received: by 2002:a05:6402:886:b0:50d:b7e5:fde8 with SMTP id e6-20020a056402088600b0050db7e5fde8mr1299874edy.26.1683623108584; Tue, 09 May 2023 02:05:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7goL1F+56z9MJ5H7Lla6wejDULRG3Jj2rHJlgjitHDsmL67rt3h1bGKqezE9U6j6AShk3oSA== X-Received: by 2002:a05:6402:886:b0:50d:b7e5:fde8 with SMTP id e6-20020a056402088600b0050db7e5fde8mr1299860edy.26.1683623108168; Tue, 09 May 2023 02:05:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/16] MAINTAINERS: add stanza for Kconfig files Date: Tue, 9 May 2023 11:04:43 +0200 Message-Id: <20230509090453.37884-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623188754100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 55102f476184..f757369373f5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3910,6 +3910,16 @@ F: configure F: scripts/mtest2make.py F: tests/Makefile.include =20 +Kconfig +M: Paolo Bonzini +S: Maintained +F: scripts/minikconf.py +F: docs/devel/kconfig.rst +F: Kconfig* +F: */Kconfig* +F: hw/*/Kconfig* +F: target/*/Kconfig* + GIT submodules M: Daniel P. Berrange S: Odd Fixes --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623240; cv=none; d=zohomail.com; s=zohoarc; b=EK9ft+oqVE4DJXrHQSFTdk++KUkgqpdYBRuDDVBDpLluVJVsoMIw8HNtUKERb4aQ5ibKqv8rvuN7JSwiLKS2LuZor3mNlu66Qs/79l1QfYi1KsqvHnO2yDjhqpb2zngyeCQ6y+/SOksrgns8S8Ezi3Lcw0Gj4Myu+lKl0BHcJpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fa+E1cn+aXVgyQqv6KJG8RpWbfGinqZr96xu6cSJyhw=; b=lD1ertl9RDcDwnvKb3VPVXADPc7VS4J5GXfEadMOnH9gph1KTqlCEFMlk7Or3HyEkHzUhs4XzRhuLNGc3eekuUO0sm8zpjoYLSFila8v5HkWX0+cJvwozFYQn+63R39xgIZ+6A5LsaYYNsxEQoKNaS5Lx61XFouFPDcJmMunjNA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623240312402.08975606417016; Tue, 9 May 2023 02:07:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHc-0005GM-AM; Tue, 09 May 2023 05:05:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHa-0005Fm-9m for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHV-0004vL-Nt for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:18 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557-wMyB7eiHMjOCzoJbjOb2aQ-1; Tue, 09 May 2023 05:05:11 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50bd1f08901so5347328a12.0 for ; Tue, 09 May 2023 02:05:11 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id i18-20020a1709067a5200b009661afd3b86sm1068205ejo.171.2023.05.09.02.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fa+E1cn+aXVgyQqv6KJG8RpWbfGinqZr96xu6cSJyhw=; b=ANzLpDCJmeoaGi6ZUq5/XtVar5LL7F0Poh5VgSkPI5hZPSyL0YpwlS86LVth6HHahUPRZA IFggCgM9S5alF1aLY/tOvdMiz6vNmQOP8sc1Taq/zCYuyY3GreeLbMzwISw2I9XSxQFZVt l8qWOzBNd5dVqGKgOE2fZdd2HvAp5mY= X-MC-Unique: wMyB7eiHMjOCzoJbjOb2aQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623110; x=1686215110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fa+E1cn+aXVgyQqv6KJG8RpWbfGinqZr96xu6cSJyhw=; b=MRnDD7yY6jyao/cPIK+6jGQDqSeXyIiDd3ytXeleWl/0f3p/G0QklaGpQuVIi90+cT SHuI5+CTeZIyAVHpAKn+MQzxfQ+tUsN5c04ySI3MxZJovz49+QReqgIyAZTHXWuv/DyM MQcNSM3WUZghoj+KDrBOz84n6aSXtyBhxamhuWKBz6P8G84Hr/AIGO5CTXnMMT3dm9oo 2UjPdMSs8d4wD3StXpsTjvCiEHhhbrtJQW3pfVD0uOQPDTG3aE3CSqPh0WnLBZosOX1w z21jP1Af890s7o0FYXprdeJn1Ydh85zDzlexfadEH8HB8OX9gcsKVG0bDbXtMx0HBZxL nQ3A== X-Gm-Message-State: AC+VfDxNhIupWzBHg9H0lZYuRc/K5f6pdkCylsi0BNZOM0S2BZ5uC8BX sdSTZG+muXPeskGwDCafsVkOA5f1O9qwqtF7SWm4Iq6vOXmT+pCOx7v7xB5Pc1kRyPGNN4JoSH5 Ei79yVqdlD9/+iTkW2fshSMuJWiLP793ssYcA7LfBS4I7NIf9PMtz+GzS5w1vvPTP3omItf1ohU 4= X-Received: by 2002:a17:907:78c:b0:953:43a1:1988 with SMTP id xd12-20020a170907078c00b0095343a11988mr10635485ejb.46.1683623109896; Tue, 09 May 2023 02:05:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GDK9OPvwO5HVNjGHpaEBY65H09O7hA6rI7ePn8QYVwJ3S9EldzmAVKPUSAq5uXQG9RZHBHw== X-Received: by 2002:a17:907:78c:b0:953:43a1:1988 with SMTP id xd12-20020a170907078c00b0095343a11988mr10635466ejb.46.1683623109606; Tue, 09 May 2023 02:05:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 07/16] include/qemu/osdep.h: Bump _WIN32_WINNT to the Windows 8 API Date: Tue, 9 May 2023 11:04:44 +0200 Message-Id: <20230509090453.37884-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623240566100005 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Commit cf60ccc330 ("cutils: Introduce bundle mechanism") abandoned compatibility with Windows older than 8 - we should reflect this in our _WIN32_WINNT and set it to the value that corresponds to Windows 8. Signed-off-by: Thomas Huth Message-Id: <20230504081351.125140-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/osdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 9eff0be95bd5..cc61b00ba9b7 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -75,7 +75,7 @@ QEMU_EXTERN_C int daemon(int, int); #ifdef _WIN32 /* as defined in sdkddkver.h */ #ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0601 /* Windows 7 API (should be in sync with glib)= */ +#define _WIN32_WINNT 0x0602 /* Windows 8 API (should be >=3D the one from = glib) */ #endif /* reduces the number of implicitly included headers */ #ifndef WIN32_LEAN_AND_MEAN --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623261; cv=none; d=zohomail.com; s=zohoarc; b=kpqHXRRzNA/3t+I9jIrWxsLL0CjrDLvoWpEvXO9ZzoGrP3W+JxCliFSr5i6GzN5Q0XXCWfXp1rxc2vwti0tWTkgMU6idhIXuy1uuXAuq0foMT8hDB8fZP8s5WqUaPe8Qnkzm/2o8MlHDwu/eCRNKgvgRB8l0Y7ESh7NrPxfBXB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gFN0jm8tj0b98Q7AjbSUpEoKREbax20RBwvfW1MvJdk=; b=KxuGiynsBu6adM22FjuSm24r/iPoF7yyVoTcji5Fmx4G2935W9glVhZWvn87NAkpXDNnrhdO+QUP4AyBqa02REX8qoszpetM0QBt70Yoef3WtEDlbg8ZJv3e/u4u2MpRJANSGbFykevsLiHAKUCZzjLxA8yluX8KsEbgsLIgMoY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623261761848.4220597911316; Tue, 9 May 2023 02:07:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHf-0005Hn-Qj; Tue, 09 May 2023 05:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHc-0005GS-Ds for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHX-0004vX-8P for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:20 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-132-RP3PNetzNlKNyXE2crNv-A-1; Tue, 09 May 2023 05:05:13 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9532170e7d3so537400866b.0 for ; Tue, 09 May 2023 02:05:13 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id gv11-20020a1709072bcb00b009663cf5dc43sm1052237ejc.181.2023.05.09.02.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gFN0jm8tj0b98Q7AjbSUpEoKREbax20RBwvfW1MvJdk=; b=ZmAuYHAoydyA5GlbiP2f74gV6ayxz2v/+xz4qtK+DvfDB/jnSVTNgLsmNCNcJZIRhPiRqI 2xHHsXjoylXjKsuN0DRlIiTAY+h3XXumCyLX7laIJgqnkPi/OFgMrOEhhZ0rxRcncEiQyr GvR97g49DS32vWftkHyX5z6ssR4YsPA= X-MC-Unique: RP3PNetzNlKNyXE2crNv-A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623111; x=1686215111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFN0jm8tj0b98Q7AjbSUpEoKREbax20RBwvfW1MvJdk=; b=PEVETnyuidOqTcH0AQRrCVfT2gaqSSNdBkTUM070F652/3cAPGTiLEDbOQRbF3piQa piK5Vop9jgBhbnJewb2lvh0pNWhC/g3dXHskf4NcHAP0fm+ca8z1sZ5Z6ZEVhMbSRsl2 00I7XKgWnBKfyRPbBAYGqAUxVrXs86hRQb5KWwHrQqEP0lytn6l1KtfLOvKfkz0vTzUd QT5tft96ujJwZzJHTbESZzzELLcKddU73/hWTWoRN0HGP8j4qMgrYwXOj7MU6Re7Te4u 6ESyQnE4wtZHKnMn0LIOEPSrvx4xaCLHV2Q2RciRCGusaLNMT7Pq/dKt6Tn1eB5Usrxp TCow== X-Gm-Message-State: AC+VfDzpiLOsgc33AHKQ3DpHSI3mZQCi5kpWqjSxzFgzPR1vxRqoBWIl k1VvDW+SOiNFLhynNfiiTv3IcWC6a4a13KcuxvYocf/vy3Q2muXQfha4H8RUiii0P5vVLKYoTAZ Kx7FdAEAUVXMjT40TTYOdkVQ74sv0A1ioBygRzMWPvwWnwQ7gj5FZUl2Ehgq9utpXX1kLB4e0m9 w= X-Received: by 2002:a17:907:1c05:b0:930:f953:9608 with SMTP id nc5-20020a1709071c0500b00930f9539608mr13789308ejc.0.1683623111614; Tue, 09 May 2023 02:05:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4T4uS7JQtd5gFto6m6u0vPSgG5AiBZVtSeM33BdaF4QBcQzDQPU6nCpB1RHnQvcwmZCObAHA== X-Received: by 2002:a17:907:1c05:b0:930:f953:9608 with SMTP id nc5-20020a1709071c0500b00930f9539608mr13789278ejc.0.1683623111149; Tue, 09 May 2023 02:05:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Michael Roth , Wei Huang , Babu Moger , "Michael S . Tsirkin" Subject: [PULL 08/16] target/i386: allow versioned CPUs to specify new cache_info Date: Tue, 9 May 2023 11:04:45 +0200 Message-Id: <20230509090453.37884-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623263630100007 Content-Type: text/plain; charset="utf-8" From: Michael Roth New EPYC CPUs versions require small changes to their cache_info's. Because current QEMU x86 CPU definition does not support versioned cach_info, we would have to declare a new CPU type for each such case. To avoid the dup work, add "cache_info" in X86CPUVersionDefinition", to allow new cache_info pointers to be specified for a new CPU version. Co-developed-by: Wei Huang Signed-off-by: Wei Huang Signed-off-by: Michael Roth Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin Message-Id: <20230504205313.225073-2-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 823320fe420c..855d5abc7d17 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1620,6 +1620,7 @@ typedef struct X86CPUVersionDefinition { const char *alias; const char *note; PropValue *props; + const CPUCaches *const cache_info; } X86CPUVersionDefinition; =20 /* Base definition for a CPU model */ @@ -5225,6 +5226,31 @@ static void x86_cpu_apply_version_props(X86CPU *cpu,= X86CPUModel *model) assert(vdef->version =3D=3D version); } =20 +static const CPUCaches *x86_cpu_get_versioned_cache_info(X86CPU *cpu, + X86CPUModel *mode= l) +{ + const X86CPUVersionDefinition *vdef; + X86CPUVersion version =3D x86_cpu_model_resolve_version(model); + const CPUCaches *cache_info =3D model->cpudef->cache_info; + + if (version =3D=3D CPU_VERSION_LEGACY) { + return cache_info; + } + + for (vdef =3D x86_cpu_def_get_versions(model->cpudef); vdef->version; = vdef++) { + if (vdef->cache_info) { + cache_info =3D vdef->cache_info; + } + + if (vdef->version =3D=3D version) { + break; + } + } + + assert(vdef->version =3D=3D version); + return cache_info; +} + /* * Load data from X86CPUDefinition into a X86CPU object. * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. @@ -5257,7 +5283,7 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUMod= el *model) } =20 /* legacy-cache defaults to 'off' if CPU model provides cache info */ - cpu->legacy_cache =3D !def->cache_info; + cpu->legacy_cache =3D !x86_cpu_get_versioned_cache_info(cpu, model); =20 env->features[FEAT_1_ECX] |=3D CPUID_EXT_HYPERVISOR; =20 @@ -6736,14 +6762,17 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) =20 /* Cache information initialization */ if (!cpu->legacy_cache) { - if (!xcc->model || !xcc->model->cpudef->cache_info) { + const CPUCaches *cache_info =3D + x86_cpu_get_versioned_cache_info(cpu, xcc->model); + + if (!xcc->model || !cache_info) { g_autofree char *name =3D x86_cpu_class_get_model_name(xcc); error_setg(errp, "CPU model '%s' doesn't support legacy-cache=3Doff"= , name); return; } env->cache_info_cpuid2 =3D env->cache_info_cpuid4 =3D env->cache_i= nfo_amd =3D - *xcc->model->cpudef->cache_info; + *cache_info; } else { /* Build legacy cache information */ env->cache_info_cpuid2.l1d_cache =3D &legacy_l1d_cache; --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623252; cv=none; d=zohomail.com; s=zohoarc; b=Zbnt/kuVxrg2dZam4F4NjSnQldXPMF50O3Sjqnpc+YS/UvYd1EopIKRcHEkThkzvgbw0DQA9ZqiwZtrUY91vZGlCmdSxCw88cOVbJQqB7Hr8ph8/5+3xEC39C2HngFY+rkRVNT7dH1HHF3cSMulVrkLCKzlYiTp/Hf+0qfh4WfY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623252; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iHtz1R5xTm3A3Q87YFGwhJKuGLnMN/OlP78AmUeRxv0=; b=E7mr7HCSOUsbztJGWlwquM4fTicKlhk1vIBOIjct34mJ3njl/4Jk69XNrem9MZ6SYjmfRqb39OfXXryEshlCOkSsm/gstFwVFmzyaQgLHd+LuWAAh+XmUkqkbtrI1rEC8VWEgycDE8DjjjBthH4qm09lYXzYDTgHcn4VzDBps4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623252424579.8405684156808; Tue, 9 May 2023 02:07:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHf-0005Hk-4Q; Tue, 09 May 2023 05:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHd-0005H3-1V for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHY-0004ve-5A for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:20 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-Gs5xagaOMDCU44wHqqj75A-1; Tue, 09 May 2023 05:05:14 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-965c6f849b9so592806166b.2 for ; Tue, 09 May 2023 02:05:14 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id ze12-20020a170906ef8c00b009659fa6eeddsm1053353ejb.196.2023.05.09.02.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iHtz1R5xTm3A3Q87YFGwhJKuGLnMN/OlP78AmUeRxv0=; b=QXkcfMr0G87Tm0jbfgf0MDN27ftxx9QTkTOAKHlHW4PHpD7bCmKr9ms90f4CA38ELm44dr pzSnRjawCN8sMGwoOQLI7wbt2NM8tXUdXuOSpk3ZvDJY6vswv4HQEoTkOuku03z3Tln+X0 ahMSc6C5u2P5QCH5Hi6exXNc9vR+GVQ= X-MC-Unique: Gs5xagaOMDCU44wHqqj75A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623113; x=1686215113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iHtz1R5xTm3A3Q87YFGwhJKuGLnMN/OlP78AmUeRxv0=; b=XXCVCQU/P2YYHLBqIvY35A9Pksy/eqTgiINrk2ARUIuF8x1nfriXS5t13o37qXm6EF L5zk4vre8kDBz4blT4OlZ+J0+ypuLW/QYbCMyH+KqhYo0hIWfOllVxOq1ov0oidJv6vI xuIzXguWkH1PAawKKXk/ktjdTGN/g79xwnnGoI0A2goTIoBBYPA4KJE8W8+fgrYJCmmn GoY7F0nhIZMzkxmrE7YMexWRa8tOrNgIPzOSWYe/UaMMpXDrpX4PpQnDrdHBg4QbKXA2 AnfKx5sRtxwqcab1s9yXAiR5wjuDT+fFTLycI+gg7Xpd0DbMsoODulqtaFh2c1m+0R6C 63fA== X-Gm-Message-State: AC+VfDzZbvoq5jZc/gw9gi6OCvlpPQKnH6e6NsqzIv0bQOrmIPqp3Vfq EQ0AAXvMMvKHl5XMDiLLmgV6zvm8nThfKy1miuuGJLre1pY8SqYvyvcxt8edfl3+qkg2O6Y0beN EE31a2Uum8JrzQc86Dw2zvoEQ17JlGz7c/h0hQAbpKrliy6dJ7HXA+wHaqIb1S2xjuBPnlq09dD A= X-Received: by 2002:a17:907:eab:b0:969:813c:9868 with SMTP id ho43-20020a1709070eab00b00969813c9868mr3466093ejc.18.1683623113073; Tue, 09 May 2023 02:05:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66UsezZVc0KL8byxJz+K+cx/tR9v3F0lnWIkragXPHbaFeBbu+9N49esvv9a450vg3CcOCDA== X-Received: by 2002:a17:907:eab:b0:969:813c:9868 with SMTP id ho43-20020a1709070eab00b00969813c9868mr3466070ejc.18.1683623112770; Tue, 09 May 2023 02:05:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Michael Roth , Babu Moger , "Michael S . Tsirkin" Subject: [PULL 09/16] target/i386: Add new EPYC CPU versions with updated cache_info Date: Tue, 9 May 2023 11:04:46 +0200 Message-Id: <20230509090453.37884-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623253893100001 Content-Type: text/plain; charset="utf-8" From: Michael Roth Introduce new EPYC cpu versions: EPYC-v4 and EPYC-Rome-v3. The only difference vs. older models is an updated cache_info with the 'complex_indexing' bit unset, since this bit is not currently defined for AMD and may cause problems should it be used for something else in the future. Setting this bit will also cause CPUID validation failures when running SEV-SNP guests. Signed-off-by: Michael Roth Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin Message-Id: <20230504205313.225073-3-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 855d5abc7d17..90a650a836a0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1729,6 +1729,56 @@ static const CPUCaches epyc_cache_info =3D { }, }; =20 +static CPUCaches epyc_v4_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 64 * KiB, + .line_size =3D 64, + .associativity =3D 4, + .partitions =3D 1, + .sets =3D 256, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 8 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 8192, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + static const CPUCaches epyc_rome_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { .type =3D DATA_CACHE, @@ -1779,6 +1829,56 @@ static const CPUCaches epyc_rome_cache_info =3D { }, }; =20 +static const CPUCaches epyc_rome_v3_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 16 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 16384, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + static const CPUCaches epyc_milan_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { .type =3D DATA_CACHE, @@ -4113,6 +4213,15 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .version =3D 4, + .props =3D (PropValue[]) { + { "model-id", + "AMD EPYC-v4 Processor" }, + { /* end of list */ } + }, + .cache_info =3D &epyc_v4_cache_info + }, { /* end of list */ } } }, @@ -4232,6 +4341,15 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .version =3D 3, + .props =3D (PropValue[]) { + { "model-id", + "AMD EPYC-Rome-v3 Processor" }, + { /* end of list */ } + }, + .cache_info =3D &epyc_rome_v3_cache_info + }, { /* end of list */ } } }, --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623218; cv=none; d=zohomail.com; s=zohoarc; b=NkXRmDS9MF70DdT1SwNh7xm5f0Q9CjLJYwkFg/lE7TDNWkV9Oj4HuZ90wGe31jXbVmywAje78LZ3YAPAJTRbpybkHZBhckRpDUOM0wKIynU7sWooRp4aIXSdoPROWtJ5359xQhnm5oJFTiAL0vImuyeqEaJjRf7dNbKo2PMnJ+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623218; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1aY2LkynvDT/iTVr4Ey1aaB7sG+QqosvRAFtEKonjlA=; b=Rn9nJl17CusaGiRIGDwHmitd3S1SQmRxa5vCDeKJtMcQCOmBTT8T9+V2SoXC6cc6CeHiUCegjCdTDO7CPq2Sz2MXybXWoLfaGMB9GPr0oPQkVojRmVYirYNlyLRCdBLtWD3ysZpRfBrm98lTH1LnU03ZsmJT/8ZEWxH4NMOIMx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623218755291.8992587814322; Tue, 9 May 2023 02:06:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHk-0005bV-3H; Tue, 09 May 2023 05:05:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHh-0005QS-5n for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHZ-0004vo-Rl for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:24 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-434-CYTbBRayOTmUPZ7k_bVGBg-1; Tue, 09 May 2023 05:05:16 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-965fcb08b69so448720666b.0 for ; Tue, 09 May 2023 02:05:15 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id nb27-20020a1709071c9b00b00966265be7adsm1071917ejc.22.2023.05.09.02.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1aY2LkynvDT/iTVr4Ey1aaB7sG+QqosvRAFtEKonjlA=; b=cQPGJh7I2wzNQeR50g0bl9smlfwj+NJ0ik+34h6iriQid/L6p3PWr2J2NHoCa0WII+nNAU UdGFi65yl8mbkhEEsRI/qZ70dg6W/nx74jai/lbE1r0SjPnIuUbbcKTRnWEN8hTElNqmke FXCrz2J7YYJJOvFLKGe8gshgV6Cuzho= X-MC-Unique: CYTbBRayOTmUPZ7k_bVGBg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623114; x=1686215114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1aY2LkynvDT/iTVr4Ey1aaB7sG+QqosvRAFtEKonjlA=; b=Fa/GY79NGEdgCnpxHiGW7Yl7p9P72PSwKT97z01onKkVvFVU9KSbYgmQ15DriJFnFf zPy8hDwmPfO5cgavuScY9R3aI5RAT+2rRmDsM/QXUErP6ME1tCUvekTYcP819kinRsaX Wwk2oAOnPsm/ODvlL1HgzYjuaCpeLCw6KikAzYnl2JT6qA9QJ0Nn2tpAzjj9K7XbegvB 3XDZj5Nlirqg05pmPbmNn44NQGZdaMTqjMnZJgnh/Q1tTph7n0Wdmqtd8c4DuzoBnlcA 65XNuDByHdv+AFHLCFNih1NWYPMpnwMiXNkOVWWSjSrzF5utk1VSSTdKZRfmPniQ/qTy 6OsQ== X-Gm-Message-State: AC+VfDyvIMMtD9Moq8xcy5/gbMOxGIGbHSAuz+9Vmho+UFJLznGAQJRT L8HA0XUGY74vQjk6B2D9GvxkLWhwudr0yCffFJ8T6f/BPRzGyMzLGikL5tgB1tnNtoQYfg4zE7+ BaQSnfFdcdYMeAL5oknvN7KsuXuQiZjyc0VIQHlYZubr+3M5SwGhbVgiYSUDHKPmHtYpHXZfELp A= X-Received: by 2002:a17:906:d542:b0:953:7e25:2156 with SMTP id cr2-20020a170906d54200b009537e252156mr11148296ejc.51.1683623114677; Tue, 09 May 2023 02:05:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7z93HTRoX3X82gHjIsM5yG9aIzjTo0XRklhHo4LVAcarAEPkYPsRpVQEqjq0ykp2c3TLyilw== X-Received: by 2002:a17:906:d542:b0:953:7e25:2156 with SMTP id cr2-20020a170906d54200b009537e252156mr11148277ejc.51.1683623114386; Tue, 09 May 2023 02:05:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Babu Moger , "Michael S . Tsirkin" Subject: [PULL 10/16] target/i386: Add a couple of feature bits in 8000_0008_EBX Date: Tue, 9 May 2023 11:04:47 +0200 Message-Id: <20230509090453.37884-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623219032100001 Content-Type: text/plain; charset="utf-8" From: Babu Moger Add the following feature bits. amd-psfd : Predictive Store Forwarding Disable: PSF is a hardware-based micro-architectural optimization designed to improve the performance of code execution by predicting address dependencies between loads and stores. While SSBD (Speculative Store Bypass Disable) disables both PSF and speculative store bypass, PSFD only disables PSF. PSFD may be desirable for the software which is concerned with the speculative behavior of PSF but desires a smaller performance impact than setting SSBD. Depends on the following kernel commit: b73a54321ad8 ("KVM: x86: Expose Predictive Store Forwarding Disa= ble") stibp-always-on : Single Thread Indirect Branch Prediction mode has enhanced performance and may be left always on. The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. SECURITY ANALYSIS OF AMD PREDICTIVE STORE FORWARDING Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin Link: https://www.amd.com/system/files/documents/security-analysis-predicti= ve-store-forwarding.pdf Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Message-Id: <20230504205313.225073-4-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 90a650a836a0..25ba7d0837ca 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -933,10 +933,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { NULL, NULL, NULL, NULL, NULL, "wbnoinvd", NULL, NULL, "ibpb", NULL, "ibrs", "amd-stibp", - NULL, NULL, NULL, NULL, + NULL, "stibp-always-on", NULL, NULL, NULL, NULL, NULL, NULL, "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, - NULL, NULL, NULL, NULL, + "amd-psfd", NULL, NULL, NULL, }, .cpuid =3D { .eax =3D 0x80000008, .reg =3D R_EBX, }, .tcg_features =3D 0, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 8504aaac6807..b45a97275bd0 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -946,8 +946,12 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWor= d w, #define CPUID_8000_0008_EBX_IBRS (1U << 14) /* Single Thread Indirect Branch Predictors */ #define CPUID_8000_0008_EBX_STIBP (1U << 15) +/* STIBP mode has enhanced performance and may be left always on */ +#define CPUID_8000_0008_EBX_STIBP_ALWAYS_ON (1U << 17) /* Speculative Store Bypass Disable */ #define CPUID_8000_0008_EBX_AMD_SSBD (1U << 24) +/* Predictive Store Forwarding Disable */ +#define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28) =20 #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623260; cv=none; d=zohomail.com; s=zohoarc; b=R1NrgkbBqMG1XQzyray0GY0YrCQabBhPR767uTkvqldmlHM7bfdD8ehn8jv5EmLr4Lnc9arwemgfg6XB/CbNVfCZzeduC7tBzBrbHWeaO/BeSCfkW/o7L8nE3Wz0/gfm2z5XYmFMi9g5w5DV1QedHUma/ILc7eahyNTwVKTSGnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623260; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y1peDEFReQuWGUgl+qWBUbJy4zGUSyiPji6CSL7mNcg=; b=LppuDlE3c0rmjHZIrmT66fXeyVrVVa2ZCcFSW5/yVhwIYrSwLnh6iAq+gTD8ZkdZyBLT6kvUecVHMGHLNuCgmsbtr5/p1sJ+M4I91RQA+TMr8lnyzaUbNVkblI0YnOLhp5GXJPkd/DlnvyC4rEKe/IViVitcgIXKwr+1woOIhD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623260338762.9096400644084; Tue, 9 May 2023 02:07:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHf-0005Hl-4E; Tue, 09 May 2023 05:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHd-0005HD-Ug for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHb-0004wv-Dn for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:21 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-pIzRyw8hMZupTEeSMhDWcQ-1; Tue, 09 May 2023 05:05:17 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50bc1a01cffso5167277a12.3 for ; Tue, 09 May 2023 02:05:17 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id r9-20020aa7c149000000b00509d1c6dcefsm528701edp.13.2023.05.09.02.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y1peDEFReQuWGUgl+qWBUbJy4zGUSyiPji6CSL7mNcg=; b=RoP3vJCVB1k0Yoma4mNvP9tBELO2THv3R2C259KiImwxGNsCBXBNJsJi6GxojDiD4+h7Z9 vgHRvGlxA1YnLH+wh+NrvwlWRAofbxwyNZeqgC8wpXm2m0Gd7z+seB68lIEpSDim+VKG+N MRz5wjwUB5tCP+3WN5pIfLydnAS84sk= X-MC-Unique: pIzRyw8hMZupTEeSMhDWcQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623116; x=1686215116; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y1peDEFReQuWGUgl+qWBUbJy4zGUSyiPji6CSL7mNcg=; b=MdwZ7Snqi5Wbaa28l5LMvLWaUpyOMpbMaVxQyG0p36CTdpBZaK7lUnhQZMtnifh6xD UDIsV3ZDcUBZzlerubQG2kym3IgaJiZb2JOYIg3nhuONL9ue26CQ2M2q9lQjOJwbu55B Gcz2shUPy70QFwtspbiq7ztEq+CHZyyh6/5ARQmBtX5cyLXclU4GBnbmOVQq4UZj2Ngk pIBCA0qcZuQ2k9/d4FgYCFTSbzdMt+kT/rvRTyCG6/+ULcC/jHvV9gDoixiWtoxUVavv OwNHzvnZCqxSqQDM7CAZysh/rDAVkMSzF3MEUFeXoJ9llTwUzst2Yt/l2zAOPDycwQD7 pdmA== X-Gm-Message-State: AC+VfDwdVvkdtioDi0puzXnaJO06GRJ6NEnCe+obbf88Cre6G/Tbotta n6rzKFhPwPsOCxjCjMFMKExIIjoA1p6MkDrn6Tp3Gg/rO68sNk+D+zecy7+RpX5X4nyWWkYQEwg DwzbfM3rQ/ywTxQNh98DgShKMjfukkzg+B/T+5AX+gYop4WyjSvccPswQR1WTHIbNXu2Mv/NVTR Y= X-Received: by 2002:aa7:cd5a:0:b0:506:983f:1f61 with SMTP id v26-20020aa7cd5a000000b00506983f1f61mr8759537edw.3.1683623116086; Tue, 09 May 2023 02:05:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4O+QHwJop288YJyH659y1/JCbMwmiZ/kmlF+m/5y8P4KJ/uYczEtu4UBp0lE4dYfSFR9axlg== X-Received: by 2002:aa7:cd5a:0:b0:506:983f:1f61 with SMTP id v26-20020aa7cd5a000000b00506983f1f61mr8759525edw.3.1683623115817; Tue, 09 May 2023 02:05:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Babu Moger , "Michael S . Tsirkin" Subject: [PULL 11/16] target/i386: Add feature bits for CPUID_Fn80000021_EAX Date: Tue, 9 May 2023 11:04:48 +0200 Message-Id: <20230509090453.37884-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623261622100001 From: Babu Moger Add the following feature bits. no-nested-data-bp : Processor ignores nested data breakpoints. lfence-always-serializing : LFENCE instruction is always serializing. null-sel-cls-base : Null Selector Clears Base. When this bit is set, a null segment load clears the segment base. The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. AMD64 Architecture Programmer=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation No. Revision 40332 4.05 Date October 2022 Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf Message-Id: <20230504205313.225073-5-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 24 ++++++++++++++++++++++++ target/i386/cpu.h | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 25ba7d0837ca..fd3909b5a357 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -942,6 +942,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .tcg_features =3D 0, .unmigratable_flags =3D 0, }, + [FEAT_8000_0021_EAX] =3D { + .type =3D CPUID_FEATURE_WORD, + .feat_names =3D { + "no-nested-data-bp", NULL, "lfence-always-serializing", NULL, + NULL, NULL, "null-sel-clr-base", NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + }, + .cpuid =3D { .eax =3D 0x80000021, .reg =3D R_EAX, }, + .tcg_features =3D 0, + .unmigratable_flags =3D 0, + }, [FEAT_XSAVE] =3D { .type =3D CPUID_FEATURE_WORD, .feat_names =3D { @@ -6168,6 +6184,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, *ebx |=3D (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11= :6] */ } break; + case 0x80000021: + *eax =3D env->features[FEAT_8000_0021_EAX]; + *ebx =3D *ecx =3D *edx =3D 0; + break; default: /* reserved values: zero */ *eax =3D 0; @@ -6597,6 +6617,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **er= rp) x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F); } =20 + if (env->features[FEAT_8000_0021_EAX]) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x80000021); + } + /* SGX requires CPUID[0x12] for EPC enumeration */ if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_SGX) { x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x12); diff --git a/target/i386/cpu.h b/target/i386/cpu.h index b45a97275bd0..b8c56936bdd5 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -600,6 +600,7 @@ typedef enum FeatureWord { FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */ FEAT_8000_0007_EDX, /* CPUID[8000_0007].EDX */ FEAT_8000_0008_EBX, /* CPUID[8000_0008].EBX */ + FEAT_8000_0021_EAX, /* CPUID[8000_0021].EAX */ FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */ FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */ FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */ @@ -953,6 +954,13 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWor= d w, /* Predictive Store Forwarding Disable */ #define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28) =20 +/* Processor ignores nested data breakpoints */ +#define CPUID_8000_0021_EAX_No_NESTED_DATA_BP (1U << 0) +/* LFENCE is always serializing */ +#define CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING (1U << 2) +/* Null Selector Clears Base */ +#define CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE (1U << 6) + #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) #define CPUID_XSAVE_XGETBV1 (1U << 2) --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623237; cv=none; d=zohomail.com; s=zohoarc; b=fb1roV3G0aokaITj3QMF3Iuas2n/73+k4bSp5NnslJgVB4fyJpfqNmTasS9iQDkHu9Dhm/c6/pzqQbchPJ6ScSTIDAThG8s+nXlQ/z5bDLKGZ6zGYkzoWm6H4fVNKCBS+g1QAK/F6jHUWbBS1PCBuWPwLM8Yc+3hzhjGUrPa8ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623237; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=60z7QDVoGzUjcssJ/mfMWVookWfEKvlV0VDno7yPxD0=; b=Jkc2fcs7okdoXufvN0siBJp5B8mUMOFsaS+MuLVtMU7GtSD/j3DRVyfmhK8WSVJyUCtFhpRI/86wVyJBxqfhAGk6fe/BOGYN051V6up1rPlAc/Zc2M7bTY+uW/J0xq5SPxf+b/d35/yhUZNgZcJ0bsEeFzS/uM9Ws60XujQ7Oy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168362323793496.67671676278042; Tue, 9 May 2023 02:07:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHh-0005OI-3N; Tue, 09 May 2023 05:05:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHe-0005Hb-Nu for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHc-0004xz-TP for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:22 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-Xd53IMGaPbyO65MH4lNUnQ-1; Tue, 09 May 2023 05:05:19 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94f7a2b21fdso693671666b.2 for ; Tue, 09 May 2023 02:05:19 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id n5-20020a1709065da500b0096616adc0d5sm1064303ejv.104.2023.05.09.02.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=60z7QDVoGzUjcssJ/mfMWVookWfEKvlV0VDno7yPxD0=; b=exYW0D9GMT08Hrgvgyz1HHiqvXVW7cf3kzIcgXAy0QZNmfvuIsK6RsZl1hFL4/DkhEfRd3 ESw+H+Ne4bZfGp7y2Bde3NVPzMc2eW5Oj9zPi8zyftMN1/nY01tXxZNzo0eLJaPDiY7vaN 2WvgC8I4hsCXAUMz1XlaoQWXBOdOJj4= X-MC-Unique: Xd53IMGaPbyO65MH4lNUnQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623117; x=1686215117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=60z7QDVoGzUjcssJ/mfMWVookWfEKvlV0VDno7yPxD0=; b=PxpEHt40SrgOlpUlPGVBTzbhVo2IScJmd2hy0r/Ndp9qwYtOx0hdRJri+udMdmvkmZ J/353B9bH8d19j7wF1BwaJ/orBwGgMrCWT3jr7BucLpRe/81t42NMXEp2UPXIHOcbQIK 2Oj4UGXcZX9XoLpQuRD5E6iR4J1GvrBGQaGjGAaUP0cqWe5YNH/33sOfgaGxGPheoQCA xwckLAXpzYTH1koD59c6qDA6JBd4EljdgHvKbxo4rG5MB/ri+3G/62vx3GRCXv70yxjE mHJhq1+KD2RAvtw2+Hgbm3BvlSwxTnrarv2KOt7v5mAocqU1QYrXF5w08PB5xQ0NeT9n BmTA== X-Gm-Message-State: AC+VfDyghHMUvdv23YlAWO/bep2h4t6lHcOWquIHEIcv/oai6ImKbvnU Fn0TQC/OjFCjezhlXhGqx/Hpf6dJMm3obWo3xTug2N6gKy6P33P3vuAnhDT8jt2AUwINisIdjf7 08se3j6K3a/7EewbxMuGzj2q4IyATulrr11AYaL7A0URebamB/F3mTfEidmgk8eyRBucyhpC5pg A= X-Received: by 2002:a17:907:36c8:b0:961:b589:d07b with SMTP id bj8-20020a17090736c800b00961b589d07bmr11015728ejc.46.1683623117727; Tue, 09 May 2023 02:05:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40u9Xxi5y0AXJwvzrxB0B8QKimpODhZHi7vsSzztiqmPTCjTao/JiwDFjElPfN6UaYOgTrzg== X-Received: by 2002:a17:907:36c8:b0:961:b589:d07b with SMTP id bj8-20020a17090736c800b00961b589d07bmr11015710ejc.46.1683623117439; Tue, 09 May 2023 02:05:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Babu Moger , "Michael S . Tsirkin" Subject: [PULL 12/16] target/i386: Add missing feature bits in EPYC-Milan model Date: Tue, 9 May 2023 11:04:49 +0200 Message-Id: <20230509090453.37884-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623238579100003 From: Babu Moger Add the following feature bits for EPYC-Milan model and bump the version. vaes : Vector VAES(ENC|DEC), VAES(ENC|DEC)LAST instruction suppo= rt vpclmulqdq : Vector VPCLMULQDQ instruction support stibp-always-on : Single Thread Indirect Branch Prediction Mode has enhanced performance and may be left Always on amd-psfd : Predictive Store Forward Disable no-nested-data-bp : Processor ignores nested data breakpoints lfence-always-serializing : LFENCE instruction is always serializing null-sel-clr-base : Null Selector Clears Base. When this bit is set, a null segment load clears the segment base These new features will be added in EPYC-Milan-v2. The "-cpu help" output after the change will be. x86 EPYC-Milan (alias configured by machine type) x86 EPYC-Milan-v1 AMD EPYC-Milan Processor x86 EPYC-Milan-v2 AMD EPYC-Milan Processor The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. SECURITY ANALYSIS OF AMD PREDICTIVE STORE FORWARDING c. AMD64 Architecture Programmer=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation No. Revision 40332 4.05 Date October 2022 Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Link: https://www.amd.com/system/files/documents/security-analysis-predicti= ve-store-forwarding.pdf Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf Message-Id: <20230504205313.225073-6-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fd3909b5a357..3970463114d3 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1945,6 +1945,56 @@ static const CPUCaches epyc_milan_cache_info =3D { }, }; =20 +static const CPUCaches epyc_milan_v2_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 32 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 32768, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + /* The following VMX features are not supported by KVM and are left out in= the * CPU definitions: * @@ -4423,6 +4473,26 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { .xlevel =3D 0x8000001E, .model_id =3D "AMD EPYC-Milan Processor", .cache_info =3D &epyc_milan_cache_info, + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + .props =3D (PropValue[]) { + { "model-id", + "AMD EPYC-Milan-v2 Processor" }, + { "vaes", "on" }, + { "vpclmulqdq", "on" }, + { "stibp-always-on", "on" }, + { "amd-psfd", "on" }, + { "no-nested-data-bp", "on" }, + { "lfence-always-serializing", "on" }, + { "null-sel-clr-base", "on" }, + { /* end of list */ } + }, + .cache_info =3D &epyc_milan_v2_cache_info + }, + { /* end of list */ } + } }, }; =20 --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623194; cv=none; d=zohomail.com; s=zohoarc; b=cb7U+WwDJZ6gDBG7+4VOUDHNtIkf5HwuThWaBHkcliul+mrP3si7ET1Js5ctBOcbXK+QOZGevhlh+ueV8MJ4RF1jESu6X/qbIvUOfknr0q4FCe9sErwoSJL8u9As2DZ7/IjJndbH/egMBlQvAlw5IwjcvHYjbAKkRX36muNH3Ro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623194; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vABqxpGYsTTWZVtBOVdSZcGNrfMPV3ooC0Onx2+aiSs=; b=h+zZt4juRQJMeObT4QUg0Jmv9WLT8XYysPwmcZrnOZSrXVk1fR981u4eTRuaxfUD4nlq/U99wEAJWWZWhb7j5TlVQ3Z8onVoT4vykVbvYzHifr+SO1cdhWmCLMCmy1VxTI1Ojk2o18j6FEElnoj4ToSQA7cbNHRTXb9V+mkMvi4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623194624386.27190566188426; Tue, 9 May 2023 02:06:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHi-0005Xs-Od; Tue, 09 May 2023 05:05:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHg-0005L1-Ac for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHe-0004zE-GU for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:23 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-444-kQzBl_eANmGxGA8yg3i2Gg-1; Tue, 09 May 2023 05:05:20 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50bf9e97bdbso6438325a12.0 for ; Tue, 09 May 2023 02:05:20 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id c4-20020a056402100400b0050bc41352d9sm515107edu.46.2023.05.09.02.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vABqxpGYsTTWZVtBOVdSZcGNrfMPV3ooC0Onx2+aiSs=; b=BNYkwxJzRAg6Q6Yjf0KpVfy4IyElDxc+gIPET/eIwYRAAUJB3Xjwk9gd1mbHYQnhHQ+5PU +pCniSJXeMizWcw7/DRwHggMXoK8tAPqaWfTkYJQDtTpFQVgc9homoTGdvLlul+LzF0zdH AxzMLEBO2EEiUrlyRSP/J9oZjl++AQ0= X-MC-Unique: kQzBl_eANmGxGA8yg3i2Gg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623119; x=1686215119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vABqxpGYsTTWZVtBOVdSZcGNrfMPV3ooC0Onx2+aiSs=; b=ZDhmMovg+tGCUEGjbpw67gB5kjUQIlMtejqftrSiOxtzzC/FPhCf6zoUdFwlFlwXPh GbpC6vN+CvcgcLUPfJe9P1WNxg7JZGfQPgM5/8Tiv3ihfQmn18yU6mvaqY7KndLi5g+5 uJ3MHQomQWtXLzpBuigs0ynh9xyQcgWZL30Ul0gFYi+zzWrXDY3cMtv3ZL6/wkgn6MiX ItewJVnJwjIsTiGitPANRtQkovptltEXI79mY95AC0u01qAD3w8tMCNliy8dYT4tQ+lG WNV99KrEJbUnczZCN0NaKNHXCFH9HtF8owecz5zovQ2SpXPjy+6eJ35uAR6dQddV//4G N5gQ== X-Gm-Message-State: AC+VfDxREqg0AOP+knhSJHo9FUCz8Z8CbNfT854YMbgoqTYwl7rD8jXp s3HVpKI6ko7a956/I0yxOJfVkX421DDgReo+NL/f2eNOuGets4QShLhR+wKqgGIM0kLmBmhu0Uf +a8kE4WDwx+pMRjrYMtdAZe9IUUteilSIoJoO5VXuotOesWRHaqUuOPNGJCGNU+bGz39YeFaBPR s= X-Received: by 2002:a05:6402:28d:b0:506:fcd5:6159 with SMTP id l13-20020a056402028d00b00506fcd56159mr10820271edv.21.1683623119416; Tue, 09 May 2023 02:05:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6je9gcXHKFQCZh5YyQD8hKA1Rb25fYHLcX1c93BYk+hJL2ZxZK4aWbc5P7yitdz6H4knM/Eg== X-Received: by 2002:a05:6402:28d:b0:506:fcd5:6159 with SMTP id l13-20020a056402028d00b00506fcd56159mr10820256edv.21.1683623119096; Tue, 09 May 2023 02:05:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Babu Moger , Santosh Shukla , Kim Phillips Subject: [PULL 13/16] target/i386: Add VNMI and automatic IBRS feature bits Date: Tue, 9 May 2023 11:04:50 +0200 Message-Id: <20230509090453.37884-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623196839100003 From: Babu Moger Add the following featute bits. vnmi: Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest without using Event Injection mechanism meaning not required to track the guest NMI and intercepting the IRET. The presence of this feature is indicated via the CPUID function 0x8000000A_EDX[25]. automatic-ibrs : The AMD Zen4 core supports a new feature called Automatic IBRS. It is a "set-and-forget" feature that means that, unlike e.g., s/w-toggled SPEC_CTRL.IBRS, h/w manages its IBRS mitigation resources automatically across CPL transitions. The presence of this feature is indicated via the CPUID function 0x80000021_EAX[8]. The documention for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. AMD64 Architecture Programmer=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation No. Revision 40332 4.05 Date October 2022 Signed-off-by: Santosh Shukla Signed-off-by: Kim Phillips Signed-off-by: Babu Moger Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf Message-Id: <20230504205313.225073-7-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 3970463114d3..6836d7fd1cb9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -809,7 +809,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { "pfthreshold", "avic", NULL, "v-vmsave-vmload", "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, "vnmi", NULL, NULL, "svme-addr-chk", NULL, NULL, NULL, }, .cpuid =3D { .eax =3D 0x8000000A, .reg =3D R_EDX, }, @@ -947,7 +947,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .feat_names =3D { "no-nested-data-bp", NULL, "lfence-always-serializing", NULL, NULL, NULL, "null-sel-clr-base", NULL, - NULL, NULL, NULL, NULL, + "auto-ibrs", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index b8c56936bdd5..8ade71ab555d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -774,6 +774,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord= w, #define CPUID_SVM_AVIC (1U << 13) #define CPUID_SVM_V_VMSAVE_VMLOAD (1U << 15) #define CPUID_SVM_VGIF (1U << 16) +#define CPUID_SVM_VNMI (1U << 25) #define CPUID_SVM_SVME_ADDR_CHK (1U << 28) =20 /* Support RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */ @@ -960,6 +961,8 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord= w, #define CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING (1U << 2) /* Null Selector Clears Base */ #define CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE (1U << 6) +/* Automatic IBRS */ +#define CPUID_8000_0021_EAX_AUTO_IBRS (1U << 8) =20 #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623164; cv=none; d=zohomail.com; s=zohoarc; b=eum8AN75MYzh42tnGeR080fV3cF6ixvWnPu9tbDO9ibK9ACMjxBczVNBWBvPN549qNVDFT4UGjVqZFIfV+yQ5F6TU1wYUEsARbs4YefRJNCDmwUoT2MzU86b1j5bw8/TXkL1k3w3qG47V4Mct8eGRmjNmMfwuJrrsR3Je4IDsKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623164; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EI9HAPxGWNXEr933AbEtSaeFplGHlPpRLR7M/UE7GMw=; b=ZKcpmisLPXl5uKdN4hvjqpw+Y7rIDXW58Wi31BhWr9cmIFAThUJUV0ODqNZcpvQ+rjTrXlvBXBntGGu1pD3KoHOFWJ4ViDY5r1tyLy6P58RC1xbV4NtTHglxeNNiDfT8sBbkNzAZjhIhYqdiXjqaw5LsRWi1jNyUT8N7rUk0H3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623164537894.8544195728424; Tue, 9 May 2023 02:06:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHk-0005dO-Vf; Tue, 09 May 2023 05:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHi-0005YL-Qp for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHg-00050i-Sl for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:26 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-q5tvizXhN9aWUziRAz9qWg-1; Tue, 09 May 2023 05:05:23 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50bc6c6b9dbso5130258a12.0 for ; Tue, 09 May 2023 02:05:22 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id jy27-20020a170907763b00b009663582a90bsm1088270ejc.19.2023.05.09.02.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EI9HAPxGWNXEr933AbEtSaeFplGHlPpRLR7M/UE7GMw=; b=OwhWbgjCoOanfiVxlAW6Xv+5p9hhe0hm7t+QqlCcX4acMggddd+swlZZi0MqFPaaA81fil BoMr2sdxWWPYZgf5AohaODA5pECG1zcXkAELIY/8vnRHdPRGGXsgUoFiQ8XjD44p6P1zzM Ydf+4UF9SIYzZHnJYD31KDcn0jCu+z8= X-MC-Unique: q5tvizXhN9aWUziRAz9qWg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623121; x=1686215121; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EI9HAPxGWNXEr933AbEtSaeFplGHlPpRLR7M/UE7GMw=; b=B/upXFcc22xqyCstFTLdAzvPptDfsnN5gKIW/wTTmRzEHolnD0fBzHp4zQN3zfeIFl /aJFBf2/LBApHi7zNdMOa9g88O4O1xmyv1gWDbBLLhLqJ+S3v7rkGiS4SfJ7Q/qdK+qU q/E+9IRai7ExunBn5f2dQppPjbapR0XU+LXHWLvvZqh3FYN9LTrbV4c1yDW3gEWfZIrz F53ghP5RM2ztmKOthijDyLSjoXoLYh69ObINq+GQhC4uYTcfuVy02NljwBm3YSfKlHer uUiHhG8FRk8f+dp+6f5Zoh7JU7oJ4//q727tneW4aaQZ2pN2CeB58hUKNXamWtcpefMB FDnw== X-Gm-Message-State: AC+VfDxiFG4FZ+AgVwQIcs44UFN1frRN+Igi2XBjOgTWB9aNIA5Q8u0G LDSJZwwiN+37cKDEowwKlR9MLlyMWoBNrTg/e070lHmVqgw4MQUTqjYEibwUi/8z29ODi3aShxC xgybtqt9nT2EoFh2zYTLFbxe2OFBQd8wFHTnSXKZtdJqsMcfyb0pxJmK8ehGwgmuBdf4B8HmxTf 8= X-Received: by 2002:a17:907:3ea8:b0:953:37d9:282f with SMTP id hs40-20020a1709073ea800b0095337d9282fmr11372505ejc.38.1683623121151; Tue, 09 May 2023 02:05:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Yod5ce+LOFwMcjQkkehOLuhfr6/yiim6dEhfjQbcV1PNlftrIN02o48cvFA7ctP0OwVttbQ== X-Received: by 2002:a17:907:3ea8:b0:953:37d9:282f with SMTP id hs40-20020a1709073ea800b0095337d9282fmr11372484ejc.38.1683623120706; Tue, 09 May 2023 02:05:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Babu Moger Subject: [PULL 14/16] target/i386: Add EPYC-Genoa model to support Zen 4 processor series Date: Tue, 9 May 2023 11:04:51 +0200 Message-Id: <20230509090453.37884-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623166502100003 Content-Type: text/plain; charset="utf-8" From: Babu Moger Adds the support for AMD EPYC Genoa generation processors. The model display for the new processor will be EPYC-Genoa. Adds the following new feature bits on top of the feature bits from the previous generation EPYC models. avx512f : AVX-512 Foundation instruction avx512dq : AVX-512 Doubleword & Quadword Instruction avx512ifma : AVX-512 Integer Fused Multiply Add instruction avx512cd : AVX-512 Conflict Detection instruction avx512bw : AVX-512 Byte and Word Instructions avx512vl : AVX-512 Vector Length Extension Instructions avx512vbmi : AVX-512 Vector Byte Manipulation Instruction avx512_vbmi2 : AVX-512 Additional Vector Byte Manipulation Instruction gfni : AVX-512 Galois Field New Instructions avx512_vnni : AVX-512 Vector Neural Network Instructions avx512_bitalg : AVX-512 Bit Algorithms, add bit algorithms Instructions avx512_vpopcntdq: AVX-512 AVX-512 Vector Population Count Doubleword and Quadword Instructions avx512_bf16 : AVX-512 BFLOAT16 instructions la57 : 57-bit virtual address support (5-level Page Tables) vnmi : Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest without using Event Injection mechanism meaning not required to track the guest NMI and intercept= ing the IRET. auto-ibrs : The AMD Zen4 core supports a new feature called Automatic= IBRS. It is a "set-and-forget" feature that means that, unlike = e.g., s/w-toggled SPEC_CTRL.IBRS, h/w manages its IBRS mitigati= on resources automatically across CPL transitions. Signed-off-by: Babu Moger Message-Id: <20230504205313.225073-8-babu.moger@amd.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6836d7fd1cb9..4187759f106f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1995,6 +1995,56 @@ static const CPUCaches epyc_milan_v2_cache_info =3D { }, }; =20 +static const CPUCaches epyc_genoa_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 1 * MiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 2048, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 32 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 32768, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + /* The following VMX features are not supported by KVM and are left out in= the * CPU definitions: * @@ -4494,6 +4544,78 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .name =3D "EPYC-Genoa", + .level =3D 0xd, + .vendor =3D CPUID_VENDOR_AMD, + .family =3D 25, + .model =3D 17, + .stepping =3D 0, + .features[FEAT_1_EDX] =3D + CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUS= H | + CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE | + CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE | + CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE | + CPUID_VME | CPUID_FP87, + .features[FEAT_1_ECX] =3D + CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX | + CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT | + CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | + CPUID_EXT_PCID | CPUID_EXT_CX16 | CPUID_EXT_FMA | + CPUID_EXT_SSSE3 | CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | + CPUID_EXT_SSE3, + .features[FEAT_8000_0001_EDX] =3D + CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB | + CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX | + CPUID_EXT2_SYSCALL, + .features[FEAT_8000_0001_ECX] =3D + CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | + CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | + CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | + CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE, + .features[FEAT_8000_0008_EBX] =3D + CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | + CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB | + CPUID_8000_0008_EBX_IBRS | CPUID_8000_0008_EBX_STIBP | + CPUID_8000_0008_EBX_STIBP_ALWAYS_ON | + CPUID_8000_0008_EBX_AMD_SSBD | CPUID_8000_0008_EBX_AMD_PSFD, + .features[FEAT_8000_0021_EAX] =3D + CPUID_8000_0021_EAX_No_NESTED_DATA_BP | + CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING | + CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE | + CPUID_8000_0021_EAX_AUTO_IBRS, + .features[FEAT_7_0_EBX] =3D + CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AV= X2 | + CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | + CPUID_7_0_EBX_INVPCID | CPUID_7_0_EBX_AVX512F | + CPUID_7_0_EBX_AVX512DQ | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_= ADX | + CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_AVX512IFMA | + CPUID_7_0_EBX_CLFLUSHOPT | CPUID_7_0_EBX_CLWB | + CPUID_7_0_EBX_AVX512CD | CPUID_7_0_EBX_SHA_NI | + CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512VL, + .features[FEAT_7_0_ECX] =3D + CPUID_7_0_ECX_AVX512_VBMI | CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX= _PKU | + CPUID_7_0_ECX_AVX512_VBMI2 | CPUID_7_0_ECX_GFNI | + CPUID_7_0_ECX_VAES | CPUID_7_0_ECX_VPCLMULQDQ | + CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG | + CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57 | + CPUID_7_0_ECX_RDPID, + .features[FEAT_7_0_EDX] =3D + CPUID_7_0_EDX_FSRM, + .features[FEAT_7_1_EAX] =3D + CPUID_7_1_EAX_AVX512_BF16, + .features[FEAT_XSAVE] =3D + CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, + .features[FEAT_6_EAX] =3D + CPUID_6_EAX_ARAT, + .features[FEAT_SVM] =3D + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE | CPUID_SVM_VNMI | + CPUID_SVM_SVME_ADDR_CHK, + .xlevel =3D 0x80000022, + .model_id =3D "AMD EPYC-Genoa Processor", + .cache_info =3D &epyc_genoa_cache_info, + }, }; =20 /* --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623227; cv=none; d=zohomail.com; s=zohoarc; b=LUU3htBR0ooFnDqC48OYyrSHsTjm9jDJFpe8JUSrde8fiKxG5Mpjm7OLHnhBONRTKXR8qnWIdoKnwdLLUGg52e/e37LGSpzyjj6SYHzjmWx9d7xphOSVRvwvb/bS0vef11zHlfaA1PnRVyn4zPEV3ebYejWABoMHUGFaNVdVr80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623227; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aRyBg5nmn6s4UHxBL727Es/39cSPibg5txcxNKJjMS8=; b=UKqD/IuL5ku4vebswR/dq6yGiz/5/OyAiJCskvfNXnQDyx+NUEjVDRNSAzI+RgYj3RUO1q+6MB8IOkUKjFxHeKLPYqwUVGuvAA5SuvXowh2LT74Eh37ZpP0OT2aM609N3JOdCg5zesdZCoSC9YJtKIB5xpeYMoA81fci1yFndiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623227831203.56023267957812; Tue, 9 May 2023 02:07:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHl-0005e9-N1; Tue, 09 May 2023 05:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHj-0005b3-QW for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHi-00051j-80 for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:27 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-201-b9CPx3gOOwC-VM9dCcliLg-1; Tue, 09 May 2023 05:05:24 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9662fbb79b3so291301266b.0 for ; Tue, 09 May 2023 02:05:24 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id tl14-20020a170907c30e00b00961277a426dsm1036951ejc.205.2023.05.09.02.05.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRyBg5nmn6s4UHxBL727Es/39cSPibg5txcxNKJjMS8=; b=FIMUiFgo8LnRx995wyWsV6wx7FJmTYATUmGqodXNwswid4WN7UL9tpnga1mW4ZMtrLnCkf PA0pzooGs92MONP+cNN2/96QvUYe6eMJNNPX+ht3vSZ21VWkka6mWCC+tBMDW1WNZL8BDP rKHQ3QS8+rwhOzVdaif7Qv+e3He2o/s= X-MC-Unique: b9CPx3gOOwC-VM9dCcliLg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623123; x=1686215123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aRyBg5nmn6s4UHxBL727Es/39cSPibg5txcxNKJjMS8=; b=T9Iw0y/4mrg2/RmtziIyNtCc+8nVoYpUYR4GQwaIYVALFkWRgMmpprg6sZapmYHaCt hriNN8lWsoouYKeb+e6tO62EdAfj6NJRtl6y+1wQeBOA5Riz6Zg0oWRQj1rEWmBZrb3d 8WgdBOXQK8bOn2blZGvFTrU5tzZgWEbKnXojeMIA4OmLl+b5iRiWdfVqjQ3kaLFYGBXR 7yArqaGQ0Ni/G35PqQ5pdfP0ypzn1bW+yHajVsYmPZ7Xwp8q8RHgfdqX7LJ54kVhGlk/ pmtPbJSwIFPa4IIq2LF0yX8hhSg3LptSOJbaxaozntxHcdKOQOTrPa56g1PVaSb+roxh 4G5Q== X-Gm-Message-State: AC+VfDxtaLt1kBMrr+bnnhO46jl8KuURT4im2Teegmr0sNK+hiYyOUl8 l+YGsHzc8fogjiHXjTOXF7yT48BAYyS5IkwXqo2y9yGYjIc5OoT9R3/ab7RnWFs3tULKmnXAPmk /Z6wjCncJRdCT/Bi6Jm9HhrNuQhNVwonht9KrEQcbz+r34yifQIBIZJqKM+zyWsRW/Z92sUdtD1 w= X-Received: by 2002:a17:907:2dab:b0:96a:2b4:eb65 with SMTP id gt43-20020a1709072dab00b0096a02b4eb65mr126455ejc.9.1683623122819; Tue, 09 May 2023 02:05:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4EqYMp98WDnCobiYAq4mQkTBzb1AzRhvbzpzLHi3a562oqBGUfTcpqjK5UwyoJbF/6HPW1dQ== X-Received: by 2002:a17:907:2dab:b0:96a:2b4:eb65 with SMTP id gt43-20020a1709072dab00b0096a02b4eb65mr126432ejc.9.1683623122291; Tue, 09 May 2023 02:05:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/16] docs: clarify --without-default-devices Date: Tue, 9 May 2023 11:04:52 +0200 Message-Id: <20230509090453.37884-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623228408100002 Content-Type: text/plain; charset="utf-8" --without-default-devices is a specialized option that should only be used when configs/devices/ is changed manually. Explain the model towards which we should tend, with respect to failures to start guests and to run "make check". Signed-off-by: Paolo Bonzini --- docs/devel/kconfig.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst index ac9453eba909..e3a544e463fd 100644 --- a/docs/devel/kconfig.rst +++ b/docs/devel/kconfig.rst @@ -282,9 +282,19 @@ want to change some lines in the first group, for exam= ple like this:: CONFIG_PCI_DEVICES=3Dy #CONFIG_TEST_DEVICES=3Dn =20 -and/or pick a subset of the devices in those device groups. Right now -there is no single place that lists all the optional devices for -``CONFIG_PCI_DEVICES`` and ``CONFIG_TEST_DEVICES``. In the future, +and/or pick a subset of the devices in those device groups. Without +further modifications to ``configs/devices/``, a system emulator built +without default devices might not do much more than start an empty +machine, and even then only if ``--nodefaults`` is specified on the +command line. Starting a VM *without* ``--nodefaults`` is allowed to +fail, but should never abort. Failures in ``make check`` with +``--without-default-devices`` are considered bugs in the test code: +the tests should either use ``--nodefaults``, and should be skipped +if a necessary device is not present in the build. Such failures +should not be worked around with ``select`` directives. + +Right now there is no single place that lists all the optional devices +for ``CONFIG_PCI_DEVICES`` and ``CONFIG_TEST_DEVICES``. In the future, we expect that ``.mak`` files will be automatically generated, so that they will include all these symbols and some help text on what they do. =20 --=20 2.40.1 From nobody Fri May 10 18:53:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683623255; cv=none; d=zohomail.com; s=zohoarc; b=jCDMsmp8A7rhdR3rDGV0H+iH3nBjOLi9BQhUlyptckmbCS5Gf20+ow27Rx3etVnBhanJzhGytz9sewOcbFeEUl6v+yZEP469kWyQ0l3lNehdxEk7u1Wkh9Lq52jhHLLyzMSThknMdbMdZAYpMs6Y1olqZ34haFmbcpQsmjOFd+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683623255; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u0lF41b+hn3LhFY0NQgeqz7xQczMxQr8wZ287hYzcnI=; b=YkdxGp/lRLItdsynjfsNEmWb+9RLoYSpG9jBzO97F/cxQLMqB2InFu3lV9i9hAHW/WF+IhPUZxrfItF+klqvvlK3Va1yF4s0tu0Tu7EU8rlW2J5fw2P4c+npEN/+qGtkkQn4hATIC1hKfQfoI//QSplXmZCDwK13Ex1F8rsmfbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683623255181729.5788702472056; Tue, 9 May 2023 02:07:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwJHm-0005eW-5U; Tue, 09 May 2023 05:05:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHk-0005cr-IC for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwJHj-00051x-0H for qemu-devel@nongnu.org; Tue, 09 May 2023 05:05:28 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-eym4XqgKNEydykS4F7qcyw-1; Tue, 09 May 2023 05:05:25 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50d89279d95so5132420a12.1 for ; Tue, 09 May 2023 02:05:25 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id f8-20020a056402068800b0050bc9c38fb4sm510205edy.69.2023.05.09.02.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 02:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683623126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u0lF41b+hn3LhFY0NQgeqz7xQczMxQr8wZ287hYzcnI=; b=DnqGdt1DU8qhf3jKocQVv2PW51evXjbA04ZhkfecEt10B8kEP0JhVFiqYIygYYrwDwRrbq IeQfHWA260F7aNPBvIEpx4e7IQ3/iaHhwfWv4C/9BCHaHoTv+kduoHreCwdKMtsALwlYrV 6Pc/fPlDMhh06cnmx1qVBaISkv6NUtE= X-MC-Unique: eym4XqgKNEydykS4F7qcyw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683623124; x=1686215124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u0lF41b+hn3LhFY0NQgeqz7xQczMxQr8wZ287hYzcnI=; b=DYfR14OuO7SdH8mT507vPQB9jrOLD7vb2cuqJ53M7x50oKDwLWRg0skFNIFeZYkdnU PsQeqslmmMVs69cMEuZvd5f+he3w36nwHzSBh3FM669e6DHDWB/iCsrU+ppBHkD+sJeR 483wL8bAc/ff11QygNoDzWyLSz5XeEKzhtyCz+veFISgxjz/iV4168KVONvqIXmpajMp 3F0kaNXmiIhMEQ5reRWiz6EoOZ7iF8s+AL0nZAkSzbLbQjMjaydNPK0GnByYsE8BBmTM sHFRyMAaEjgvK/aPKw7gS1W8svGUzq7WBC1fIAnMxEQ7wQ2m5QwMmXzY2rpXZmrMqQ3Y dq3g== X-Gm-Message-State: AC+VfDzFVwUYm/ofLLXBDOuOjU5tqS53y3cUo3jI+rxEEUj1KhwhBQiQ rPl5PoBofPhuXWydhA7TiNiTVT+Wwx5DT+BIENQnHW8BU0Zx/sJ+YDofOlzmmu2NFCGwbeKCHj9 8UJbbZ4Qm+EQ9GpCA3YU09En5FR4B9QVcsJ3exnpRTq09ep0EiuXV4r64+rUbRNAa1jIJRaBVCv Q= X-Received: by 2002:a05:6402:32b:b0:50b:7959:8b09 with SMTP id q11-20020a056402032b00b0050b79598b09mr10620743edw.15.1683623123926; Tue, 09 May 2023 02:05:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TzfPSdyPDZdlQfvq6ol9/fTFvzb+3Z+eMrXJMUgcrB+1wVSgB4rhI4VTV8vV6zQSppt6T3g== X-Received: by 2002:a05:6402:32b:b0:50b:7959:8b09 with SMTP id q11-20020a056402032b00b0050b79598b09mr10620725edw.15.1683623123689; Tue, 09 May 2023 02:05:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Michael Tokarev , qemu-stable@nongnu.org Subject: [PULL 16/16] meson: leave unnecessary modules out of the build Date: Tue, 9 May 2023 11:04:53 +0200 Message-Id: <20230509090453.37884-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com> References: <20230509090453.37884-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683623255620100005 Content-Type: text/plain; charset="utf-8" meson.build files choose whether to build modules based on foo.found() expressions. If a feature is enabled (e.g. --enable-gtk), these expressions are true even if the code is not used by any emulator, and this results in an unexpected difference between modular and non-modular builds. For non-modular builds, the files are not included in any binary, and therefore the source files are never processed. For modular builds, however, all .so files are unconditionally built by default, and therefore a normal "make" tries to build them. However, the corresponding trace-*.h files are absent due to this conditional: if have_system trace_events_subdirs +=3D [ ... 'ui', ... ] endif which was added to avoid wasting time running tracetool on unused trace-eve= nts files. This causes a compilation failure; fix it by skipping module builds entirely if (depending on the module directory) have_block or have_system are false. Reported-by: Michael Tokarev Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meson.build b/meson.build index 229eb585f798..27782f8f52e1 100644 --- a/meson.build +++ b/meson.build @@ -3217,6 +3217,10 @@ modinfo_files =3D [] block_mods =3D [] softmmu_mods =3D [] foreach d, list : modules + if not (d =3D=3D 'block' ? have_block : have_system) + continue + endif + foreach m, module_ss : list if enable_modules and targetos !=3D 'windows' module_ss =3D module_ss.apply(config_all, strict: false) --=20 2.40.1