From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499129; cv=none; d=zohomail.com; s=zohoarc; b=a/Ws0wXHy4eXx5eeBE655WMjtGan+Lepdt2fglzbl6FPcVS4JDkSEuzJFIyOMn5cx71dowV8E6yxCbhyPJGP4O5ytmbpWyQamZYJJIzmh+DixNWFWqgnhqZi+lOwdfuttPszDt9xKeFpBQ9tnysZjE0008ZXSHqjkkQJ4wwdEJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499129; 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=fUQ8YJtXrhSH943qQE3CrMqyAQUN7ep2I+Z2txiXQbc=; b=mJM4I5d/BFtHAAmoESaSrxBsC2yJfs7fwBR6dGikEjF4tT/iG3OUxREHhRi5PpJFRvqOXYHq7D8neWXdBZFtr0us8CjB0jJU1qRa7ALGQhEZZpWENdzxLiDf3PRNyhQ8Q3x7QhUNz/Y8y92O7YHxLLLKyXTVyWpcPfE9hpL4M/M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499129914343.2246913261689; Thu, 20 May 2021 01:25:29 -0700 (PDT) Received: from localhost ([::1]:50028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljdzk-0008Ej-P6 for importer@patchew.org; Thu, 20 May 2021 04:25:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxW-0005Mu-3H for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:14 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:40958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxN-0001SZ-5V for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:02 -0400 Received: by mail-wm1-x329.google.com with SMTP id f6-20020a1c1f060000b0290175ca89f698so4827758wmf.5 for ; Thu, 20 May 2021 01:23:00 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fUQ8YJtXrhSH943qQE3CrMqyAQUN7ep2I+Z2txiXQbc=; b=ArO40I/9ANkpyLT3OcUY9g+z8Jbnxi59kbyeqTiZeibmhbAQ4fgDkxL9aGVTSKgTnc 0bcKGGUEvaitGuBrv3XBhap+QnvMkpp7RIqPMl1SWuauMGGudRx9z+3w89V7/JcIJgYV erbRIAjNlVN/ienTgtGaphAXYAE9Q3SA2eZj2Bo5q7JDkDZfvrsn/S+AOCwhHMiJ+gNn SER0H2aHG2SsJx+3L0g12bwSLdk8uUhL8ACwRz1avI45WP37y649sSRUPNnMmvcpU8W7 Eoi1s8sIJZm9nYS45EEGiInMI0WDfYDFgZugWSEqmObW5pr07aMIzPr9ED2as5TQq3tx qLww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fUQ8YJtXrhSH943qQE3CrMqyAQUN7ep2I+Z2txiXQbc=; b=T99KOvHLfRHKxSRKvHYK8yXV5zHvhMwZulafSG9+gr1H0f3D8hNn9xSX9FvxMyTqU1 7mnsxsGkGX1vkeAkhqw6/oMceMowjJTiMutYDEuvfhnsDvPWQwVT+fnvNwHVgx1Zt02X 0xukbFnhs21jjVwCnGxu0MXZDVzKgPW7f6zmhONzmwX/aa8dZVPHRYj/VtmFpE+e+oq7 8GBWFp7wSJLGR324RkEZ/IE69eknZEnRoa0pRmfD8Czl2AcZEL8wzKLUC/JLXDxjACeh KZZnB5WK4uylB41UzPUMwiIuo3Q36vVtCywEDw2WGj5yeZ4Hu1YJ9DAkNoMUi875eUnn NDZg== X-Gm-Message-State: AOAM533UGXUE1zL0KVYy2lwMNFcpO7JObkRMfSSNaTdv2WDyRvQ9gyz6 I6oH6V8zWgWbF+it4Q7IAEu82zero2vlgQ== X-Google-Smtp-Source: ABdhPJwxMQFab7s2gVRlGEU+CaeUSaP1VwLLxIaAcZZIe2ryGKwjdQiu457m1NNPJVmb4L1r85DEkQ== X-Received: by 2002:a05:600c:2056:: with SMTP id p22mr1603879wmg.146.1621498979412; Thu, 20 May 2021 01:22:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/26] configure: Only clone softfloat-3 repositories if TCG is enabled Date: Thu, 20 May 2021 10:22:32 +0200 Message-Id: <20210520082257.187061-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::329; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210512045821.3257963-1-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 0e4233fd8a..1bb29fcda1 100755 --- a/configure +++ b/configure @@ -257,8 +257,6 @@ if test -e "$source_path/.git" then git_submodules_action=3D"update" git_submodules=3D"ui/keycodemapdb" - git_submodules=3D"$git_submodules tests/fp/berkeley-testfloat-3" - git_submodules=3D"$git_submodules tests/fp/berkeley-softfloat-3" else git_submodules_action=3D"ignore" git_submodules=3D"" @@ -2271,6 +2269,11 @@ if test "$solaris" =3D "yes" ; then fi fi =20 +if test "$tcg" =3D "enabled"; then + git_submodules=3D"$git_submodules tests/fp/berkeley-testfloat-3" + git_submodules=3D"$git_submodules tests/fp/berkeley-softfloat-3" +fi + if test -z "${target_list+xxx}" ; then default_targets=3Dyes for target in $default_target_list; do --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499131; cv=none; d=zohomail.com; s=zohoarc; b=GhcRKVQ2HLn2e0uafytqXnIgxPM5XkKVwjQdnDrhg/v4sP+BoshErq9rjfG/MBkzvM9mH5ym9js5fQG6zotKyHua0RFZuO27d6WY4JcJDAumS6QDSJRIuxP95KYO0qgGhCC9uKIxuH9+ScswzYXtESm+i4C4HgNZXCt0iRJhTCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499131; h=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=bvDJqezYLepT2RXLvaDux71VTpVELHG55s53GJHq5qM=; b=l5OtWjcGbRaxytRP07oLK9ZTpZty7LavzrThwg62HpQarx6U9/kgtzK/swkY42XZv/ALP3uqwbkRr6gDP217S+UyLRKDA49WBDD+HQstBz33i+qM0Fk6K+Bd+rWTw+oaYosXpoL8G60H+fniF7jpPJKa8rLj6V3mas0vu0qGK5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499131359155.23395567257876; Thu, 20 May 2021 01:25:31 -0700 (PDT) Received: from localhost ([::1]:50108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljdzm-0008IK-5e for importer@patchew.org; Thu, 20 May 2021 04:25:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxW-0005Mt-2h for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:14 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:54929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxN-0001Sd-C4 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:03 -0400 Received: by mail-wm1-x32e.google.com with SMTP id o127so8608771wmo.4 for ; Thu, 20 May 2021 01:23:00 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.22.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bvDJqezYLepT2RXLvaDux71VTpVELHG55s53GJHq5qM=; b=kxGeCAJvBhfPmu30v3LFLfmyjHZ3ga07oxKMcnl+c4xLsGB53YyPvgiwMj8fuaWF4U pMZzfFSrKGTvgZaBRkBjvpWaLzIU78YBbUsZRsl06ype3ZhPX83UfccFjHscADPdFHR6 ZClM9eHkQxqKwvj+iugMwENSayPqZJSM+y8Twl0+5ToAZjqGy00p/LK7ORfLOFDNKHu5 Z08ii/RqfamuD3ZeBTVoiql7oB/Hup7G2UQwq8PROqrENPiXl7X0YfTToSfE9APaKVbD DNdhj12ka4fQPP/V7ZEsfDT1KsV/RZgFrq5aG+NcOq9BQb1/KAs1euLKJLjHhw68NWw8 gGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=bvDJqezYLepT2RXLvaDux71VTpVELHG55s53GJHq5qM=; b=jxua6011APXZEGyq2CjvQCTci4rwvb/PZLO2u73Z/nvlzvCkXd5f6B4nrkH7W5yqX3 2z4kEfiqt3DRUUJ9mwS+z29BWOpyiIakqCij1NcBNK8frzakoMP68ZgLltye3HDEKQf7 sZcroZwnPuBGQDjh4aZMAkie3NkBEdhfZJwh5nuvmHn/qBb3a5f4wpZm429cHmkzuvhM sH59gXru7rxZ6xd/Df9+DJf00AXy/Lx08pCgmX8+sjs0jmryrLMBbDSRayJaeyvYHs7A QhCzaz3SqofzOgDG5xttEeVGZbs+cYpH4q9e5VJzLOowLNryQx8xVtAnttCmgEjx93s+ QrNQ== X-Gm-Message-State: AOAM531U41DuQuVD3yl2sbuZKnk2wYWQ/OSD6iCCXLtfUwOv0ynVp1mf 8PZVImq4VyCQ2IUUrXA65vePURcPRNXOAw== X-Google-Smtp-Source: ABdhPJwPGi331u1GWUPOoWMOpfRy81Jm7Pf848iObL9pZ0IT0xmtV+TtA+nQf+AJY5p/Ey8nDEjR9g== X-Received: by 2002:a1c:f705:: with SMTP id v5mr2827916wmh.69.1621498980017; Thu, 20 May 2021 01:23:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/26] configure: check for submodules if --with-git-submodules=ignore Date: Thu, 20 May 2021 10:22:33 +0200 Message-Id: <20210520082257.187061-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::32e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Right now --with-git-submodules=3Dignore has a subtle difference from just running without a .git directory, in that it does not check that submodule sources actually exist. Move the check for ui/keycodemapdb/README so that it happens even if the user specified --with-git-submodules=3Dignore, with a customized error message that is more suitable for this situation. Signed-off-by: Paolo Bonzini --- configure | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 1bb29fcda1..4681cbe2d7 100755 --- a/configure +++ b/configure @@ -260,24 +260,6 @@ then else git_submodules_action=3D"ignore" git_submodules=3D"" - - if ! test -f "$source_path/ui/keycodemapdb/README" - then - echo - echo "ERROR: missing file $source_path/ui/keycodemapdb/README" - echo - echo "This is not a GIT checkout but module content appears to" - echo "be missing. Do not use 'git archive' or GitHub download link= s" - echo "to acquire QEMU source archives. Non-GIT builds are only" - echo "supported with source archives linked from:" - echo - echo " https://www.qemu.org/download/#source" - echo - echo "Developers working with GIT can use scripts/archive-source.s= h" - echo "if they need to create valid source archives." - echo - exit 1 - fi fi git=3D"git" =20 @@ -1582,6 +1564,28 @@ case $git_submodules_action in fi ;; ignore) + if ! test -f "$source_path/ui/keycodemapdb/README" + then + echo + echo "ERROR: missing GIT submodules" + echo + if test -e "$source_path/.git"; then + echo "--with-git-submodules=3Dignore specified but submodu= les were not" + echo "checked out. Please initialize and update submodule= s." + else + echo "This is not a GIT checkout but module content appear= s to" + echo "be missing. Do not use 'git archive' or GitHub downl= oad links" + echo "to acquire QEMU source archives. Non-GIT builds are = only" + echo "supported with source archives linked from:" + echo + echo " https://www.qemu.org/download/#source" + echo + echo "Developers working with GIT can use scripts/archive-= source.sh" + echo "if they need to create valid source archives." + fi + echo + exit 1 + fi ;; *) echo "ERROR: invalid --with-git-submodules=3D value '$git_submodul= es_action'" --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499729; cv=none; d=zohomail.com; s=zohoarc; b=GNorqn9swR0aTmx/3357wYcYnrFksiP81LwH6Bq19WWKtwGDmtQa7zK4lupnxCNuxePKfr5jeJ9aSgbxdmzQQdaGOkPa3qUeeUHRhUQRJpu3m23RBD6SKLjeB5vV3o0ycsprjdMI5Kd/6rmLf3d9EBeLb+M6CjWeckjNrkhGc88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499729; h=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=KQzNl8zfqVtZdobfUUEZ5QYEJ0jQDvY20mVSPHPLVm0=; b=T7Ove3RGqQ9C9NaCI5BRvGyqMjJolyj850/NVlc6mJnmu5tpc95of2h6sXR30d6poS9B3HHCrXu5CSgz1duV05shZZPKOm0SmDgSmt+2UX7JulSBOJjjzCmH3oVRYuafmz+gJvOfcxTRXU9GU1WI6kMEB1O3KkDZMfb2msllogQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499729243612.5266611794124; Thu, 20 May 2021 01:35:29 -0700 (PDT) Received: from localhost ([::1]:45898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje9Q-0000N0-09 for importer@patchew.org; Thu, 20 May 2021 04:35:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxY-0005Mz-9m for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:14 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:37821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxQ-0001TK-9e for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:11 -0400 Received: by mail-wr1-x435.google.com with SMTP id q5so16672209wrs.4 for ; Thu, 20 May 2021 01:23:01 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KQzNl8zfqVtZdobfUUEZ5QYEJ0jQDvY20mVSPHPLVm0=; b=I1W9sJ5tsIia86k6doWbz5+z/cQ9uHu8a0FaPjMRqnky2pJuo4gz5E/IQY/ti/kKhG Ko4KKCHz+3gkl0MZDVpDOdzgPEmrC9BpTIKtjt35fehmBpuue0JDFdVnLtm6A1U77zDV kVZVsrkN6TUWPwFFMxX3xZVGtT6CX6+PUpiHTdcKKTtrM74CSVDowQj4+SZn2arCbue7 CuI5TLMiuX0EhYVY4sYP76jaiS+qnnu1E+MJCaJ5e7sI/+hYGxXQtgF2c4mOwzzEA+ao jbNS4ypomkwmbwfD+xpyLc3cd8i7AhXqZmXisj581XWUC2iBDXrhaqUMZ6+apZw4WRog JAXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KQzNl8zfqVtZdobfUUEZ5QYEJ0jQDvY20mVSPHPLVm0=; b=p/mq6d5HQC1XI4GeObZG3e1yNzz8SNdh6wkxaEB7N6ntVqUnbUJubE57MPc2v4i/5d y8t24xAIkHPsh/WX8gSaBnxhFJJcEqKywZJiy3meuttyzxrCdq0QSaFukZzB80HWD7Rb m18KWuY0Rb1uPzJi2rmk06RPZXcIZV3xngRB+mhRRvewtL+fGCwc8tzjfGzHgc+ne1YW m6ENH7AJqZfD0fdMOGQXyoU6bjVTumPlOTjPg8kAByZWcmy/V8k+bY+uIkaOLB9SDYuh lAh4z2LBH0kCsFu9acWM5TLO7sL/+6s6+rC8XKR2ApdX7yzjQaz05uPgrNaY/P4ZR3aG 26hg== X-Gm-Message-State: AOAM530k75hkCD2SYiejgq8mEIaQDihDDfvHQRAc/3fE2IvrHlfbriXe s1T5fR/cLbN8he3E8FjgSra4rjoKkGf67g== X-Google-Smtp-Source: ABdhPJzC57ToSBPEUfxIWcKg3wvmWcHa3hZ9Z/XvVLGuFnSv2opTnHyVKSnc971fBFNZYqftJP2lTg== X-Received: by 2002:adf:dd51:: with SMTP id u17mr3009970wrm.87.1621498980631; Thu, 20 May 2021 01:23:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/26] configure: simplify assignment to GIT_SUBMODULES Date: Thu, 20 May 2021 10:22:34 +0200 Message-Id: <20210520082257.187061-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Do not guard each assignment with a check for --with-git-submodules=3Dignor= e. To avoid a confusing "GIT" line from the Makefile, guard the git-submodule-= update recipe so that it is empty when --with-git-submodules=3Dignore. Signed-off-by: Paolo Bonzini --- Makefile | 2 ++ configure | 20 ++++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 4cab10a2a4..30f19d33bb 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,11 @@ Makefile: .git-submodule-status =20 .PHONY: git-submodule-update git-submodule-update: +ifneq ($(GIT_SUBMODULES_ACTION),ignore) $(call quiet-command, \ (GIT=3D"$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_= ACTION) $(GIT_SUBMODULES)), \ "GIT","$(GIT_SUBMODULES)") +endif =20 # 0. ensure the build tree is okay =20 diff --git a/configure b/configure index 4681cbe2d7..55049fe930 100755 --- a/configure +++ b/configure @@ -256,11 +256,11 @@ gdb_bin=3D$(command -v "gdb-multiarch" || command -v = "gdb") if test -e "$source_path/.git" then git_submodules_action=3D"update" - git_submodules=3D"ui/keycodemapdb" else git_submodules_action=3D"ignore" - git_submodules=3D"" fi + +git_submodules=3D"ui/keycodemapdb" git=3D"git" =20 # Don't accept a target_list environment variable. @@ -3617,9 +3617,7 @@ fi case "$fdt" in auto | enabled | internal) # Simpler to always update submodule, even if not needed. - if test "$git_submodules_action" !=3D "ignore"; then - git_submodules=3D"${git_submodules} dtc" - fi + git_submodules=3D"${git_submodules} dtc" ;; esac =20 @@ -4328,9 +4326,7 @@ fi case "$capstone" in auto | enabled | internal) # Simpler to always update submodule, even if not needed. - if test "$git_submodules_action" !=3D "ignore"; then - git_submodules=3D"${git_submodules} capstone" - fi + git_submodules=3D"${git_submodules} capstone" ;; esac =20 @@ -5260,9 +5256,7 @@ fi case "$slirp" in auto | enabled | internal) # Simpler to always update submodule, even if not needed. - if test "$git_submodules_action" !=3D "ignore"; then - git_submodules=3D"${git_submodules} slirp" - fi + git_submodules=3D"${git_submodules} slirp" ;; esac =20 @@ -5454,9 +5448,7 @@ if test "$cpu" =3D "s390x" ; then roms=3D"$roms s390-ccw" # SLOF is required for building the s390-ccw firmware on s390x, # since it is using the libnet code from SLOF for network booting. - if test "$git_submodules_action" !=3D "ignore"; then - git_submodules=3D"${git_submodules} roms/SLOF" - fi + git_submodules=3D"${git_submodules} roms/SLOF" fi fi =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499429; cv=none; d=zohomail.com; s=zohoarc; b=C75k2pqyz9X1nFVzuRKBH7VKfQAX6sZ1EmXo5dLm+CyUQsFvB5q50pxEjNI98N39/uffNdPGc5BGqMKvPxNhdKM4slX4Tn81To1X7MqCaedEv7sqjXKqnOQdOlw7CacvSJn2Ccbp8RuZLU3J0Q2CrrJAZ7R4njQSiJHTDyo1QYc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499429; 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=LJ7zb0d3J9pbQsFoNs7yYsC3rg5PuI/z4b6K7acxh+A=; b=Tw/+2cS6tjj2CdGFM3hZOvXTgfYBP3+LVBW4juGs0sNmwBaL9CFwbIefVXQ6jZO+h8E0L0ltqc6SGx8nDMBGJRkInnJilIZYDPwhQIMswRUbJmEAxxIHRtSiOUi1t+a+jWUNxHAgeAgabEyNY2T62RNMlAbZtZY+W+A+Yat/rYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499429379268.78379405765395; Thu, 20 May 2021 01:30:29 -0700 (PDT) Received: from localhost ([::1]:38648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje4a-0003Xw-3H for importer@patchew.org; Thu, 20 May 2021 04:30:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0005NT-Dt for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:18 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:43780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxQ-0001UO-9q for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:12 -0400 Received: by mail-wr1-x429.google.com with SMTP id p7so12939907wru.10 for ; Thu, 20 May 2021 01:23:02 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LJ7zb0d3J9pbQsFoNs7yYsC3rg5PuI/z4b6K7acxh+A=; b=rdD1yD8RlHL0CRCnj+xtf9O0KH6xl+AwSVbZ92Z375m4+omjpzdbGKzXrACIH/K0m2 nhDMJgAYAdtSQIUAnpSRE5xRG2+bYtIwewkwyaIO8ef51khMTEdhP9L65bNKCeOkwy5w ph0piTjEND8GWZB1W0q1AB8mUACS4FfkJcfzn9MrdngtKwo+YgDU95Im3bHQlteJhPx/ oZGVj0zLOoVZZf89p89WrZMAiOdFbd+F+ToJLeJqx90IKpv+o1uFePfytGq35TaCeB5w ChFxTa+bcVyeC20JhCfBNxYv2W8oQfME8fet2sal92Pf7s8KmTMyzCyqO+1Ccspf2IVA bpvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LJ7zb0d3J9pbQsFoNs7yYsC3rg5PuI/z4b6K7acxh+A=; b=cs7TkL+z0Kmx8vneBLAXe4WsLTdMKiTrvDtgg/pGR2fHTxo8RUquGj6KqCKZ2FgSO9 GEqKxMt8eAnUoL4TUPJpMw0zqnEny5d8hyxxt3A4kCfRoYrwszcfPl2FMNmIprcwR/od 9iuQCCUxxJpnWWxFNDE2630ALab4zYei2h4+24w/KTZVGr5LWvKR6H8GqRg3RQugPOzq MVRkkv+3wa4M2kBdeDozxa798UE+XYfk0MXMKlhDF78d9ulVWDtbz46DIUmabPKJRIsq NbZkJ15Uz6VGeNjMw3RJzOkHAcVGSl5ztbrBPF/nX8fV9dLZRxk4QzQudYFRX1stUVCo yp8A== X-Gm-Message-State: AOAM533zPL9RcgMN/OJbkcMEEyKgNNUaaBbVK8WKuUsPtEm6PLXUahqb rJCGPf1qRjo6nBOo3grIzcZj+y0kRtuyMw== X-Google-Smtp-Source: ABdhPJydkdyLA2cyJ6aLeW9RskeRmg0qJp4zeboHMmEJK/0BB+fjD5L36DT5Ra3RSL/6Q2Vm+vQYtA== X-Received: by 2002:adf:d081:: with SMTP id y1mr2927134wrh.179.1621498981281; Thu, 20 May 2021 01:23:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/26] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on' Date: Thu, 20 May 2021 10:22:35 +0200 Message-Id: <20210520082257.187061-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::429; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Per the kconfig.rst: A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it. This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210511155354.3069141-2-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- default-configs/devices/ppc64-softmmu.mak | 1 - hw/arm/Kconfig | 1 + hw/i386/Kconfig | 1 + hw/mem/Kconfig | 2 -- hw/ppc/Kconfig | 1 + 5 files changed, 3 insertions(+), 3 deletions(-) diff --git a/default-configs/devices/ppc64-softmmu.mak b/default-configs/de= vices/ppc64-softmmu.mak index ae0841fa3a..cca52665d9 100644 --- a/default-configs/devices/ppc64-softmmu.mak +++ b/default-configs/devices/ppc64-softmmu.mak @@ -8,4 +8,3 @@ CONFIG_POWERNV=3Dy =20 # For pSeries CONFIG_PSERIES=3Dy -CONFIG_NVDIMM=3Dy diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index b887f6a5b1..67723d9ea6 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -6,6 +6,7 @@ config ARM_VIRT imply VFIO_PLATFORM imply VFIO_XGMAC imply TPM_TIS_SYSBUS + imply NVDIMM select ARM_GIC select ACPI select ARM_SMMUV3 diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 7f91f30877..66838fa397 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -23,6 +23,7 @@ config PC imply TPM_TIS_ISA imply VGA_PCI imply VIRTIO_VGA + imply NVDIMM select FDC select I8259 select I8254 diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig index a0ef2cf648..8b19fdc49f 100644 --- a/hw/mem/Kconfig +++ b/hw/mem/Kconfig @@ -7,6 +7,4 @@ config MEM_DEVICE =20 config NVDIMM bool - default y - depends on (PC || PSERIES || ARM_VIRT) select MEM_DEVICE diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index e51e0e5e5a..66e0b15d9e 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -3,6 +3,7 @@ config PSERIES imply PCI_DEVICES imply TEST_DEVICES imply VIRTIO_VGA + imply NVDIMM select DIMM select PCI select SPAPR_VSCSI --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499445; cv=none; d=zohomail.com; s=zohoarc; b=ArhyUwG2yfjo7NtiTnnVeTKM6ccW9LTHyh1RRZDwSZ1yG5qgUhrLbapjqS+7FpDe+CHfUZBQruxhWI2437Z5nPJDDZN8XFaa4UZZyMZO8T0T1XUDlS1KbJ4ASgv0xzBs0q3WDSrxkiUB00BlAPOBvwIwwkekQuteciJeMG/r2c4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499445; h=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=xeBb+PZOjki35JyC9DUC4rb50PMay73s+T70Md+GY3E=; b=M+jZsSpc/LerspamnA0kBbWfta/BjJm6tC0Dm8mw0QsCWDSqcT19fD+tUpiw6Q00mX9tzj/XniXOEoexjFGw/rJvUlt37lk+87wZIrWKP5rPItkfy23Q5rutOPomxugDbMfkFFLQ71bgxd8mu3YEvNEdFnV7RKm010rlt9u//6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499445236477.02891034078357; Thu, 20 May 2021 01:30:45 -0700 (PDT) Received: from localhost ([::1]:38910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje4q-0003iW-44 for importer@patchew.org; Thu, 20 May 2021 04:30:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0005NX-FU for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:18 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:45659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxU-0001Ub-3A for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:12 -0400 Received: by mail-wr1-x431.google.com with SMTP id h4so16636671wrt.12 for ; Thu, 20 May 2021 01:23:02 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xeBb+PZOjki35JyC9DUC4rb50PMay73s+T70Md+GY3E=; b=BxnoaO34R0T/5ce/iDqJUIpjtgloZW5MYOYYwMeY6PydlrmF9O70hER+1VxO65rrui GFjZxk8MwBiHePnaAjE29/3P1Bjs0sJStmtk0XQiNtD1bbLM6sufPlplp/54Rn+x+sPf RJBPCp4VwWu+EN1DhrZmNhAFjJ1uZRyYD6aLrqnCdpTvq60dXBGSbuBIWzFsaciTEVBm jIbTugoRqDsini9CvaY76teok0R7j8XWtupJ5kr1Ej+nZiNrxqlnQkwV03PanTLk7ngq uVSLLMWeJ1LY7fU9H87U99XuywjUaROUNir9DCt186Du/Wb3DP8M2VwBtT8In133oiFA JeaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xeBb+PZOjki35JyC9DUC4rb50PMay73s+T70Md+GY3E=; b=NKDaYervMrYahzbpiViQbclKJtWUjU/GFPbNMhfpYPci970o9lR2lyYs1sp9cdmmEq 79NVUsWgGaHx1lpvaZnEpRrEivAwtNRgNKjJCW7akHxYjcWhKOvRF2WGTktnGXzsrkNS 3PZQZqp4/t163pg8SG2m5zu6sCV1bbIbcetHRC1OLoP6I7PGYee7ocP0oOpCXSW7Wcgb G4UUUczGzu7YdX9WzNg36g0tSM5m4RgWNgnbVz3eW758Q7kdWwKpSNRHt/XLW8gBp/Uw QoZE1rY1y1WvPqu9L5HND0mnHIzSQJEW2VQDXChWwe9T4H4FyRN2pehNgeKseCk79uwN DBQg== X-Gm-Message-State: AOAM533AqUUbiXZcCSaZL3QWY/rYehju2lrFTADIPEZ6Wm6FlUiSlWvl OaHpiiqOBhhfBRpySTsuknZbp6maOxg/Jw== X-Google-Smtp-Source: ABdhPJyL1kx9IfWj+0DlBGXS1jrrN3J7Qum+aO+WS3vfcszAfXdxqMVhKzTKxJzjrHciXrnZ6x4Fdw== X-Received: by 2002:a5d:4c49:: with SMTP id n9mr2876436wrt.417.1621498981965; Thu, 20 May 2021 01:23:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/26] i386/cpu: Expose AVX_VNNI instruction to guest Date: Thu, 20 May 2021 10:22:36 +0200 Message-Id: <20210520082257.187061-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::431; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Yang Zhong Expose AVX (VEX-encoded) versions of the Vector Neural Network Instructions to guest. The bit definition: CPUID.(EAX=3D7,ECX=3D1):EAX[bit 4] AVX_VNNI The following instructions are available when this feature is present in the guest. 1. VPDPBUS: Multiply and Add Unsigned and Signed Bytes 2. VPDPBUSDS: Multiply and Add Unsigned and Signed Bytes with Saturation 3. VPDPWSSD: Multiply and Add Signed Word Integers 4. VPDPWSSDS: Multiply and Add Signed Integers with Saturation As for the kvm related code, please reference Linux commit id 1085a6b585d7. The release document ref below link: https://software.intel.com/content/www/us/en/develop/download/\ intel-architecture-instruction-set-extensions-programming-reference.html Signed-off-by: Yang Zhong Message-Id: <20210407015609.22936-1-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c496bfa1c2..9e211ac2ce 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -940,7 +940,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .type =3D CPUID_FEATURE_WORD, .feat_names =3D { NULL, NULL, NULL, NULL, - NULL, "avx512-bf16", NULL, NULL, + "avx-vnni", "avx512-bf16", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -3194,7 +3194,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO | MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO, .features[FEAT_7_1_EAX] =3D - CPUID_7_1_EAX_AVX512_BF16, + CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16, /* * Missing: XSAVES (not supported by some Linux versions, * including v4.1 to v4.12). diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 324ef92beb..d4e80e1344 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -817,6 +817,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS]; /* Speculative Store Bypass Disable */ #define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31) =20 +/* AVX VNNI Instruction */ +#define CPUID_7_1_EAX_AVX_VNNI (1U << 4) /* AVX512 BFloat16 Instruction */ #define CPUID_7_1_EAX_AVX512_BF16 (1U << 5) =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500091; cv=none; d=zohomail.com; s=zohoarc; b=MynP+I4cned2t5jI0pQvtgPT3IL1IMjKXjQgFnVmuyPEw5waDI4cZo7Nw8CV3fc/ZH+A+1OyL5Z1o0pdb3Qb1dJZ0hg4ivDiaPAv4SXKIsMoIAuTWoq5BTv/x91PCqykpKMrSNv+e6yM2D7CsWkmPoHNuYUakMIp+wHGE/FnZuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500091; h=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=VQnUmfR20gYr35rYG97IsG28QbmzwJrf55GVaV1P6jc=; b=MS2lGotVzR2aIrGzAqnYrpS2tMXG3lb+J72VJicSTWxBABhrDR92Os/2C/zqQHsPDXj9JQ03fnJBDwXZg3ZF0sApDxxF81L1eh62zaipSdCLMS4zY+R2hxcmHMvYKpo2Xnd2DXBPiCgr5uaiNwU+npUsxcmX8p7EwlMYVQttNyE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500091095998.7617951016451; Thu, 20 May 2021 01:41:31 -0700 (PDT) Received: from localhost ([::1]:55642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeFF-0007Ff-RS for importer@patchew.org; Thu, 20 May 2021 04:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RX-PO for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:37814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001Uh-27 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:24 -0400 Received: by mail-wr1-x42d.google.com with SMTP id q5so16672344wrs.4 for ; Thu, 20 May 2021 01:23:03 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VQnUmfR20gYr35rYG97IsG28QbmzwJrf55GVaV1P6jc=; b=qKaW+TOBnkCin9JoAFytv4fZpNsov9rlP+TjkPDUr+1KKjMxkEZdruMGkMTnx54bSm O143eKz7RSN8FEpDF6kQ1VtLUeqfkbqGG7ISmaUucapxL3NvpYbDDa3vR5rVvdjI5QF2 I2CAZQTZy0tJtKLK1JyWbHgCWPgYnZPU2mfceZwXG6oW79yreE9Yd2fXqXTn+PQb4BR3 yTbmQD3R1JimD5AFF2vEfzXVGK7ysN5O9d88pSZjPaIcUiJbZQR7FaqHhRuvQ0vZk4kG u4R3cZWJsZCDwi/k67n0JQBhZGGM5BssAOmZFNQaVctCvBYJXwKVNYkDoEDmYUG1Sfj5 5kog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VQnUmfR20gYr35rYG97IsG28QbmzwJrf55GVaV1P6jc=; b=UiEEGviE1m7d3Dfv3dfOMqvDIFvuogbMtMkHh+zH8Q0d3rJ3koFcMRIIoEjWigKbUQ aa22OB29vq7XLQ0fjov88CCxI1w6TQyUwhZbn2fdVsiab6x1f0e28mLmFGVvamz9I3ZB zBeyEb8PiECchXa5Av4IAb1/CfvsaWmM4b1Yt2uGDEohvoAQHCF6tzHbeGLsIlXjdPom wYmQAJy2yIcN4YYWOHKAzzSDvJ7BZmKgdC+jShYggdVexqtP0BaJ7y8ikLR27ebFD8XK IxDqnDx0DwlqAABiinlVx5MPj+giKvtubLktT/fkgrdiuMQNBivKtunfjfLViWIFei0H cntg== X-Gm-Message-State: AOAM531kj34jYrJjan++bwP9PhmOvc9xBR3Hu5/dLhoAo49ZW3f09Go3 vPu/65b0kaTXP5sBvWGcQyd6/rs7bw0y0g== X-Google-Smtp-Source: ABdhPJxLUavHl9flNoLaxmKTjvSjvg6+tNz0A2BYeF7KtR8cxpRsXXLzbv18/PuShRU9wEwyC6PevA== X-Received: by 2002:a5d:50c7:: with SMTP id f7mr3061310wrt.189.1621498982707; Thu, 20 May 2021 01:23:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/26] meson: bump submodule to 0.57.2 Date: Thu, 20 May 2021 10:22:37 +0200 Message-Id: <20210520082257.187061-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The main advantage of 0.57 is that it fixes https://github.com/mesonbuild/meson/pull/7900, thus avoiding unnecessary rebuilds after running meson. Signed-off-by: Paolo Bonzini --- meson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson b/meson index 776acd2a80..6f745e980b 160000 --- a/meson +++ b/meson @@ -1 +1 @@ -Subproject commit 776acd2a805c9b42b4f0375150977df42130317f +Subproject commit 6f745e980bcab036104c6b7f9064191e489012b9 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499261; cv=none; d=zohomail.com; s=zohoarc; b=RZ2tgQSbeXyK10KIsDHqxkzuydtXGubSU1HdrMlYLkFPy78bm/mHb5FP1IAFvEjUlYPAcfNLfOz4+JMScNKQYiCizLLDPPGI2/n2fynkQHi3UuegapHLcnQRk2Ut5ntc/gGAxg2iHh0x/eLzCSHra4UXEQDSXBQYYDBz3W2R8dI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499261; h=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=wULB0dT529terV3VemdiO1RbK/5UYU6YHyBr4JHxFbU=; b=LLtp4yxtzAodiLd93OpC1L7cm3fiRTkEhZiWZ1BNCgH9Il9qDERq0/tnu6CHmv5wr4QKGyDKeqFV4xLuIoSTgx/kKNKsV/kZbYG12Xzv5b8GxYp3/S7AFEjszpAYx5IwlJkgWUIeZO86j8tvRdYkIjCZ+Xy3OveOxdW11qZYF+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499261654880.4614760244644; Thu, 20 May 2021 01:27:41 -0700 (PDT) Received: from localhost ([::1]:58530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje1s-0005pl-EE for importer@patchew.org; Thu, 20 May 2021 04:27:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0005NU-FM for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:18 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:45026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxV-0001Ul-Ri for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id y184-20020a1ce1c10000b02901769b409001so4671125wmg.3 for ; Thu, 20 May 2021 01:23:04 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wULB0dT529terV3VemdiO1RbK/5UYU6YHyBr4JHxFbU=; b=Z8cz6PXe+9jdi7ZTbluXVqf2qe/ccyRCHWcB8gWswkBu2s/5pH6f39oyEMS4MyhTE9 ppv6kR0baT5C4SA/gASEC/7+cM6/RG1nRYItKSb7BPyHzBv6dVXPUIGf00ghvfY9Bt15 3GH5SLgjfE7vigxCm1k4oeu0eCn8aMW79mfOJnQoTIKgrBea4wYJKnXo+yh5+kSahPzD JNMQn/qqTlDGrCgELVBVG69igUNSnK9Ix3oU0YSN+SdF/sObYSTRRuxm2iNfb5EZ8siT VTU+8o2RA8Dx/LlERCLBrxKoZT+wk0KHToVNDazf2W33f6fsU71nsOW67AzRUfIj8Wtu URHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wULB0dT529terV3VemdiO1RbK/5UYU6YHyBr4JHxFbU=; b=NuqGeJpnNinIkAUvFOs0hn2gpI3cTQlIXBqHuc/wWnvv+weDfq+02nr0fn5vl6BrZw Bpy3i1DJeA1fvFoBxh4FlyseMhqNp1D6zrdosoe1GZourxVfIh0LkDiGBinBKySjxztr smr1wHCr4pYOWI5CZAAJHmlJgV1kv9El4ktBpgJ14ZGJy7a1f7GSD1S2H8JQaLmFhFPX kQtNORLvZ3Uu5v0cB17eJFAEAHBESVa4Kh98fHyVhyHKsIEnBjGKl/rPWIGSd0n6T2WK rpMlZIymwu9XuUsNTwFT4BokZ+i1isuBPgin5DJP/kkmuLl+H3zh3BSawUfF7GDvPBqw awfA== X-Gm-Message-State: AOAM533lnmvHszWyUKftP64fnTsVx3Ao4lu45S7g3pTNM/lI86iQfC6C sphTT5kcvkf6A+3WNUzoGdoDDvzCwLpNtQ== X-Google-Smtp-Source: ABdhPJz4dD3aJ/HnK8K+Va/dF8JCyS0YLKVMCFlPYKwAU/fi52wHW55TqvQ2TPidXgIn/Rr1FsHGmQ== X-Received: by 2002:a1c:2b05:: with SMTP id r5mr2338979wmr.66.1621498983315; Thu, 20 May 2021 01:23:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/26] object: add more commands to preconfig mode Date: Thu, 20 May 2021 10:22:38 +0200 Message-Id: <20210520082257.187061-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::32f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Creating and destroying QOM objects does not require a fully constructed machine. Allow running object-add and object-del before machine initialization has concluded. Signed-off-by: Paolo Bonzini --- hmp-commands.hx | 2 ++ qapi/qom.json | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 435c591a1c..146a13c896 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1297,6 +1297,7 @@ ERST .help =3D "create QOM object", .cmd =3D hmp_object_add, .command_completion =3D object_add_completion, + .flags =3D "p", }, =20 SRST @@ -1311,6 +1312,7 @@ ERST .help =3D "destroy QOM object", .cmd =3D hmp_object_del, .command_completion =3D object_del_completion, + .flags =3D "p", }, =20 SRST diff --git a/qapi/qom.json b/qapi/qom.json index 40d70c434a..4f48035831 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -857,7 +857,8 @@ # <- { "return": {} } # ## -{ 'command': 'object-add', 'data': 'ObjectOptions', 'boxed': true } +{ 'command': 'object-add', 'data': 'ObjectOptions', 'boxed': true, + 'allow-preconfig': true } =20 ## # @object-del: @@ -877,4 +878,5 @@ # <- { "return": {} } # ## -{ 'command': 'object-del', 'data': {'id': 'str'} } +{ 'command': 'object-del', 'data': {'id': 'str'}, + 'allow-preconfig': true } --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500091; cv=none; d=zohomail.com; s=zohoarc; b=NEqiwRNtsMSTh+ShuWfSzDkUTaotNpUOVHlgqWe3hMU6vfIn3zlEf96iZMXP6fLs0fbuvGZq0xVMKRkKXT0MIvb3Dw7uryWlBDxK3ZDfzKpl3dWeyj3EIaBRG/20KdJt4PttwaS8O/13o8c0RGjp9fM0hKDKs8lX8UhMJud61yQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500091; h=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=n0ESrrlkPNYORxFxIwPYPdD/Q8ItticQuxAzhMcT+48=; b=HAYWf4iKUuafDNiN8wv+G9Rmz2Ec0loqohUTE0hilS8GS4V4JG9qxPFYD6nTVp9xC0lQVlG9wobERr/hp72EWRw9aWALMDfEFp66/dmm5zS4vBW+IDZV6LaV7727JLX7wlhyEoVfMr9ElchEgv06UK7YlmV1gpS+1bDXNuI+Uwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500091940883.8990501277067; Thu, 20 May 2021 01:41:31 -0700 (PDT) Received: from localhost ([::1]:55658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeFG-0007GB-PT for importer@patchew.org; Thu, 20 May 2021 04:41:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RG-80 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxe-0001Vv-EI for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:22 -0400 Received: by mail-wr1-x42f.google.com with SMTP id c14so14888805wrx.3 for ; Thu, 20 May 2021 01:23:04 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n0ESrrlkPNYORxFxIwPYPdD/Q8ItticQuxAzhMcT+48=; b=ZEdheqNAu6n7ePLsGuXLXfdAPUJsOslPIp5WxetV4H6TwmgISTsCXq9G55qiqoGG5P 2DNv4o/DZrXUhq+BPCr2yPBl+TCo+jVh5nMvuzLJFt0y69CZ4fdj11qmlV2YllNkHu4l ot4z5lIf9GsgzRrVlCyo5SI9F4A54qTOQY5AdDn05a3qIZEw/KK55eZtu5rnFdNuUYOW pbmhTAze6MXiI2nE8xOpuP9qfr+5rvfCxzyfDHuiNh9PKyuXDIcqJ4WF9UDwHWQC6ZGn 1OkHEqv/9hW8UmOWM8pxMFOaMnDbNacL665CTDGaevlEidIkNH5X8eaLPl0eDPCRCv3M OREQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=n0ESrrlkPNYORxFxIwPYPdD/Q8ItticQuxAzhMcT+48=; b=IMK8KOP8XMstADQKccB0TZ4wVsHU9vCDPwap5Bo5TiRBwYuVoARrZYfc6BcsmFGfXA isOOL/15oMevPGHTJ/f4CgjrrtKcUQKtKm2057f0jYgfXNXmorg4FZjKfBs6vBVahnaw 1Cv97+SL7nLKKxZKFpQg2d5UcH7KwG0DTCbDpEa1Rc3VL+VbjhH1PITHIoQ+whYOIH/J IfWduS5UqIGr/cL08T5WDTZ/I8R0dVToiBFsnU+kM+zgoWd73vqC0SGWeWf9RvUKQ9IH 4yPNjlFjGN+ueRcdnwXKjlfCgFkWPqPrBdpyEJ/W4df8YxLYkhnvyVyFZDOjgkEatK9d 3m1A== X-Gm-Message-State: AOAM533wwPkaHGSuA1HblMvnLqt+oFBKZWHwWtOuomQ/j8OehNGl8Dd1 Vp1SXn7LJALPpC9w1++5XFgVuCnMmFkHcg== X-Google-Smtp-Source: ABdhPJzHknOke0H9m2Fy0h13O0a2CTicBpFPu6UUtBbz/b66wNuVUimoxZ4tf8EBG+m5y4tvAp+Pyw== X-Received: by 2002:adf:9c8e:: with SMTP id d14mr3111691wre.140.1621498983907; Thu, 20 May 2021 01:23:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/26] qtest: add a QOM object for qtest Date: Thu, 20 May 2021 10:22:39 +0200 Message-Id: <20210520082257.187061-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The qtest server right now can only be created using the -qtest and -qtest-log options. Allow an alternative way to create it using "-object qtest,chardev=3D...,log=3D...". This is part of the long term plan to make more (or all) of QEMU configurable through QMP and preconfig mode. Signed-off-by: Paolo Bonzini --- qapi/qom.json | 17 +++++ softmmu/qtest.c | 185 +++++++++++++++++++++++++++++++++++++++++++++--- softmmu/vl.c | 5 +- 3 files changed, 196 insertions(+), 11 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 4f48035831..f7ef30f940 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -644,6 +644,21 @@ { 'struct': 'PrManagerHelperProperties', 'data': { 'path': 'str' } } =20 +## +# @QtestProperties: +# +# Properties for qtest objects. +# +# @chardev: the chardev to be used to receive qtest commands on. +# +# @log: the path to a log file +# +# Since: 6.0 +## +{ 'struct': 'QtestProperties', + 'data': { 'chardev': 'str', + '*log': 'str' } } + ## # @RemoteObjectProperties: # @@ -769,6 +784,7 @@ 'memory-backend-ram', 'pef-guest', 'pr-manager-helper', + 'qtest', 'rng-builtin', 'rng-egd', 'rng-random', @@ -825,6 +841,7 @@ 'if': 'defined(CONFIG_LINUX)' }, 'memory-backend-ram': 'MemoryBackendProperties', 'pr-manager-helper': 'PrManagerHelperProperties', + 'qtest': 'QtestProperties', 'rng-builtin': 'RngProperties', 'rng-egd': 'RngEgdProperties', 'rng-random': 'RngRandomProperties', diff --git a/softmmu/qtest.c b/softmmu/qtest.c index 130c366615..72751e1fd8 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -27,6 +27,8 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/cutils.h" +#include "qapi/qmp/qerror.h" +#include "qom/object_interfaces.h" #include CONFIG_DEVICES #ifdef CONFIG_PSERIES #include "hw/ppc/spapr_rtas.h" @@ -34,11 +36,25 @@ =20 #define MAX_IRQ 256 =20 +#define TYPE_QTEST "qtest" + +OBJECT_DECLARE_SIMPLE_TYPE(QTest, QTEST) + +struct QTest { + Object parent; + + bool has_machine_link; + char *chr_name; + Chardev *chr; + CharBackend qtest_chr; + char *log; +}; + bool qtest_allowed; =20 static DeviceState *irq_intercept_dev; static FILE *qtest_log_fp; -static CharBackend qtest_chr; +static QTest *qtest; static GString *inbuf; static int irq_levels[MAX_IRQ]; static qemu_timeval start_time; @@ -320,7 +336,7 @@ static void qtest_irq_handler(void *opaque, int n, int = level) qemu_set_irq(old_irq, level); =20 if (irq_levels[n] !=3D level) { - CharBackend *chr =3D &qtest_chr; + CharBackend *chr =3D &qtest->qtest_chr; irq_levels[n] =3D level; qtest_send_prefix(chr); qtest_sendf(chr, "IRQ %s %d\n", @@ -849,18 +865,39 @@ static void qtest_event(void *opaque, QEMUChrEvent ev= ent) break; } } + void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Er= ror **errp) { + ERRP_GUARD(); Chardev *chr; + Object *qtest; =20 chr =3D qemu_chr_new("qtest", qtest_chrdev, NULL); - if (chr =3D=3D NULL) { error_setg(errp, "Failed to initialize device for qtest: \"%s\"", qtest_chrdev); return; } =20 + qtest =3D object_new(TYPE_QTEST); + object_property_set_str(qtest, "chardev", "qtest", &error_abort); + if (qtest_log) { + object_property_set_str(qtest, "log", qtest_log, &error_abort); + } + object_property_add_child(qdev_get_machine(), "qtest", qtest); + user_creatable_complete(USER_CREATABLE(qtest), errp); + if (*errp) { + object_unparent(qtest); + } + object_unref(OBJECT(chr)); + object_unref(qtest); +} + +static bool qtest_server_start(QTest *q, Error **errp) +{ + Chardev *chr =3D q->chr; + const char *qtest_log =3D q->log; + if (qtest_log) { if (strcmp(qtest_log, "none") !=3D 0) { qtest_log_fp =3D fopen(qtest_log, "w+"); @@ -869,16 +906,20 @@ void qtest_server_init(const char *qtest_chrdev, cons= t char *qtest_log, Error ** qtest_log_fp =3D stderr; } =20 - qemu_chr_fe_init(&qtest_chr, chr, errp); - qemu_chr_fe_set_handlers(&qtest_chr, qtest_can_read, qtest_read, - qtest_event, NULL, &qtest_chr, NULL, true); - qemu_chr_fe_set_echo(&qtest_chr, true); + if (!qemu_chr_fe_init(&q->qtest_chr, chr, errp)) { + return false; + } + qemu_chr_fe_set_handlers(&q->qtest_chr, qtest_can_read, qtest_read, + qtest_event, NULL, &q->qtest_chr, NULL, true); + qemu_chr_fe_set_echo(&q->qtest_chr, true); =20 inbuf =3D g_string_new(""); =20 if (!qtest_server_send) { - qtest_server_set_send_handler(qtest_server_char_be_send, &qtest_ch= r); + qtest_server_set_send_handler(qtest_server_char_be_send, &q->qtest= _chr); } + qtest =3D q; + return true; } =20 void qtest_server_set_send_handler(void (*send)(void*, const char*), @@ -890,7 +931,7 @@ void qtest_server_set_send_handler(void (*send)(void*, = const char*), =20 bool qtest_driver(void) { - return qtest_chr.chr !=3D NULL; + return qtest && qtest->qtest_chr.chr !=3D NULL; } =20 void qtest_server_inproc_recv(void *dummy, const char *buf) @@ -905,3 +946,129 @@ void qtest_server_inproc_recv(void *dummy, const char= *buf) g_string_truncate(gstr, 0); } } + +static void qtest_complete(UserCreatable *uc, Error **errp) +{ + QTest *q =3D QTEST(uc); + if (qtest) { + error_setg(errp, "Only one instance of qtest can be created"); + return; + } + if (!q->chr_name) { + error_setg(errp, "No backend specified"); + return; + } + + if (OBJECT(uc)->parent !=3D qdev_get_machine()) { + q->has_machine_link =3D true; + object_property_add_const_link(qdev_get_machine(), "qtest", OBJECT= (uc)); + } else { + /* -qtest was used. */ + } + + qtest_server_start(q, errp); +} + +static void qtest_unparent(Object *obj) +{ + QTest *q =3D QTEST(obj); + + if (qtest =3D=3D q) { + qemu_chr_fe_disconnect(&q->qtest_chr); + assert(!qtest_opened); + qemu_chr_fe_deinit(&q->qtest_chr, false); + if (qtest_log_fp) { + fclose(qtest_log_fp); + qtest_log_fp =3D NULL; + } + qtest =3D NULL; + } + + if (q->has_machine_link) { + object_property_del(qdev_get_machine(), "qtest"); + q->has_machine_link =3D false; + } +} + +static void qtest_set_log(Object *obj, const char *value, Error **errp) +{ + QTest *q =3D QTEST(obj); + + if (qtest =3D=3D q) { + error_setg(errp, QERR_PERMISSION_DENIED); + } else { + g_free(q->log); + q->log =3D g_strdup(value); + } +} + +static char *qtest_get_log(Object *obj, Error **errp) +{ + QTest *q =3D QTEST(obj); + + return g_strdup(q->log); +} + +static void qtest_set_chardev(Object *obj, const char *value, Error **errp) +{ + QTest *q =3D QTEST(obj); + Chardev *chr; + + if (qtest =3D=3D q) { + error_setg(errp, QERR_PERMISSION_DENIED); + return; + } + + chr =3D qemu_chr_find(value); + if (!chr) { + error_setg(errp, "Cannot find character device '%s'", value); + return; + } + + g_free(q->chr_name); + q->chr_name =3D g_strdup(value); + + if (q->chr) { + object_unref(q->chr); + } + q->chr =3D chr; + object_ref(chr); +} + +static char *qtest_get_chardev(Object *obj, Error **errp) +{ + QTest *q =3D QTEST(obj); + + return g_strdup(q->chr_name); +} + +static void qtest_class_init(ObjectClass *oc, void *data) +{ + UserCreatableClass *ucc =3D USER_CREATABLE_CLASS(oc); + + oc->unparent =3D qtest_unparent; + ucc->complete =3D qtest_complete; + + object_class_property_add_str(oc, "chardev", + qtest_get_chardev, qtest_set_chardev); + object_class_property_add_str(oc, "log", + qtest_get_log, qtest_set_log); +} + +static const TypeInfo qtest_info =3D { + .name =3D TYPE_QTEST, + .parent =3D TYPE_OBJECT, + .class_init =3D qtest_class_init, + .instance_size =3D sizeof(QTest), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_USER_CREATABLE }, + { } + } +}; + +static void register_types(void) +{ + type_register_static(&qtest_info); +} + +type_init(register_types); diff --git a/softmmu/vl.c b/softmmu/vl.c index 93e78469bc..11ac3750d8 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1758,8 +1758,9 @@ static bool object_create_early(const char *type) * add one, state the reason in a comment! */ =20 - /* Reason: rng-egd property "chardev" */ - if (g_str_equal(type, "rng-egd")) { + /* Reason: property "chardev" */ + if (g_str_equal(type, "rng-egd") || + g_str_equal(type, "qtest")) { return false; } =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500232; cv=none; d=zohomail.com; s=zohoarc; b=lWsPJICcKs3IYdfNhIL9PGvsoTqyNArtY+85Ec/HHThEO59ZL9toOP8VuU43qGwDGqYEke2spEvXqjmtmWA3yrq6ROg7iEohuWXkETOSQXpyoRkqmqk2Dth1PklTaGt9RQb0ci5W3QyHQZMU1IxSQmWXcXhkD+UDFqEv2iBqg3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500232; h=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=3MqmAP7pwRW97qJ1+MtqhBMp1/DFWPX7Op2JzM69PlU=; b=M/QFvLm3ZIX+fOj2oCk3aCkJNkSCf6q1rrkk1S4OQWP13R9N1tGz1/BDtJ+tWdjdflqlwpXaxet0hQS+eXRlYwpwaUxsAPlnc0gFjtbDnild930gviC0XlDVVJyGQJyGCmgAdo2v6ajPa5fRjOSjKmvkiDfytNQj4SJiPRhslzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162150023268268.36274246113987; Thu, 20 May 2021 01:43:52 -0700 (PDT) Received: from localhost ([::1]:33750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeHX-0003DM-Dv for importer@patchew.org; Thu, 20 May 2021 04:43:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RT-Od for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:43783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxg-0001WI-Tn for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:25 -0400 Received: by mail-wr1-x42b.google.com with SMTP id p7so12940070wru.10 for ; Thu, 20 May 2021 01:23:05 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3MqmAP7pwRW97qJ1+MtqhBMp1/DFWPX7Op2JzM69PlU=; b=FbtkKjQ1bG+R4VTVxd8tMQkmguJqHNH92uvZ+VIMq6mwAU2wBaZQPHgwL3U6CSAilI mkK3exnqgo2jqvdb535cxwMJVQ/YM/zggCwKaa2FGbNcA1htQpEZmLDO8c9LdQwmRqI4 MZPJHx7gVd1LiFAFBxr9pPBuEMNUUqdLjQ3fdLD9X7pCC4Jj3tPLxxnBMrC00O7JRQ47 uCo3xFDEfJWUg4SxHEs+85Y4hUv/HYgygigqrXpc5aPBbz8zVaJ5nykuwOv7DeX6hyAd ro8zyT2xsP8aaM4at56ZqmBSUc+ZUIYl0Ft377auE0x4nRSzh+dpBgllOct3gCg4rwSf 9UgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3MqmAP7pwRW97qJ1+MtqhBMp1/DFWPX7Op2JzM69PlU=; b=STVRoASIpH16sUbehuwKdEkbbydhSJrIij56YsHbaz2Q68MPykH4Noao/Kes9p0fGZ dRLOleNdWv1qApDWJg6Gy6jpJHArkKqulpZUr9Lc0xkeAhFfayrWh6ONvxxceGz18EUh gtG+b2PF3qEU/S3OMKTwjenJSlQtvXQaP4hrEx4TjY31jdVSDRPJ4ETh5S+TEJXD+MdO xOrH67f7+ctHho8u0U89srZpyzF17Yb4oaVr1UggAzAXU/sy7l0IlMldwUaGKTraqiTN tO0km4AeMa3Q2hCXZ22EkGWi44ZwdhVZjdbNVw5P9jCpU3x3nl5PCF0jJFIqoCBRhaT/ Zg7A== X-Gm-Message-State: AOAM5312ButUDJOMzDmw0YucVXyMV8aDwvt4r7Qo88o4OfNmG5RH4xzW oddLF7FZazv4lprlVE8AZqqldaDpxxsw+g== X-Google-Smtp-Source: ABdhPJxgS34Sj5sdyLZjCvdwhcALP3/l1SyyftYMdDp5wLHn4zAikCOgcsH47W1IVteEk5AatRbrvQ== X-Received: by 2002:adf:d20a:: with SMTP id j10mr2915690wrh.188.1621498984456; Thu, 20 May 2021 01:23:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/26] KVM: do not allow setting properties at runtime Date: Thu, 20 May 2021 10:22:40 +0200 Message-Id: <20210520082257.187061-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Only allow accelerator properties to be set when the accelerator is being created. Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4e0168e88b..54c0860979 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2017,7 +2017,6 @@ static int kvm_init(MachineState *ms) QTAILQ_INIT(&s->kvm_sw_breakpoints); #endif QLIST_INIT(&s->kvm_parked_vcpus); - s->vmfd =3D -1; s->fd =3D qemu_open_old("/dev/kvm", O_RDWR); if (s->fd =3D=3D -1) { fprintf(stderr, "Could not access KVM kernel module: %m\n"); @@ -3112,6 +3111,11 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visi= tor *v, KVMState *s =3D KVM_STATE(obj); int64_t value; =20 + if (s->fd !=3D -1) { + error_setg(errp, "Cannot set properties after the accelerator has = been initialized"); + return; + } + if (!visit_type_int(v, name, &value, errp)) { return; } @@ -3126,6 +3130,11 @@ static void kvm_set_kernel_irqchip(Object *obj, Visi= tor *v, KVMState *s =3D KVM_STATE(obj); OnOffSplit mode; =20 + if (s->fd !=3D -1) { + error_setg(errp, "Cannot set properties after the accelerator has = been initialized"); + return; + } + if (!visit_type_OnOffSplit(v, name, &mode, errp)) { return; } @@ -3172,6 +3181,8 @@ static void kvm_accel_instance_init(Object *obj) { KVMState *s =3D KVM_STATE(obj); =20 + s->fd =3D -1; + s->vmfd =3D -1; s->kvm_shadow_mem =3D -1; s->kernel_irqchip_allowed =3D true; s->kernel_irqchip_split =3D ON_OFF_AUTO_AUTO; --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499263; cv=none; d=zohomail.com; s=zohoarc; b=QhR1RygXVuSWuGFh6QfufxpEmmAk2uSuoujK28Z3QMuMBs/unjeBLJM2LJoRaxSEOf3bKuYNvpLJ1VRqeuI0UkamttCkjFa+Cg5GYLo220bNYQIfOo/0DtHY4nQxfAaj6h0h1fJWKukD87UvGoC8KZkltkxBa+KZOCB4lkBfMLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499263; h=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=wOmCbiEylv+BfpPB3BvKqjoJGXomxSB65srB+i+LnhU=; b=R7TnRnofd6vzQbWZ4rVHsctrIX2AyuAzwNvZzR+8d+Cy78M1w8t/4gbfhkAe+Q2MPha2GUyGCicwLJbiQOEO75N7MNIAP63eo1H6V1NRIeYL9cdYIjpnrTZyef1c5UOB1pQXaW+aSLgvVKUT8SIbBqisRbUQCZvoLId00O3f9HY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499263620811.2604616979818; Thu, 20 May 2021 01:27:43 -0700 (PDT) Received: from localhost ([::1]:58616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje1u-0005tM-Ii for importer@patchew.org; Thu, 20 May 2021 04:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0005NV-Ef for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:18 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:35741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxV-0001Wj-Rt for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:13 -0400 Received: by mail-wr1-x432.google.com with SMTP id a4so16713811wrr.2 for ; Thu, 20 May 2021 01:23:05 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wOmCbiEylv+BfpPB3BvKqjoJGXomxSB65srB+i+LnhU=; b=Op+UybUh6jkIjjkbH75pLuRpUK85tznaIUaqiGd5NWZT3YaifjDoeQuLwVOZRreEhh AZaiyesiQGtO5yq8H3K1HW2dU2+EBVUmT4Tbg4nLufqydfiyZ1q6dY9EDf5r65hmpvtG DPMI2UH80p2XEp5cVyzM+aGo3ui/IvhQ8VeBKZ+jGEjj+262zW9iaswGsifEOzR4gsQv EETK5KttM8fjKKRT1FdWJj0oWSGj8MhgHkaRNCz1CJKYcCd5AFi7DXMNxiNHQXyAWVWy POJguB34+qqBaM9AwgcEOBfHIiXCa9R+qeUjmRkqpqW+wejE/PrPXZvJy/9ZOH1GoTXv jaCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wOmCbiEylv+BfpPB3BvKqjoJGXomxSB65srB+i+LnhU=; b=ZGiRZ2FXhSiDZ/W2Rj4QAfdCa4PujALvCHwPjbQtqnF4J6CHbOJJzmEd6bVzcnLEbs YMDffd/ANbGme0PWQgPubYqYuDj2HIh9zdEZP8a+aHAUrHReuVQg31NgrpfjZWK3hJTz y3KwN6pPNn8In04QtvZCGoymP0ZKtZmX7/FW/FEnJSlMInGiTj/H4lrrnGEcfJzknCu1 sfr75dbEa98t3HMfwE5kQ1DKpSvQCrzD9AuOVn2ZjgvwKKKQmycHaxO3uyMzFmNj9hpe kSdELMHudK/jMg9CnZj/Zqxx8hJ+rp4gD45wDMzj2bDhtYMxcIJ7T93bJSqcBpZVuU7I vBZg== X-Gm-Message-State: AOAM5301PYOy7PqS2i0yksoLNnRXZg6VD60xZqMj30hJJlARgs1zgWSI u8pnrUYL/2Bs7tNvJqKFWmVR4O4LVBnWBg== X-Google-Smtp-Source: ABdhPJxTO4Bagl4lV0/KfiurZe94KWAhZCU8N3gwmt+6EtxrftYilKQZEVWcTlt3yLoyPnXnKFp25g== X-Received: by 2002:adf:e484:: with SMTP id i4mr2929470wrm.117.1621498985145; Thu, 20 May 2021 01:23:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/26] memory: Introduce log_sync_global() to memory listener Date: Thu, 20 May 2021 10:22:41 +0200 Message-Id: <20210520082257.187061-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::432; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . David Alan Gilbert" , Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Some of the memory listener may want to do log synchronization without being able to specify a range of memory to sync but always globally. Such a memory listener should provide this new method instead of the log_sync() method. Obviously we can also achieve similar thing when we put the global sync logic into a log_sync() handler. However that's not efficient enough because otherwise memory_global_dirty_log_sync() may do the global sync N times, where N is the number of flat ranges in the address space. Make this new method be exclusive to log_sync(). Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-2-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 12 ++++++++++++ softmmu/memory.c | 33 +++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index c8b9088924..e38b7e3dce 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -616,6 +616,18 @@ struct MemoryListener { */ void (*log_sync)(MemoryListener *listener, MemoryRegionSection *sectio= n); =20 + /** + * @log_sync_global: + * + * This is the global version of @log_sync when the listener does + * not have a way to synchronize the log with finer granularity. + * When the listener registers with @log_sync_global defined, then + * its @log_sync must be NULL. Vice versa. + * + * @listener: The #MemoryListener. + */ + void (*log_sync_global)(MemoryListener *listener); + /** * @log_clear: * diff --git a/softmmu/memory.c b/softmmu/memory.c index 3bb533c0bc..c19b0be6b1 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2055,6 +2055,10 @@ void memory_region_set_dirty(MemoryRegion *mr, hwadd= r addr, memory_region_get_dirty_log_mask(m= r)); } =20 +/* + * If memory region `mr' is NULL, do global sync. Otherwise, sync + * dirty bitmap for the specified memory region. + */ static void memory_region_sync_dirty_bitmap(MemoryRegion *mr) { MemoryListener *listener; @@ -2068,18 +2072,24 @@ static void memory_region_sync_dirty_bitmap(MemoryR= egion *mr) * address space once. */ QTAILQ_FOREACH(listener, &memory_listeners, link) { - if (!listener->log_sync) { - continue; - } - as =3D listener->address_space; - view =3D address_space_get_flatview(as); - FOR_EACH_FLAT_RANGE(fr, view) { - if (fr->dirty_log_mask && (!mr || fr->mr =3D=3D mr)) { - MemoryRegionSection mrs =3D section_from_flat_range(fr, vi= ew); - listener->log_sync(listener, &mrs); + if (listener->log_sync) { + as =3D listener->address_space; + view =3D address_space_get_flatview(as); + FOR_EACH_FLAT_RANGE(fr, view) { + if (fr->dirty_log_mask && (!mr || fr->mr =3D=3D mr)) { + MemoryRegionSection mrs =3D section_from_flat_range(fr= , view); + listener->log_sync(listener, &mrs); + } } + flatview_unref(view); + } else if (listener->log_sync_global) { + /* + * No matter whether MR is specified, what we can do here + * is to do a global sync, because we are not capable to + * sync in a finer granularity. + */ + listener->log_sync_global(listener); } - flatview_unref(view); } } =20 @@ -2767,6 +2777,9 @@ void memory_listener_register(MemoryListener *listene= r, AddressSpace *as) { MemoryListener *other =3D NULL; =20 + /* Only one of them can be defined for a listener */ + assert(!(listener->log_sync && listener->log_sync_global)); + listener->address_space =3D as; if (QTAILQ_EMPTY(&memory_listeners) || listener->priority >=3D QTAILQ_LAST(&memory_listeners)->priorit= y) { --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499263; cv=none; d=zohomail.com; s=zohoarc; b=SlUc/Vx3IRr1yZ8fKhCRa5GIcyPD1cLwzZfXFJ4vzm/KIfzyDEW0FRUarlSkS95CawoQ+iDliOOx1CIn+mvgb2sBSECuguqVdsMn0xj6+HVh8O0TfSsRW9w3Q/wyOgmHIVec1a4ibEhD33boxBYoyI7IeTRBmscxjeQP0OHs+ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499263; h=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=Dm9fdtL6t7afNY/kOhuKcUr0Mn8HCiKEsUB/elQwJdU=; b=K/c8AeSXYSKSdlGptcaqQa08NNM+i2vH4dlaSjFuc2ju31l8jSn6GJ+spBWgA89O7EDoWrYC2ynhdV1Nvi97v6To0QOV+v29i5lpag0oLMMIFbimVgLWlILuTcqmo+nHiuXzGB9rjAiWEXyeXPtQY0Cybw9S1CVLZYyxMi3ipxo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499263178560.5276367908501; Thu, 20 May 2021 01:27:43 -0700 (PDT) Received: from localhost ([::1]:58642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje1u-0005uP-35 for importer@patchew.org; Thu, 20 May 2021 04:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0005OF-8n for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:20 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:39929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxY-0001Wp-12 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:15 -0400 Received: by mail-wr1-x434.google.com with SMTP id v12so16672602wrq.6 for ; Thu, 20 May 2021 01:23:06 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dm9fdtL6t7afNY/kOhuKcUr0Mn8HCiKEsUB/elQwJdU=; b=Xpv16JC1lI0DEFy3A6clqgPyC7qz5Yh7uJxqWnohJnudKrIPDlSbO765USVlStTM9U 99rzmQM/AoH/At4S4HPF4Ln/9RGAj/Kp2DtaN2st814CwDLG4vy0CXPRrmO4bUomfV3n PTOV5xiaKFjrFMJ2oNpZFsAn9zki+7VN3NqwSdzirxN/l0hm1Zpgfu7kJpUlpLZWSDrK WnDc3F3652YAOLDEcOE2XDw1FlpwaGig08dd8lMihxmOPS4vnVp/IV1Z7N+YlmbCwZma nADSD7iNAdFne7n1ObuAyHrQ4hF9K4eAit8/CCmh09Xukgx8AHlIUWbwh7lXWw2peszw g8Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Dm9fdtL6t7afNY/kOhuKcUr0Mn8HCiKEsUB/elQwJdU=; b=gGTGYcpRV/f6dxzU2HmnrSjCymcdQ7Gl7lNRLCkjwZjvH3KL3JvDc3HEFVGInnt9aM zHCYFnTjqN+fpjkETs1VPdSQ0vJfuLhvEiEdRccGbF5npIZkG/oUWvLaTfbESAx2M2o0 5QYsTGHfZ21Phc2EMhkDgSmvnjJfhwlcyJ5YVGNzo4g2GYKF9xZM58Sc/iPbQ0a2z6p4 5szGcAi0p/QdLGC9aosMNxZhMZS4h1hvCTP85qwu6mM+hdkXbvvjFj2M6mLb0ajJRGX1 7ldQDY1fTZ4i7w1Z/k4OYTJye4vSuGv5UDB7JoQhTYF1f9ggX9Xw3npuY0jyN2GZGR9K bYmw== X-Gm-Message-State: AOAM532+FFvm3DBLJUZjHkZHWAYRNpQJktq9MUNyCuo7f9ZC+a7UaM4S 4ns06Y6bsQ7TWN276EDCnwjTbT3cISMQJA== X-Google-Smtp-Source: ABdhPJzTDHqCoJkxq0PkvXsAs1XqBinMf2MenqZ840+6dmmpCI/x69uSKFga9QsLUX3xc3O45CJ1GA== X-Received: by 2002:a5d:570c:: with SMTP id a12mr2926498wrv.354.1621498985740; Thu, 20 May 2021 01:23:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/26] KVM: Use a big lock to replace per-kml slots_lock Date: Thu, 20 May 2021 10:22:42 +0200 Message-Id: <20210520082257.187061-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Per-kml slots_lock will bring some trouble if we want to take all slots_loc= k of all the KMLs, especially when we're in a context that we could have taken s= ome of the KML slots_lock, then we even need to figure out what we've taken and what we need to take. Make this simple by merging all KML slots_lock into a single slots lock. Per-kml slots_lock isn't anything that helpful anyway - so far only x86 has= two address spaces (so, two slots_locks). All the rest archs will be having one address space always, which means there's actually one slots_lock so it wil= l be the same as before. Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-3-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 33 ++++++++++++++++++--------------- include/sysemu/kvm_int.h | 2 -- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 54c0860979..f8980e155b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -172,8 +172,10 @@ typedef struct KVMResampleFd KVMResampleFd; static QLIST_HEAD(, KVMResampleFd) kvm_resample_fd_list =3D QLIST_HEAD_INITIALIZER(kvm_resample_fd_list); =20 -#define kvm_slots_lock(kml) qemu_mutex_lock(&(kml)->slots_lock) -#define kvm_slots_unlock(kml) qemu_mutex_unlock(&(kml)->slots_lock) +static QemuMutex kml_slots_lock; + +#define kvm_slots_lock() qemu_mutex_lock(&kml_slots_lock) +#define kvm_slots_unlock() qemu_mutex_unlock(&kml_slots_lock) =20 static inline void kvm_resample_fd_remove(int gsi) { @@ -239,9 +241,9 @@ bool kvm_has_free_slot(MachineState *ms) bool result; KVMMemoryListener *kml =3D &s->memory_listener; =20 - kvm_slots_lock(kml); + kvm_slots_lock(); result =3D !!kvm_get_free_slot(kml); - kvm_slots_unlock(kml); + kvm_slots_unlock(); =20 return result; } @@ -307,7 +309,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, voi= d *ram, KVMMemoryListener *kml =3D &s->memory_listener; int i, ret =3D 0; =20 - kvm_slots_lock(kml); + kvm_slots_lock(); for (i =3D 0; i < s->nr_slots; i++) { KVMSlot *mem =3D &kml->slots[i]; =20 @@ -317,7 +319,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, voi= d *ram, break; } } - kvm_slots_unlock(kml); + kvm_slots_unlock(); =20 return ret; } @@ -513,7 +515,7 @@ static int kvm_section_update_flags(KVMMemoryListener *= kml, return 0; } =20 - kvm_slots_lock(kml); + kvm_slots_lock(); =20 while (size && !ret) { slot_size =3D MIN(kvm_max_slot_size, size); @@ -529,7 +531,7 @@ static int kvm_section_update_flags(KVMMemoryListener *= kml, } =20 out: - kvm_slots_unlock(kml); + kvm_slots_unlock(); return ret; } =20 @@ -810,7 +812,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *km= l, return ret; } =20 - kvm_slots_lock(kml); + kvm_slots_lock(); =20 for (i =3D 0; i < s->nr_slots; i++) { mem =3D &kml->slots[i]; @@ -836,7 +838,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *km= l, } } =20 - kvm_slots_unlock(kml); + kvm_slots_unlock(); =20 return ret; } @@ -1141,7 +1143,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, ram =3D memory_region_get_ram_ptr(mr) + section->offset_within_region + (start_addr - section->offset_within_address_space); =20 - kvm_slots_lock(kml); + kvm_slots_lock(); =20 if (!add) { do { @@ -1199,7 +1201,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, } while (size); =20 out: - kvm_slots_unlock(kml); + kvm_slots_unlock(); } =20 static void kvm_region_add(MemoryListener *listener, @@ -1226,9 +1228,9 @@ static void kvm_log_sync(MemoryListener *listener, KVMMemoryListener *kml =3D container_of(listener, KVMMemoryListener, l= istener); int r; =20 - kvm_slots_lock(kml); + kvm_slots_lock(); r =3D kvm_physical_sync_dirty_bitmap(kml, section); - kvm_slots_unlock(kml); + kvm_slots_unlock(); if (r < 0) { abort(); } @@ -1328,7 +1330,6 @@ void kvm_memory_listener_register(KVMState *s, KVMMem= oryListener *kml, { int i; =20 - qemu_mutex_init(&kml->slots_lock); kml->slots =3D g_malloc0(s->nr_slots * sizeof(KVMSlot)); kml->as_id =3D as_id; =20 @@ -2001,6 +2002,8 @@ static int kvm_init(MachineState *ms) int type =3D 0; uint64_t dirty_log_manual_caps; =20 + qemu_mutex_init(&kml_slots_lock); + s =3D KVM_STATE(ms->accelerator); =20 /* diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index ccb8869f01..1da30e1884 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -27,8 +27,6 @@ typedef struct KVMSlot =20 typedef struct KVMMemoryListener { MemoryListener listener; - /* Protects the slots and all inside them */ - QemuMutex slots_lock; KVMSlot *slots; int as_id; } KVMMemoryListener; --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499444; cv=none; d=zohomail.com; s=zohoarc; b=aEa249DPFgL35lPx0CoOy9J+3VjYwZ4KfkFgGU9kJ7imX0nvih5ntMZZ0HTdnLE7bk9XNrRTOBS5p1GQxPYfe1ryk4HmC4NM6KeQsascZcFJZGd8AO4JWUd9iKFLER0BRFpULIpbGDOLr9+O7OJH+Qgx6qQHnvUHafjEKFHBoM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499444; h=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=Cb/EIE1W0YCsIKhSOhonZiq7HmU1guIPixtbSVuS12k=; b=KMc07qhKVpXXWU3vHB10223/guekXGhIF6uWneCJ1cr44MAIvawDc9P1Jw8VQfPkUngJvsjh/10vZMUiJsW37twf7siC2MQavemXj7Xu16er/aA/blMjry31fjac+IKcEZS8T0baG8Wau8wRJPxJqaVzgsyKnaWSJsS5b4k0+1Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499444731210.93344821047629; Thu, 20 May 2021 01:30:44 -0700 (PDT) Received: from localhost ([::1]:38878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje4p-0003hE-MM for importer@patchew.org; Thu, 20 May 2021 04:30:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0005OE-9R for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:20 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:46900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxY-0001Wv-32 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:15 -0400 Received: by mail-wr1-x430.google.com with SMTP id y14so14589746wrm.13 for ; Thu, 20 May 2021 01:23:07 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cb/EIE1W0YCsIKhSOhonZiq7HmU1guIPixtbSVuS12k=; b=BDHDaNyaL7OjEsv/MBUph3q0vw88a4QIvhWZtA30u5/au6lzhLnvwk4/ZnU9BEM0xh a3NNM+9ZcinwqRZ7yCRSywlDBzDoTpxx3Y8ephVWVpnZiTTk0JCse/86UmGSqglp044x i3p91sebkC5nN7iXjIlbPPLfXwBB4t33ZWMqJUpm8eSNdymzMf7aVMHiHvfxUOPtyyK/ bPuHp03iKWM8O3+hMDcs6/MbMF0IcpYEtq7WNHGVmpALVSbCX/IEDTI8wbFGy1O50+9s JVJngP9dj+7srtd7zd7wYf0Hg4EibFj3YlKfebuqtJIELv2P1kPceKtBr/RZm6OTQmcc jQYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Cb/EIE1W0YCsIKhSOhonZiq7HmU1guIPixtbSVuS12k=; b=E/Wwihshr2Xg2CVeV2xhT+24PS2dloYTnjWqem5O1nfVlb5AMt6tX3c9bsIsQsE+WQ zQuJNpT+WxvdHMLN4s2zkml8vczGkOL3DwxcFgF93Aqzp8g74UIT/G+s27SW3L8Lnqzx tQJmDBr0FpBN7PSTlegKHgFFTDTt6AWzLYmV/M4lrIGNa04S+U/q3Y5yPOpM1sZQnkBl KFTM7gCoUrdm5dfnzmQjbmWS/XkRXLz5EyL73lYJqFs532lfRgnbTCuA1wiJw+o/PwVF uxs6alji1kVSni3mHlDPIieRbteLMFYPn8fvyr9evvHYzzjrAkGvAU0oIvlvL6KVtsg0 HIbA== X-Gm-Message-State: AOAM532NMa/EGAlmsVbDhr6GhZwMR1ZdSAItbv3erQ7vUHVAUz5ioTmm JZCMqRbRaUmyZRRQvIPFDHk1DnopasE4Ow== X-Google-Smtp-Source: ABdhPJyGZg92jyLdJ6jpyk8vrMFb41UeD+amYNCkqQy2pSfnDSlO9I0/zpl2BuMgQkB8Iu8LcG+l/Q== X-Received: by 2002:a5d:4408:: with SMTP id z8mr3057137wrq.2.1621498986395; Thu, 20 May 2021 01:23:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/26] KVM: Create the KVMSlot dirty bitmap on flag changes Date: Thu, 20 May 2021 10:22:43 +0200 Message-Id: <20210520082257.187061-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::430; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . David Alan Gilbert" , Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Previously we have two places that will create the per KVMSlot dirty bitmap: 1. When a newly created KVMSlot has dirty logging enabled, 2. When the first log_sync() happens for a memory slot. The 2nd case is lazy-init, while the 1st case is not (which is a fix of what the 2nd case missed). To do explicit initialization of dirty bitmaps, what we're missing is to create the dirty bitmap when the slot changed from not-dirty-track to dirty-track. Do that in kvm_slot_update_flags(). With that, we can safely remove the 2nd lazy-init. This change will be needed for kvm dirty ring because kvm dirty ring does not use the log_sync() interface at all. Also move all the pre-checks into kvm_slot_init_dirty_bitmap(). Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f8980e155b..5bc40fd71b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -177,6 +177,8 @@ static QemuMutex kml_slots_lock; #define kvm_slots_lock() qemu_mutex_lock(&kml_slots_lock) #define kvm_slots_unlock() qemu_mutex_unlock(&kml_slots_lock) =20 +static void kvm_slot_init_dirty_bitmap(KVMSlot *mem); + static inline void kvm_resample_fd_remove(int gsi) { KVMResampleFd *rfd; @@ -500,6 +502,7 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml= , KVMSlot *mem, return 0; } =20 + kvm_slot_init_dirty_bitmap(mem); return kvm_set_user_memory_region(kml, mem, false); } =20 @@ -584,8 +587,12 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionS= ection *section, #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) =20 /* Allocate the dirty bitmap for a slot */ -static void kvm_memslot_init_dirty_bitmap(KVMSlot *mem) +static void kvm_slot_init_dirty_bitmap(KVMSlot *mem) { + if (!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES) || mem->dirty_bmap) { + return; + } + /* * XXX bad kernel interface alert * For dirty bitmap, kernel allocates array of size aligned to @@ -640,11 +647,6 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryLis= tener *kml, goto out; } =20 - if (!mem->dirty_bmap) { - /* Allocate on the first log_sync, once and for all */ - kvm_memslot_init_dirty_bitmap(mem); - } - d.dirty_bitmap =3D mem->dirty_bmap; d.slot =3D mem->slot | (kml->as_id << 16); ret =3D kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d); @@ -1181,14 +1183,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, mem->start_addr =3D start_addr; mem->ram =3D ram; mem->flags =3D kvm_mem_flags(mr); - - if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { - /* - * Reallocate the bmap; it means it doesn't disappear in - * middle of a migrate. - */ - kvm_memslot_init_dirty_bitmap(mem); - } + kvm_slot_init_dirty_bitmap(mem); err =3D kvm_set_user_memory_region(kml, mem, true); if (err) { fprintf(stderr, "%s: error registering slot: %s\n", __func__, --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500362; cv=none; d=zohomail.com; s=zohoarc; b=aIiotegkmj5z/rWSxLTyZF8uCaU7awnwB6cJS0VKNNWQQlPkKZsjMrSFR/SrF/tnHnKZB1GHkN2qzUmsnaA0tjxdzNpBX/bYbigHEkAcKOAhiB6ngnI2Pgpp28mjzQkRbitZmDUyu0Pa4m2OFOcOYzDVuL+ejfl7Kb+SIFTrtEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500362; h=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=yoh7aaW0HkXExKTvgyPRoyUhprnmP0RXGSbOvZabGVI=; b=CSB1W3qXWmqMAvSkCSZ/hqDcj3/NY4rlvTme8QqX4bYgaB79F+ef8ZQ0W9CQX7UFeO32Ct/OvSFedwpHyWcfte9TipTyBudXGnJijubI93WilP9FQ/T40t6v4/Z2ghC7bPo8JgjYhJwtjHo5j7uHB/U1PAtR2LeLSkzBtKKiV3Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500362234874.0851441024699; Thu, 20 May 2021 01:46:02 -0700 (PDT) Received: from localhost ([::1]:41316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeJd-0008GD-4k for importer@patchew.org; Thu, 20 May 2021 04:46:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RN-9X for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:39919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001X1-0o for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:22 -0400 Received: by mail-wr1-x429.google.com with SMTP id v12so16672695wrq.6 for ; Thu, 20 May 2021 01:23:08 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yoh7aaW0HkXExKTvgyPRoyUhprnmP0RXGSbOvZabGVI=; b=cRMi4+Kln8ra0OueGEWNMcVRUtw1YD1qTg5Kww/qKp3IBmvzeUr2p1iJbs0JaJhODU lx61OzGx/QOf8xHFruMp8Ry1becppKcDttRrmutM+NPJvhEfqMnqc7+fsiHmyjq25jfq Y5+Uhv3YRBubNS8Yf8CC7O4rQq+x1pJaWJFMRgkUQ+7S5ZrkMZ+ALIRZgsDwte/Ro1p0 bIoFyX+jBCZwyoPg7XW/lWLJlRAE3I5Wb3+7C4gUUs3eNLP0k6HQi8uqSxqJRWSCn07A aPmb9PyMtUZ4pyqpxTICF9WadbCWJDFX/SCkIGj/IRm8qQDCtcqs/dm7PQV6vqWvGtM6 oJrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yoh7aaW0HkXExKTvgyPRoyUhprnmP0RXGSbOvZabGVI=; b=jpSCbwSaF72a6CvbHOwJcx878qFV5emPOW1CmQisvZw2dcjI375NL2Wwv+6s77sXIp SS9YvVfgYwTCrUxEVRxYSlol0eHLyLa+1KTIFlav5QdB2G9OMT7qxMQtPtfsoEVgY7z2 5y+p0Q7yVTiVtmJ0rOUNuiJqr93mNk3QlQIHQvEXvms3mLR6olKZanOrIUnjdq1P6XR8 yAp73YcUQ7EOOx7OJ5XUFHa2m8+d9n7EuakfWt98MHaj+eP+2BxIg/ba0OYn40aggr6M nHO89HB2it7QR5nmPKyNDPcB8wvvEnWPf1i2VMSipmTAcRDy6Q0zJstxjfpwUVzK8p4m os/w== X-Gm-Message-State: AOAM5334qalTSE5eqEYcc2hQHK7SE9LPBy5BjX703/bat9O+wsSU5QjL xycBIRZDUyEtzxCQ5UYmhplVSdNrKKEXmQ== X-Google-Smtp-Source: ABdhPJw6SxVwTOT6HM5+o8Fpjbbk0lT1nDX7YCqLLRggP4KX8+0AyiH5hY44BouHnSwXlSgYmQho3g== X-Received: by 2002:a05:6000:108f:: with SMTP id y15mr3058346wrw.115.1621498987148; Thu, 20 May 2021 01:23:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/26] KVM: Provide helper to get kvm dirty log Date: Thu, 20 May 2021 10:22:44 +0200 Message-Id: <20210520082257.187061-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::429; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Provide a helper kvm_slot_get_dirty_log() to make the function kvm_physical_sync_dirty_bitmap() clearer. We can even cache the as_id into KVMSlot when it is created, so that we don't even need to pass it down every time. Since at it, remove return value of kvm_physical_sync_dirty_bitmap() because it should never fail. Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-5-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 52 +++++++++++++++++++++++----------------- include/sysemu/kvm_int.h | 2 ++ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 5bc40fd71b..caaa2a5c98 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -615,6 +615,30 @@ static void kvm_slot_init_dirty_bitmap(KVMSlot *mem) mem->dirty_bmap =3D g_malloc0(bitmap_size); } =20 +/* + * Sync dirty bitmap from kernel to KVMSlot.dirty_bmap, return true if + * succeeded, false otherwise + */ +static bool kvm_slot_get_dirty_log(KVMState *s, KVMSlot *slot) +{ + struct kvm_dirty_log d =3D {}; + int ret; + + d.dirty_bitmap =3D slot->dirty_bmap; + d.slot =3D slot->slot | (slot->as_id << 16); + ret =3D kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d); + + if (ret =3D=3D -ENOENT) { + /* kernel does not have dirty bitmap in this slot */ + ret =3D 0; + } + if (ret) { + error_report_once("%s: KVM_GET_DIRTY_LOG failed with %d", + __func__, ret); + } + return ret =3D=3D 0; +} + /** * kvm_physical_sync_dirty_bitmap - Sync dirty bitmap from kernel space * @@ -626,15 +650,13 @@ static void kvm_slot_init_dirty_bitmap(KVMSlot *mem) * @kml: the KVM memory listener object * @section: the memory section to sync the dirty bitmap with */ -static int kvm_physical_sync_dirty_bitmap(KVMMemoryListener *kml, - MemoryRegionSection *section) +static void kvm_physical_sync_dirty_bitmap(KVMMemoryListener *kml, + MemoryRegionSection *section) { KVMState *s =3D kvm_state; - struct kvm_dirty_log d =3D {}; KVMSlot *mem; hwaddr start_addr, size; hwaddr slot_size, slot_offset =3D 0; - int ret =3D 0; =20 size =3D kvm_align_section(section, &start_addr); while (size) { @@ -644,19 +666,10 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryLi= stener *kml, mem =3D kvm_lookup_matching_slot(kml, start_addr, slot_size); if (!mem) { /* We don't have a slot if we want to trap every access. */ - goto out; + return; } =20 - d.dirty_bitmap =3D mem->dirty_bmap; - d.slot =3D mem->slot | (kml->as_id << 16); - ret =3D kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d); - if (ret =3D=3D -ENOENT) { - /* kernel does not have dirty bitmap in this slot */ - ret =3D 0; - } else if (ret < 0) { - error_report("ioctl KVM_GET_DIRTY_LOG failed: %d", errno); - goto out; - } else { + if (kvm_slot_get_dirty_log(s, mem)) { subsection.offset_within_region +=3D slot_offset; subsection.size =3D int128_make64(slot_size); kvm_get_dirty_pages_log_range(&subsection, d.dirty_bitmap); @@ -666,8 +679,6 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryList= ener *kml, start_addr +=3D slot_size; size -=3D slot_size; } -out: - return ret; } =20 /* Alignment requirement for KVM_CLEAR_DIRTY_LOG - 64 pages */ @@ -1179,6 +1190,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, do { slot_size =3D MIN(kvm_max_slot_size, size); mem =3D kvm_alloc_slot(kml); + mem->as_id =3D kml->as_id; mem->memory_size =3D slot_size; mem->start_addr =3D start_addr; mem->ram =3D ram; @@ -1221,14 +1233,10 @@ static void kvm_log_sync(MemoryListener *listener, MemoryRegionSection *section) { KVMMemoryListener *kml =3D container_of(listener, KVMMemoryListener, l= istener); - int r; =20 kvm_slots_lock(); - r =3D kvm_physical_sync_dirty_bitmap(kml, section); + kvm_physical_sync_dirty_bitmap(kml, section); kvm_slots_unlock(); - if (r < 0) { - abort(); - } } =20 static void kvm_log_clear(MemoryListener *listener, diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index 1da30e1884..e13075f738 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -23,6 +23,8 @@ typedef struct KVMSlot int old_flags; /* Dirty bitmap cache for the slot */ unsigned long *dirty_bmap; + /* Cache of the address space ID */ + int as_id; } KVMSlot; =20 typedef struct KVMMemoryListener { --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499131; cv=none; d=zohomail.com; s=zohoarc; b=jCHwMJIaTXkpHJhvCo59wgueTByEWKwF302dhmuGPxCs7YlUZA7OHOztKwwNdiCksDxYZUuKGC91H0B0CTC/ezF9DNJSOC87G6c2upPGfDeCfVXfHhdDG/X/BFtvM0pXsRbB1vvAYQ4R3kjgkbnN9x794niTQScsn/j1Chr627A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499131; h=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=0kzAGXdJzBdfA3QG0wpa3vohEalvQkpe/xDroTVz8aI=; b=aYNOJYrUR8gbaxdo8eaRe0tOVANXVWUKHxilsZTNW6HfrVo3cBOZZiD+njJ5t3AmqH8WFhEv39B40poTFsrfZ31n3rB/6ceQEGsjSBMQNiBw22Tgbn3u1ezOvztCacJ3AlfhN3DGKc/W4x0AtbIKtLNJzVv6u/UK2vzBNyGp22o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499131695287.54699517242204; Thu, 20 May 2021 01:25:31 -0700 (PDT) Received: from localhost ([::1]:50110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljdzm-0008IM-Ip for importer@patchew.org; Thu, 20 May 2021 04:25:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0005NW-FC for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:18 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:41913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxX-0001X3-BN for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id l11-20020a05600c4f0bb029017a7cd488f5so2020668wmq.0 for ; Thu, 20 May 2021 01:23:08 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0kzAGXdJzBdfA3QG0wpa3vohEalvQkpe/xDroTVz8aI=; b=cbKVhyGtK43alYsCZFGvsWIKWH8VqYgKH8ocJRjAmlndhWGxxCiVYIPU1SCKFxlzXg YdTrxr+KofRyUSJ/P7ekCpXF7hCkaTLqLCeafokn8DYLBDmKqF2mqOuFHgCKbmx1l4ef m4HWAxmBboeR/DvVZPTJTGN1FLw+0D70PLA1GR+pYwOPRxGghWipyAFeuLm0TOtocVj0 YpCsO/56GbWM8aLKOM5yBdTl6t8YCGxGZSS4M16qFcw0o2WgzJ1rywWLO1P71ZRabQC+ xi2HVMOsMypKL93JvFxnDtBhEDabFYmD6sI7xju5C3wEaInzHpPqC/kiKVrcNa44hpH6 M07g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0kzAGXdJzBdfA3QG0wpa3vohEalvQkpe/xDroTVz8aI=; b=RizCu750q+aW8L4//qOcueh10FZ0bLjfp5Wzi+EqzD3WBcWdUx5souqioVej3XlKyW eNnuUhLzq/clWt/tO0KX3Pz/H0moZfIghoi09dHlOYSqVx5XkfSIJCY9HMz46TdO9Cq5 Tvb0hQIRZkyIZIupU5Q2Ky3dLq5E65MOl/yBK5mOqhUoW4KWlnlvnkFhZoUtjFXyHrcX LXjDS3OljV7Aldcbg1qlmuldjedw0KIkY3BGADlTFLc2YTeUNnNNebWVGU9M9660JaNM r/MgGxE7rdiBJ5838KEfE5RGFmyY3EJYQwvouhcibQCUG5lnFrGllRX9ZqS8N2M7JdzK Hh4A== X-Gm-Message-State: AOAM530A2YvaaA5EOQg8ndsKjCBbMbRm32agu8IlEYupgRHt1edpAVao ZzaQERmgJaLxx+ampZU8mMn4t6ZsfoHzBQ== X-Google-Smtp-Source: ABdhPJw0oSvdRr2EPcCNbtVUU7uJ580dAnL6go8hzpxEIz0EmdpdwAwrPbksldHyKiTWEPQB41ZvAg== X-Received: by 2002:a05:600c:896:: with SMTP id l22mr2428979wmp.164.1621498987759; Thu, 20 May 2021 01:23:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/26] KVM: Provide helper to sync dirty bitmap from slot to ramblock Date: Thu, 20 May 2021 10:22:45 +0200 Message-Id: <20210520082257.187061-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::32f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . David Alan Gilbert" , Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu kvm_physical_sync_dirty_bitmap() calculates the ramblock offset in an awkward way from the MemoryRegionSection that passed in from the caller. The truth is for each KVMSlot the ramblock offset never change for the lifecycle. Cache the ramblock offset for each KVMSlot into the structure when the KVMSlot is created. With that, we can further simplify kvm_physical_sync_dirty_bitmap() with a helper to sync KVMSlot dirty bitmap to the ramblock dirty bitmap of a specific KVMSlot. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-6-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 37 +++++++++++++++++-------------------- include/sysemu/kvm_int.h | 2 ++ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index caaa2a5c98..7031dd4250 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -573,15 +573,12 @@ static void kvm_log_stop(MemoryListener *listener, } =20 /* get kvm's dirty pages bitmap and update qemu's */ -static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, - unsigned long *bitmap) +static void kvm_slot_sync_dirty_pages(KVMSlot *slot) { - ram_addr_t start =3D section->offset_within_region + - memory_region_get_ram_addr(section->mr); - ram_addr_t pages =3D int128_get64(section->size) / qemu_real_host_page= _size; + ram_addr_t start =3D slot->ram_start_offset; + ram_addr_t pages =3D slot->memory_size / qemu_real_host_page_size; =20 - cpu_physical_memory_set_dirty_lebitmap(bitmap, start, pages); - return 0; + cpu_physical_memory_set_dirty_lebitmap(slot->dirty_bmap, start, pages); } =20 #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) @@ -656,26 +653,19 @@ static void kvm_physical_sync_dirty_bitmap(KVMMemoryL= istener *kml, KVMState *s =3D kvm_state; KVMSlot *mem; hwaddr start_addr, size; - hwaddr slot_size, slot_offset =3D 0; + hwaddr slot_size; =20 size =3D kvm_align_section(section, &start_addr); while (size) { - MemoryRegionSection subsection =3D *section; - slot_size =3D MIN(kvm_max_slot_size, size); mem =3D kvm_lookup_matching_slot(kml, start_addr, slot_size); if (!mem) { /* We don't have a slot if we want to trap every access. */ return; } - if (kvm_slot_get_dirty_log(s, mem)) { - subsection.offset_within_region +=3D slot_offset; - subsection.size =3D int128_make64(slot_size); - kvm_get_dirty_pages_log_range(&subsection, d.dirty_bitmap); + kvm_slot_sync_dirty_pages(mem); } - - slot_offset +=3D slot_size; start_addr +=3D slot_size; size -=3D slot_size; } @@ -1134,7 +1124,8 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, int err; MemoryRegion *mr =3D section->mr; bool writeable =3D !mr->readonly && !mr->rom_device; - hwaddr start_addr, size, slot_size; + hwaddr start_addr, size, slot_size, mr_offset; + ram_addr_t ram_start_offset; void *ram; =20 if (!memory_region_is_ram(mr)) { @@ -1152,9 +1143,13 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, return; } =20 - /* use aligned delta to align the ram address */ - ram =3D memory_region_get_ram_ptr(mr) + section->offset_within_region + - (start_addr - section->offset_within_address_space); + /* The offset of the kvmslot within the memory region */ + mr_offset =3D section->offset_within_region + start_addr - + section->offset_within_address_space; + + /* use aligned delta to align the ram address and offset */ + ram =3D memory_region_get_ram_ptr(mr) + mr_offset; + ram_start_offset =3D memory_region_get_ram_addr(mr) + mr_offset; =20 kvm_slots_lock(); =20 @@ -1193,6 +1188,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, mem->as_id =3D kml->as_id; mem->memory_size =3D slot_size; mem->start_addr =3D start_addr; + mem->ram_start_offset =3D ram_start_offset; mem->ram =3D ram; mem->flags =3D kvm_mem_flags(mr); kvm_slot_init_dirty_bitmap(mem); @@ -1203,6 +1199,7 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, abort(); } start_addr +=3D slot_size; + ram_start_offset +=3D slot_size; ram +=3D slot_size; size -=3D slot_size; } while (size); diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index e13075f738..ab09a150e1 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -25,6 +25,8 @@ typedef struct KVMSlot unsigned long *dirty_bmap; /* Cache of the address space ID */ int as_id; + /* Cache of the offset in ram address space */ + ram_addr_t ram_start_offset; } KVMSlot; =20 typedef struct KVMMemoryListener { --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500248; cv=none; d=zohomail.com; s=zohoarc; b=nAgdeDd9CFIiyeGdDSuJjV49/yMAalX1QTDAmtfh3puFlHNuWPv5Wi6HI5eZyzpQHkLvsW3PXpWxmIyZBESVswUB1zOcshLFFOgVx7j+smPUHFiqLVyLvv9lyv8S7QVcMicPGXNk4vtR23YtdngWfermsouItfGiYp1MsfskKkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500248; h=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=9/dX3PC3FCiO5p7uuZf1RyQ9MDHL5qIlrYK5aAJJIeY=; b=d5mKmrTU/m2r0CTxxe8eK5CI+KWI2LdjsPVMLqqd8YDfiPfEqV+H+miyuEB43EnGAksRAuETJxAWvw77ed3/ssOcroHHXefFJ6T604gj8fbFIQZLA8eion954U7EwVqQR7A7sNnMyt0hbereqppMyip5GrKdhCVCfaZg4EQYbc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500248762950.8490892603875; Thu, 20 May 2021 01:44:08 -0700 (PDT) Received: from localhost ([::1]:34990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeHn-00041U-PP for importer@patchew.org; Thu, 20 May 2021 04:44:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RV-Ol for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:45022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001Xl-1R for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:24 -0400 Received: by mail-wm1-x32a.google.com with SMTP id y184-20020a1ce1c10000b02901769b409001so4671242wmg.3 for ; Thu, 20 May 2021 01:23:09 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9/dX3PC3FCiO5p7uuZf1RyQ9MDHL5qIlrYK5aAJJIeY=; b=FVTer/RJhNN4vLa0lm9lSSm7+lL5wAyRn5BQZ5IG2RCgGcX4aJixkFw66Y5EXMb/k5 qYgDs0CfQFN9e+zzPYWOEgZ68AV8Xf1YHo9TXFVDVTScswyinz7Royv2T34dgVhYELOp nKVehjm/7F/+VcJE74u+cS/h4ZPuUW8ZfwrIJAldtCLWMgftmOLj9KMsEJZyY7P2o2mD m09y59BPkTlsANTVJX+QCYOdNc7X6EVKn/l8r2UqP0cIAgLtDPW8KqDuNKgTNUCJoB+G 9dVinB4GtznXaLpwtTfuZNNx1N1jI9TRRnNNcud7MZTdfW95Ue8V280KL5g6FCWoxk0y ygZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=9/dX3PC3FCiO5p7uuZf1RyQ9MDHL5qIlrYK5aAJJIeY=; b=V2KRZAbtUPUvqZrVk2IJOcRZ6q1Ynt+tB0FhEspklQZcWgUfCGZUvUGrp1FulHgt5f aQSsgsC+66PYGTYsehcbJS07fsryBkLE5GUN9XonvwdrwZa0+PqThv9tDhlrf6VUNGq1 RH7TYeMhhf5fJcspfXSWsZnjw/oNTialQLxzoYcbl60rQc3PwwP05r402KjIUac1sZly jBVSv8CuYtvHun7X4Mf4BR9XSYPhqHvQSCHC94SNyFnjGeePts1NWzn57/3v1THXmHhp RAnzrA2cFjG5yw+ReVtWTz8lsUuwoAQVGQxccSp0Ub0nsKo8BuMxTxu9+shW0+eVMUGS Io8g== X-Gm-Message-State: AOAM5336Zc253K4aWV4XA1yIQzWNiB0J+pZpmV3kJuWlMCo1Ilhr1xf7 Ny2elm5X1Pkd6PB8gZEDQpiK5Z5+KjYkfA== X-Google-Smtp-Source: ABdhPJzoWqW+BUvItzVLsj8dsAj6wmxcY4QRbN3eEh37FE0+fLnLcatdFaLzVPiCoyh2TTTjOHog5A== X-Received: by 2002:a05:600c:da:: with SMTP id u26mr2346821wmm.128.1621498988402; Thu, 20 May 2021 01:23:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/26] KVM: Simplify dirty log sync in kvm_set_phys_mem Date: Thu, 20 May 2021 10:22:46 +0200 Message-Id: <20210520082257.187061-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::32a; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu kvm_physical_sync_dirty_bitmap() on the whole section is inaccurate, because the section can be a superset of the memslot that we're working on. The re= sult is that if the section covers multiple kvm memslots, we could be doing the synchronization for multiple times for each kvmslot in the section. With the two helpers that we just introduced, it's very easy to do it right= now by calling the helpers. Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-7-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 7031dd4250..0ba6d48120 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1161,7 +1161,8 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, goto out; } if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { - kvm_physical_sync_dirty_bitmap(kml, section); + kvm_slot_get_dirty_log(kvm_state, mem); + kvm_slot_sync_dirty_pages(mem); } =20 /* unregister the slot */ --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500624; cv=none; d=zohomail.com; s=zohoarc; b=YCcq3mpy+yBvO8Iky+86d+0r88w0ZvsW7V9ckut96cP/HUtqIVaSZ5VYkzw9ZcSE4rtkSPPEXeweYhSk2g1IkHdFIpihnqOKrPJzMr2tfjtgvW0pacwkggLOHGPzFFvKj/pLfr3H7hE1HERIEZZoT6l6GOQHTcKcdwx/dtpf/6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500624; h=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=XwYPwSfA8Cvd3/TBJlc2cW5Z9lV4MqaeOY7vnJJhpgo=; b=Qf1yNyYEdPeEYO1LTyUmHsPNcAw8uKTirON3cG/Nfr2HDIf2xCfliJTANef9mrJVlXWrgRgyCIh7n/P1e8n2nta9u3MP+8nvFfTTQessp8GJwf2cmq7t4guhUaAuCiasWLlbzbvgxaC43Hvy6KD8IPTwqMwxvzgQyiQJJ3+9SpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500624800626.3589652354652; Thu, 20 May 2021 01:50:24 -0700 (PDT) Received: from localhost ([::1]:54114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeNr-0008Vk-OD for importer@patchew.org; Thu, 20 May 2021 04:50:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RJ-8Z for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0001Xp-6t for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:21 -0400 Received: by mail-wm1-x32e.google.com with SMTP id b7so8019699wmh.5 for ; Thu, 20 May 2021 01:23:09 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XwYPwSfA8Cvd3/TBJlc2cW5Z9lV4MqaeOY7vnJJhpgo=; b=G6zvob/m6LJmHrC0nskxHWy8x8uh0GpRkil5O2u3WmQUk43mXbzEA8hS22V3v3U0MP jb+wnf5HFLPPPe511VXEhtlKzdi2VkSKEyPwF7/QEuGGRP0xITYENWkdp2vyIfNiN0ZT MEHFUirUUS7QTDGK/Y3pbdJfNtML8PrInYBhsnQCFdVbdesqXuPaLrk2yKAKyziP7iMz mMI8DYRntADQ62Jbt4p9ZgVXY/OZyfP2zyyG4VeCnTF8YL7yKyRQB1RsSfFJdPnoa2Xn PWk7ryy8ALRdEigkxR55fSq6WJKEWbX6zzLq+zyGlnBq3+qh+WAh1Yy78mXAEXr3yacG Ny/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XwYPwSfA8Cvd3/TBJlc2cW5Z9lV4MqaeOY7vnJJhpgo=; b=cqT2rXw/sJbE0djmNhbjUmW+9v2c//eK0qvncmZcRJme3ZljdF0rC0IAMsxC5fPdgR +aurWSILgdK7zQg3yVVxaZlZoXMnzy43ZmRAVteLgCtLqQV1bLBQtkW4otSZL9GV+fNj 7BHvxp4Wqma3kYUljteAvMt56ludT5Y5ynTmuIST47Yepg+46VYbzjI65B0DG+xrheYg BqzURmK+TPN1zOxfNBTNhjzm81kqlIpvvlA/aZGp8FEQ8susaYWyOyv8F5FvjZiIRTbh EaXZZ2F1nuBQbtTvbAHx/C8mp2iFyL+SYz2SV8vo6xGl9yUUUYS7zeo+Joo/k61lRh41 AzFQ== X-Gm-Message-State: AOAM532KAPD4qgp/Jgq8ScDsOip2g6hNHGG5fuKlEctWp6EymM613y3Z 9b4aeSnIN7VwPBvAJioS02x+aYVywLQKvQ== X-Google-Smtp-Source: ABdhPJxo/dPsmkboBoZOT21QNkAwFqODd89/bbzLzoWBIWahsTWMi+MvsH3/Q7N3S/MfTrgqd2t+KQ== X-Received: by 2002:a7b:c258:: with SMTP id b24mr2404165wmj.52.1621498989102; Thu, 20 May 2021 01:23:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/26] KVM: Cache kvm slot dirty bitmap size Date: Thu, 20 May 2021 10:22:47 +0200 Message-Id: <20210520082257.187061-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::32e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . David Alan Gilbert" , Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Cache it too because we'll reference it more frequently in the future. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-8-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 1 + include/sysemu/kvm_int.h | 1 + 2 files changed, 2 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 0ba6d48120..df9fbf59a6 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -610,6 +610,7 @@ static void kvm_slot_init_dirty_bitmap(KVMSlot *mem) hwaddr bitmap_size =3D ALIGN(mem->memory_size / qemu_real_host_page_si= ze, /*HOST_LONG_BITS*/ 64) / 8; mem->dirty_bmap =3D g_malloc0(bitmap_size); + mem->dirty_bmap_size =3D bitmap_size; } =20 /* diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index ab09a150e1..c788452cd9 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -23,6 +23,7 @@ typedef struct KVMSlot int old_flags; /* Dirty bitmap cache for the slot */ unsigned long *dirty_bmap; + unsigned long dirty_bmap_size; /* Cache of the address space ID */ int as_id; /* Cache of the offset in ram address space */ --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500247; cv=none; d=zohomail.com; s=zohoarc; b=N11qDVEud0H2e8o3E22Y/7Qa2ouqBehG250dmFgxUzInEP90NQDiCFyEPAkQ/0/35h7unPP4m4Ld10Wnc0z7ygW3SeYUbu4pForQa6KpU17tzsOcaQy70CZGT1NudHZsJ/2wkzYo8ZjiBmq0cBo8F6ZMHpeXxnoYb/1rb0pCef4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500247; h=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=+6To3R747Gt8KrZIdybi9XgGpLzBn8XFWqjsTJBScXc=; b=Qzz4e2Z/9D22sHB8yb1S20qiP8EHTpJqIRFutt3i5BHFtW4yDed/8PwMdlAwliA/3pn4ElZnF92PeSOhyq2znJ/7E3t/oUElPQQmuLaFER8aYr7oL+WskQst8wdi3vNEFgjH0/4u6B94OoUMOIN+susdlHa69uwiYQWCjGSXNRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500247331643.1044886123262; Thu, 20 May 2021 01:44:07 -0700 (PDT) Received: from localhost ([::1]:34870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeHm-0003wm-8I for importer@patchew.org; Thu, 20 May 2021 04:44:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RK-8v for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:51061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001Y5-08 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:22 -0400 Received: by mail-wm1-x332.google.com with SMTP id t206so8638725wmf.0 for ; Thu, 20 May 2021 01:23:10 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+6To3R747Gt8KrZIdybi9XgGpLzBn8XFWqjsTJBScXc=; b=naWvRZUwVgLVlkiEDYK/2S4K54bNcNJ0G3DKgqUJpVP4fs7tdUvQQBBdtRzSCEe9HT iIs1Hmm9S2+m6E0TC+d9wpHVbw3jkNBqOwSaEIVxdqXwhnYYWQkFeU2MTlH35jy4VZCw D/mfqFNbLlqHQ7tPcotn/Byuh+RhYRSrfr2rCfMXIBFY1oXf9bf4VWkFb+NLYlsOTL5E bwHiiA8hDPOsoiMzUyHOgEwHcKXCUO3FzsedlR3BkdGieWzjpVl8Wu+iwLPHaK4ys/gx X3Q2JPLh1C27XxD1yBlcX2CeQNeuP0YlGzFhm0kuzjSmxLA4pOIoZ78JBbVmy6m8yk/x qUzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+6To3R747Gt8KrZIdybi9XgGpLzBn8XFWqjsTJBScXc=; b=HiUT3e/4wxzq4LadKcX41XLMb6+f1ai2JFozbE00/oSB8RINhmDAlBniGfIyZe/QO/ R7nDNHSr6vvTArktEMpmotJYYhcQKcCy1rTpqmIE0e1PMo4fuU6+s5wFqJqXBDDhogbc F8if2FmP7EcFxGnjg6X84QHrdiQR3PZvw2gMTRT6KyR5/TwAboGxPIn0BY+SE5T3XkVO gH79gGct97ZG+uR+LAXTv8BIvgTGx1vh2OZmcqVdDgNJs8i0t1Kx0gB7ewF+aOhZJkdd NPW1JhChYqbTb8wEtW4l3Qe3LcWzecPChKznoI1OFeKuuI7RMzUMFPH5Xy/COPPaCJzG hlnw== X-Gm-Message-State: AOAM531oHm+WNTLgjcIoIsxL+HX3vStcIL71/OaPd+OT7SLi5rxypbpZ SpPcw/bWeSN8Nyq7BvZGFtdun7ZY5V5FFg== X-Google-Smtp-Source: ABdhPJzSAenX3C9bCSoZbUP2MXyJQ69B+ZAZRXIjEZpUzG4pr4gNfGpjgF0fhpmh4HSY0SvJ72saTg== X-Received: by 2002:a1c:2507:: with SMTP id l7mr2399148wml.188.1621498989713; Thu, 20 May 2021 01:23:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 17/26] KVM: Add dirty-ring-size property Date: Thu, 20 May 2021 10:22:48 +0200 Message-Id: <20210520082257.187061-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::332; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu Add a parameter for dirty gfn count for dirty rings. If zero, dirty ring is disabled. Otherwise dirty ring will be enabled with the per-vcpu gfn count= as specified. If dirty ring cannot be enabled due to unsupported kernel or illegal parameter, it'll fallback to dirty logging. By default, dirty ring is not enabled (dirty-gfn-count default to 0). Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-9-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ qemu-options.hx | 12 ++++++++++++ 2 files changed, 58 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index df9fbf59a6..5afe15ae66 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -126,6 +126,8 @@ struct KVMState KVMMemoryListener *ml; AddressSpace *as; } *as; + uint64_t kvm_dirty_ring_bytes; /* Size of the per-vcpu dirty ring */ + uint32_t kvm_dirty_ring_size; /* Number of dirty GFNs per ring */ }; =20 KVMState *kvm_state; @@ -3182,6 +3184,42 @@ bool kvm_kernel_irqchip_split(void) return kvm_state->kernel_irqchip_split =3D=3D ON_OFF_AUTO_ON; } =20 +static void kvm_get_dirty_ring_size(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + KVMState *s =3D KVM_STATE(obj); + uint32_t value =3D s->kvm_dirty_ring_size; + + visit_type_uint32(v, name, &value, errp); +} + +static void kvm_set_dirty_ring_size(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + KVMState *s =3D KVM_STATE(obj); + Error *error =3D NULL; + uint32_t value; + + if (s->fd !=3D -1) { + error_setg(errp, "Cannot set properties after the accelerator has = been initialized"); + return; + } + + visit_type_uint32(v, name, &value, &error); + if (error) { + error_propagate(errp, error); + return; + } + if (value & (value - 1)) { + error_setg(errp, "dirty-ring-size must be a power of two."); + return; + } + + s->kvm_dirty_ring_size =3D value; +} + static void kvm_accel_instance_init(Object *obj) { KVMState *s =3D KVM_STATE(obj); @@ -3191,6 +3229,8 @@ static void kvm_accel_instance_init(Object *obj) s->kvm_shadow_mem =3D -1; s->kernel_irqchip_allowed =3D true; s->kernel_irqchip_split =3D ON_OFF_AUTO_AUTO; + /* KVM dirty ring is by default off */ + s->kvm_dirty_ring_size =3D 0; } =20 static void kvm_accel_class_init(ObjectClass *oc, void *data) @@ -3212,6 +3252,12 @@ static void kvm_accel_class_init(ObjectClass *oc, vo= id *data) NULL, NULL); object_class_property_set_description(oc, "kvm-shadow-mem", "KVM shadow MMU size"); + + object_class_property_add(oc, "dirty-ring-size", "uint32", + kvm_get_dirty_ring_size, kvm_set_dirty_ring_size, + NULL, NULL); + object_class_property_set_description(oc, "dirty-ring-size", + "Size of KVM dirty page ring buffer (default: 0, i.e. use bitmap)"= ); } =20 static const TypeInfo kvm_accel_type =3D { diff --git a/qemu-options.hx b/qemu-options.hx index e22fb94d99..ecdb064409 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -141,6 +141,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, " kvm-shadow-mem=3Dsize of KVM shadow MMU in bytes\n" " split-wx=3Don|off (enable TCG split w^x mapping)\n" " tb-size=3Dn (TCG translation block cache size)\n" + " dirty-ring-size=3Dn (KVM dirty ring GFN count, defaul= t 0)\n" " thread=3Dsingle|multi (enable multi-threaded TCG)\n",= QEMU_ARCH_ALL) SRST ``-accel name[,prop=3Dvalue[,...]]`` @@ -181,6 +182,17 @@ SRST where both the back-end and front-ends support it and no incompatible TCG features have been enabled (e.g. icount/replay). + + ``dirty-ring-size=3Dn`` + When the KVM accelerator is used, it controls the size of the per-= vCPU + dirty page ring buffer (number of entries for each vCPU). It should + be a value that is power of two, and it should be 1024 or bigger (= but + still less than the maximum value that the kernel supports). 4096 + could be a good initial value if you have no idea which is the bes= t. + Set this value to 0 to disable the feature. By default, this feat= ure + is disabled (dirty-ring-size=3D0). When enabled, KVM will instead + record dirty pages in a bitmap. + ERST =20 DEF("smp", HAS_ARG, QEMU_OPTION_smp, --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499746; cv=none; d=zohomail.com; s=zohoarc; b=T+5VTNSRsf51Gkp83zCMO/qsEZu9aYFanhv1h1479CBOk/bbGKvmIgBP2Z6QIP22GmoDhWp1WrGb7rgDW8SCPXUAGGARxvOJjSQezvaYqggnI4sGafI7EWXO+UDTF4q2EuTJV/sPcjas28hLKGgjB6U4FzMK2dMVWIakVOaEOVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499746; h=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=GBwYk/KWMuO+/yxHf80rqOKUhqHBFBQaoC17YufQN2w=; b=BnpiCK8sUWOXi55U6vpgzWP3+tAkYttmufW+QYE1lwoKLhiWVzvN00eOWGoEVY4wRxC17j5S25QfoAX94mx7edrbgSeL88iTph9/fvg2WiemLgTjDH/EuODw6GGMa8Z9BsZBAr17R53nuXNmiE5vL6ESc2hYYWqdpq+RMLdEzuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499746911149.71112842589127; Thu, 20 May 2021 01:35:46 -0700 (PDT) Received: from localhost ([::1]:47036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje9h-0001AO-QG for importer@patchew.org; Thu, 20 May 2021 04:35:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0005OP-9i for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:20 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxa-0001Yf-EZ for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:16 -0400 Received: by mail-wr1-x42f.google.com with SMTP id v12so16672838wrq.6 for ; Thu, 20 May 2021 01:23:11 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GBwYk/KWMuO+/yxHf80rqOKUhqHBFBQaoC17YufQN2w=; b=hJFoEmJmyFG9zwvVkX8sqnKLEOdhIE67k8ZTAQ56WJHOuUt27AXzQRTGnitMPoeaKu tzxhz+LZwHYq6Q1h8+DFTXSuIeMSKdUAgWlzQ9kel5TR7e19aWys1t+Ng2EUgvlhV4hV /xY/uETrb+6uKP+I89fyX/PeXEdnHMBXjkqoIagyIfelPyspXU+2gv2bK5pXGeYktJLb ydBWp15dQow27rJQxpKBGIVpnBfRdqGv4gA+NWrB3GjYNVPR5ygYSw3cnxv01833m6ry cAANsNk3dhXOwODqD3Bm6wyhucJIL07g/nc4DuNyFQWLtLY3JrT90t8XGdWr6qT3VpdP RkUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GBwYk/KWMuO+/yxHf80rqOKUhqHBFBQaoC17YufQN2w=; b=UUlkiMUaRjlEHp4wHtoYo0Pi0uDFbjfgwG1DoGU6YEQ1X2VKwrTEySadsKK6IZZuOv hFmYx9z+gb2TQx8Z4Xu9oqjGqRl42/H86FMNw73vn/wV7x0TzghpS9UgB65bVw5woG6+ QvrWsd4r9I9kNyI6lxCUf484jVxysU5RLNvlGRWUviKfAWbpVhIAfPhkyT3KYb8uFBRr EET1vlrENiMMkTLK1+ubcEM9jyyuf7BSE/IBJCHdYl7c9XYuIQo2JEBg9hu1kA504FJh DjMaNdeZNIWn5MuqLV4gvzgDW2WkQYCr5M3kUKc6yB+3p2RFc3pZAmbDF6EBIVeB0Frb 02oA== X-Gm-Message-State: AOAM532zccmSIEFjOqaRj8X9fqoZvqHNa1qK4pO3y8F1+sPKHqa2/m9g fCdZOONc7YNlUKtSwkNxCI8RX3o9xl+d4w== X-Google-Smtp-Source: ABdhPJxtVNuBdY5j5VyeNOgUfDiXX7l3LYIfWqn/Hbux3I5b1FqOaEjefN09xt4fDLAtR0c1SN/ldg== X-Received: by 2002:adf:eac9:: with SMTP id o9mr2957322wrn.120.1621498990388; Thu, 20 May 2021 01:23:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 18/26] KVM: Disable manual dirty log when dirty ring enabled Date: Thu, 20 May 2021 10:22:49 +0200 Message-Id: <20210520082257.187061-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is for KVM_CLEAR_DIRTY_LOG, which is only useful for KVM_GET_DIRTY_LOG. Skip enabling it for kvm dirty ring. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will not wr-protect all the p= ages initially, which is against how kvm dirty ring is used - there's no way for= kvm dirty ring to re-protect a page before it's notified as being written first with a GFN entry in the ring! So when KVM_DIRTY_LOG_INITIALLY_SET is enabl= ed with dirty ring, we'll see silent data loss after migration. Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-10-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 5afe15ae66..e1a6c7c89b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2131,20 +2131,29 @@ static int kvm_init(MachineState *ms) s->coalesced_pio =3D s->coalesced_mmio && kvm_check_extension(s, KVM_CAP_COALESCED_PIO); =20 - dirty_log_manual_caps =3D - kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); - dirty_log_manual_caps &=3D (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | - KVM_DIRTY_LOG_INITIALLY_SET); - s->manual_dirty_log_protect =3D dirty_log_manual_caps; - if (dirty_log_manual_caps) { - ret =3D kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, - dirty_log_manual_caps); - if (ret) { - warn_report("Trying to enable capability %"PRIu64" of " - "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. " - "Falling back to the legacy mode. ", - dirty_log_manual_caps); - s->manual_dirty_log_protect =3D 0; + /* + * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is + * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume= no + * page is wr-protected initially, which is against how kvm dirty ring= is + * usage - kvm dirty ring requires all pages are wr-protected at the v= ery + * beginning. Enabling this feature for dirty ring causes data corrup= tion. + */ + if (!s->kvm_dirty_ring_size) { + dirty_log_manual_caps =3D + kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2); + dirty_log_manual_caps &=3D (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | + KVM_DIRTY_LOG_INITIALLY_SET); + s->manual_dirty_log_protect =3D dirty_log_manual_caps; + if (dirty_log_manual_caps) { + ret =3D kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2= , 0, + dirty_log_manual_caps); + if (ret) { + warn_report("Trying to enable capability %"PRIu64" of " + "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed.= " + "Falling back to the legacy mode. ", + dirty_log_manual_caps); + s->manual_dirty_log_protect =3D 0; + } } } =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499939; cv=none; d=zohomail.com; s=zohoarc; b=Ld/OjGdZjW6J3PecX6aQ9F7o3PPU4gbs31Keh6uZYulcvk0HUCMyfEZcETlhseNzrjFQMqb8q6GZLx0NgFZG0Ymq2zlq5QBInXDPgOtQ5VYRBd4+6RxEnQRqp68mq1IP8utmubfPEg5ds3n3PSHNXn4e/48L0+Cl5xxR9l1ceMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499939; h=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=an7+odH0ObdHycom4daIIRPyZa0zjFG35WUJ38/yLaw=; b=glNYJAbIR7dATX0rRTieXmeT1d+qiH41CaIH3u7sd0v2EyQYSA/Gg52nEnBRl/VlUlXK1PnxUWnYsho656thdoIw0gtvwxH2jamIkXzescB4egXnVuhflI+m6u+0VCj0rcZPtGqxyxqM3Y3p2hPkQWXY4L9bDo7NU7mgRPWVmMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499939810258.618587189192; Thu, 20 May 2021 01:38:59 -0700 (PDT) Received: from localhost ([::1]:50348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeCf-0003ZY-5Z for importer@patchew.org; Thu, 20 May 2021 04:38:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RU-P9 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:43792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001Yp-1k for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:25 -0400 Received: by mail-wr1-x433.google.com with SMTP id p7so12940410wru.10 for ; Thu, 20 May 2021 01:23:12 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=an7+odH0ObdHycom4daIIRPyZa0zjFG35WUJ38/yLaw=; b=WrKdds7c8TsFMHz4euC8MmZHnKlsJgk7KnlMsUuGGeUoTKqLGEeNsHOtvF2AmohJEf bDwr8zeL2Dslfw50HO0xvkNpO1CTzFedtffflPz0qWsYJeqcTg5wEHUoUlaPcDrFUzqZ KkPpJ0/VymkeUOLF7f5nFbWtnF1taicJGzzyzBlIvFNNgTR34tjtoVzTIiD9zAZolAL/ 1yuhfknJffl4MQnBzhwNCkYv3CkG6sH9Y1K8CjXtVSZdoz++IVz2JX07yWaBPd+5TbC2 Me/7bP+eDb3bdAJW4PuP2HHCMTgTSMhA2KeVgvIcI62Dznokgd8GhSiiMRRAkyJFd1kN CTVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=an7+odH0ObdHycom4daIIRPyZa0zjFG35WUJ38/yLaw=; b=JRZT+oqMe2vE66z3YhO4OCv3vlTw/cjHFhZEpH4nyc0dm7vPxLdJ3DsinKKBluQw76 gIncaDE+XqOQ2IQOumq1a2fBdrca2NZMa54YY6mM7FRMlZZqtOv76Me4DHpkhX7LvCnG WoHbgVBtaDSHXRF092LErfg3O/B800am4iu51DAtZk3GhTJBJc/f7MpVakUI6xP3vu+G MooqZ+KCmDPl3mbUP0xMubjlnBUXotMy/gbia4ZtqwwXjdz9XGoQ+Pq2eosKhbBKAPlv 6ywnYZ67tKCXwm+EnIbQPAEsNvAS17mDjOW4W9l1XigMiP8EN2yw7lNuCb+2cRGn2EPo mn/w== X-Gm-Message-State: AOAM532DiINe6pH7BjAqAsOA0l3MwQmY7h32xcifGHaFhflIvmagMe3M rRRdQAHiMZT5eJ7z4jlXq187YvMYK/ThCA== X-Google-Smtp-Source: ABdhPJxhZJJNhpocbFwZiLvaG/t4Olyq54ihDtlo1m/i5ITIhilS8FL6c3J8q66C7iDOIMmgmlKagw== X-Received: by 2002:adf:e484:: with SMTP id i4mr2929954wrm.117.1621498991043; Thu, 20 May 2021 01:23:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 19/26] KVM: Dirty ring support Date: Thu, 20 May 2021 10:22:50 +0200 Message-Id: <20210520082257.187061-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::433; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Xu KVM dirty ring is a new interface to pass over dirty bits from kernel to the userspace. Instead of using a bitmap for each memory region, the dirty ring contains an array of dirtied GPAs to fetch (in the form of offset in slots). For each vcpu there will be one dirty ring that binds to it. kvm_dirty_ring_reap() is the major function to collect dirty rings. It can= be called either by a standalone reaper thread that runs in the background, collecting dirty pages for the whole VM. It can also be called directly by= any thread that has BQL taken. Signed-off-by: Peter Xu Message-Id: <20210506160549.130416-11-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 374 ++++++++++++++++++++++++++++++++++++++++- accel/kvm/trace-events | 7 + include/hw/core/cpu.h | 7 + 3 files changed, 385 insertions(+), 3 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index e1a6c7c89b..c7ec538850 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -15,6 +15,7 @@ =20 #include "qemu/osdep.h" #include +#include =20 #include =20 @@ -78,6 +79,25 @@ struct KVMParkedVcpu { QLIST_ENTRY(KVMParkedVcpu) node; }; =20 +enum KVMDirtyRingReaperState { + KVM_DIRTY_RING_REAPER_NONE =3D 0, + /* The reaper is sleeping */ + KVM_DIRTY_RING_REAPER_WAIT, + /* The reaper is reaping for dirty pages */ + KVM_DIRTY_RING_REAPER_REAPING, +}; + +/* + * KVM reaper instance, responsible for collecting the KVM dirty bits + * via the dirty ring. + */ +struct KVMDirtyRingReaper { + /* The reaper thread */ + QemuThread reaper_thr; + volatile uint64_t reaper_iteration; /* iteration number of reaper thr = */ + volatile enum KVMDirtyRingReaperState reaper_state; /* reap thr state = */ +}; + struct KVMState { AccelState parent_obj; @@ -128,6 +148,7 @@ struct KVMState } *as; uint64_t kvm_dirty_ring_bytes; /* Size of the per-vcpu dirty ring */ uint32_t kvm_dirty_ring_size; /* Number of dirty GFNs per ring */ + struct KVMDirtyRingReaper reaper; }; =20 KVMState *kvm_state; @@ -389,6 +410,13 @@ static int do_kvm_destroy_vcpu(CPUState *cpu) goto err; } =20 + if (cpu->kvm_dirty_gfns) { + ret =3D munmap(cpu->kvm_dirty_gfns, s->kvm_dirty_ring_size); + if (ret < 0) { + goto err; + } + } + vcpu =3D g_malloc0(sizeof(*vcpu)); vcpu->vcpu_id =3D kvm_arch_vcpu_id(cpu); vcpu->kvm_fd =3D cpu->kvm_fd; @@ -465,6 +493,19 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp) (void *)cpu->kvm_run + s->coalesced_mmio * PAGE_SIZE; } =20 + if (s->kvm_dirty_ring_size) { + /* Use MAP_SHARED to share pages with the kernel */ + cpu->kvm_dirty_gfns =3D mmap(NULL, s->kvm_dirty_ring_size, + PROT_READ | PROT_WRITE, MAP_SHARED, + cpu->kvm_fd, + PAGE_SIZE * KVM_DIRTY_LOG_PAGE_OFFSET); + if (cpu->kvm_dirty_gfns =3D=3D MAP_FAILED) { + ret =3D -errno; + DPRINTF("mmap'ing vcpu dirty gfns failed: %d\n", ret); + goto err; + } + } + ret =3D kvm_arch_init_vcpu(cpu); if (ret < 0) { error_setg_errno(errp, -ret, @@ -583,6 +624,11 @@ static void kvm_slot_sync_dirty_pages(KVMSlot *slot) cpu_physical_memory_set_dirty_lebitmap(slot->dirty_bmap, start, pages); } =20 +static void kvm_slot_reset_dirty_pages(KVMSlot *slot) +{ + memset(slot->dirty_bmap, 0, slot->dirty_bmap_size); +} + #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) =20 /* Allocate the dirty bitmap for a slot */ @@ -639,6 +685,171 @@ static bool kvm_slot_get_dirty_log(KVMState *s, KVMSl= ot *slot) return ret =3D=3D 0; } =20 +/* Should be with all slots_lock held for the address spaces. */ +static void kvm_dirty_ring_mark_page(KVMState *s, uint32_t as_id, + uint32_t slot_id, uint64_t offset) +{ + KVMMemoryListener *kml; + KVMSlot *mem; + + if (as_id >=3D s->nr_as) { + return; + } + + kml =3D s->as[as_id].ml; + mem =3D &kml->slots[slot_id]; + + if (!mem->memory_size || offset >=3D + (mem->memory_size / qemu_real_host_page_size)) { + return; + } + + set_bit(offset, mem->dirty_bmap); +} + +static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn) +{ + return gfn->flags =3D=3D KVM_DIRTY_GFN_F_DIRTY; +} + +static void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn) +{ + gfn->flags =3D KVM_DIRTY_GFN_F_RESET; +} + +/* + * Should be with all slots_lock held for the address spaces. It returns = the + * dirty page we've collected on this dirty ring. + */ +static uint32_t kvm_dirty_ring_reap_one(KVMState *s, CPUState *cpu) +{ + struct kvm_dirty_gfn *dirty_gfns =3D cpu->kvm_dirty_gfns, *cur; + uint32_t ring_size =3D s->kvm_dirty_ring_size; + uint32_t count =3D 0, fetch =3D cpu->kvm_fetch_index; + + assert(dirty_gfns && ring_size); + trace_kvm_dirty_ring_reap_vcpu(cpu->cpu_index); + + while (true) { + cur =3D &dirty_gfns[fetch % ring_size]; + if (!dirty_gfn_is_dirtied(cur)) { + break; + } + kvm_dirty_ring_mark_page(s, cur->slot >> 16, cur->slot & 0xffff, + cur->offset); + dirty_gfn_set_collected(cur); + trace_kvm_dirty_ring_page(cpu->cpu_index, fetch, cur->offset); + fetch++; + count++; + } + cpu->kvm_fetch_index =3D fetch; + + return count; +} + +/* Must be with slots_lock held */ +static uint64_t kvm_dirty_ring_reap_locked(KVMState *s) +{ + int ret; + CPUState *cpu; + uint64_t total =3D 0; + int64_t stamp; + + stamp =3D get_clock(); + + CPU_FOREACH(cpu) { + total +=3D kvm_dirty_ring_reap_one(s, cpu); + } + + if (total) { + ret =3D kvm_vm_ioctl(s, KVM_RESET_DIRTY_RINGS); + assert(ret =3D=3D total); + } + + stamp =3D get_clock() - stamp; + + if (total) { + trace_kvm_dirty_ring_reap(total, stamp / 1000); + } + + return total; +} + +/* + * Currently for simplicity, we must hold BQL before calling this. We can + * consider to drop the BQL if we're clear with all the race conditions. + */ +static uint64_t kvm_dirty_ring_reap(KVMState *s) +{ + uint64_t total; + + /* + * We need to lock all kvm slots for all address spaces here, + * because: + * + * (1) We need to mark dirty for dirty bitmaps in multiple slots + * and for tons of pages, so it's better to take the lock here + * once rather than once per page. And more importantly, + * + * (2) We must _NOT_ publish dirty bits to the other threads + * (e.g., the migration thread) via the kvm memory slot dirty + * bitmaps before correctly re-protect those dirtied pages. + * Otherwise we can have potential risk of data corruption if + * the page data is read in the other thread before we do + * reset below. + */ + kvm_slots_lock(); + total =3D kvm_dirty_ring_reap_locked(s); + kvm_slots_unlock(); + + return total; +} + +static void do_kvm_cpu_synchronize_kick(CPUState *cpu, run_on_cpu_data arg) +{ + /* No need to do anything */ +} + +/* + * Kick all vcpus out in a synchronized way. When returned, we + * guarantee that every vcpu has been kicked and at least returned to + * userspace once. + */ +static void kvm_cpu_synchronize_kick_all(void) +{ + CPUState *cpu; + + CPU_FOREACH(cpu) { + run_on_cpu(cpu, do_kvm_cpu_synchronize_kick, RUN_ON_CPU_NULL); + } +} + +/* + * Flush all the existing dirty pages to the KVM slot buffers. When + * this call returns, we guarantee that all the touched dirty pages + * before calling this function have been put into the per-kvmslot + * dirty bitmap. + * + * This function must be called with BQL held. + */ +static void kvm_dirty_ring_flush(void) +{ + trace_kvm_dirty_ring_flush(0); + /* + * The function needs to be serialized. Since this function + * should always be with BQL held, serialization is guaranteed. + * However, let's be sure of it. + */ + assert(qemu_mutex_iothread_locked()); + /* + * First make sure to flush the hardware buffers by kicking all + * vcpus out in a synchronous way. + */ + kvm_cpu_synchronize_kick_all(); + kvm_dirty_ring_reap(kvm_state); + trace_kvm_dirty_ring_flush(1); +} + /** * kvm_physical_sync_dirty_bitmap - Sync dirty bitmap from kernel space * @@ -1164,7 +1375,24 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, goto out; } if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { - kvm_slot_get_dirty_log(kvm_state, mem); + /* + * NOTE: We should be aware of the fact that here we're on= ly + * doing a best effort to sync dirty bits. No matter whet= her + * we're using dirty log or dirty ring, we ignored two fac= ts: + * + * (1) dirty bits can reside in hardware buffers (PML) + * + * (2) after we collected dirty bits here, pages can be di= rtied + * again before we do the final KVM_SET_USER_MEMORY_REGION= to + * remove the slot. + * + * Not easy. Let's cross the fingers until it's fixed. + */ + if (kvm_state->kvm_dirty_ring_size) { + kvm_dirty_ring_reap_locked(kvm_state); + } else { + kvm_slot_get_dirty_log(kvm_state, mem); + } kvm_slot_sync_dirty_pages(mem); } =20 @@ -1212,6 +1440,51 @@ out: kvm_slots_unlock(); } =20 +static void *kvm_dirty_ring_reaper_thread(void *data) +{ + KVMState *s =3D data; + struct KVMDirtyRingReaper *r =3D &s->reaper; + + rcu_register_thread(); + + trace_kvm_dirty_ring_reaper("init"); + + while (true) { + r->reaper_state =3D KVM_DIRTY_RING_REAPER_WAIT; + trace_kvm_dirty_ring_reaper("wait"); + /* + * TODO: provide a smarter timeout rather than a constant? + */ + sleep(1); + + trace_kvm_dirty_ring_reaper("wakeup"); + r->reaper_state =3D KVM_DIRTY_RING_REAPER_REAPING; + + qemu_mutex_lock_iothread(); + kvm_dirty_ring_reap(s); + qemu_mutex_unlock_iothread(); + + r->reaper_iteration++; + } + + trace_kvm_dirty_ring_reaper("exit"); + + rcu_unregister_thread(); + + return NULL; +} + +static int kvm_dirty_ring_reaper_init(KVMState *s) +{ + struct KVMDirtyRingReaper *r =3D &s->reaper; + + qemu_thread_create(&r->reaper_thr, "kvm-reaper", + kvm_dirty_ring_reaper_thread, + s, QEMU_THREAD_JOINABLE); + + return 0; +} + static void kvm_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -1240,6 +1513,36 @@ static void kvm_log_sync(MemoryListener *listener, kvm_slots_unlock(); } =20 +static void kvm_log_sync_global(MemoryListener *l) +{ + KVMMemoryListener *kml =3D container_of(l, KVMMemoryListener, listener= ); + KVMState *s =3D kvm_state; + KVMSlot *mem; + int i; + + /* Flush all kernel dirty addresses into KVMSlot dirty bitmap */ + kvm_dirty_ring_flush(); + + /* + * TODO: make this faster when nr_slots is big while there are + * only a few used slots (small VMs). + */ + kvm_slots_lock(); + for (i =3D 0; i < s->nr_slots; i++) { + mem =3D &kml->slots[i]; + if (mem->memory_size && mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { + kvm_slot_sync_dirty_pages(mem); + /* + * This is not needed by KVM_GET_DIRTY_LOG because the + * ioctl will unconditionally overwrite the whole region. + * However kvm dirty ring has no such side effect. + */ + kvm_slot_reset_dirty_pages(mem); + } + } + kvm_slots_unlock(); +} + static void kvm_log_clear(MemoryListener *listener, MemoryRegionSection *section) { @@ -1345,10 +1648,15 @@ void kvm_memory_listener_register(KVMState *s, KVMM= emoryListener *kml, kml->listener.region_del =3D kvm_region_del; kml->listener.log_start =3D kvm_log_start; kml->listener.log_stop =3D kvm_log_stop; - kml->listener.log_sync =3D kvm_log_sync; - kml->listener.log_clear =3D kvm_log_clear; kml->listener.priority =3D 10; =20 + if (s->kvm_dirty_ring_size) { + kml->listener.log_sync_global =3D kvm_log_sync_global; + } else { + kml->listener.log_sync =3D kvm_log_sync; + kml->listener.log_clear =3D kvm_log_clear; + } + memory_listener_register(&kml->listener, as); =20 for (i =3D 0; i < s->nr_as; ++i) { @@ -2131,12 +2439,53 @@ static int kvm_init(MachineState *ms) s->coalesced_pio =3D s->coalesced_mmio && kvm_check_extension(s, KVM_CAP_COALESCED_PIO); =20 + /* + * Enable KVM dirty ring if supported, otherwise fall back to + * dirty logging mode + */ + if (s->kvm_dirty_ring_size > 0) { + uint64_t ring_bytes; + + ring_bytes =3D s->kvm_dirty_ring_size * sizeof(struct kvm_dirty_gf= n); + + /* Read the max supported pages */ + ret =3D kvm_vm_check_extension(s, KVM_CAP_DIRTY_LOG_RING); + if (ret > 0) { + if (ring_bytes > ret) { + error_report("KVM dirty ring size %" PRIu32 " too big " + "(maximum is %ld). Please use a smaller valu= e.", + s->kvm_dirty_ring_size, + (long)ret / sizeof(struct kvm_dirty_gfn)); + ret =3D -EINVAL; + goto err; + } + + ret =3D kvm_vm_enable_cap(s, KVM_CAP_DIRTY_LOG_RING, 0, ring_b= ytes); + if (ret) { + error_report("Enabling of KVM dirty ring failed: %s. " + "Suggested mininum value is 1024.", strerror(= -ret)); + goto err; + } + + s->kvm_dirty_ring_bytes =3D ring_bytes; + } else { + warn_report("KVM dirty ring not available, using bitmap metho= d"); + s->kvm_dirty_ring_size =3D 0; + } + } + /* * KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is not needed when dirty ring is * enabled. More importantly, KVM_DIRTY_LOG_INITIALLY_SET will assume= no * page is wr-protected initially, which is against how kvm dirty ring= is * usage - kvm dirty ring requires all pages are wr-protected at the v= ery * beginning. Enabling this feature for dirty ring causes data corrup= tion. + * + * TODO: Without KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 and kvm clear dirty= log, + * we may expect a higher stall time when starting the migration. In = the + * future we can enable KVM_CLEAR_DIRTY_LOG to work with dirty ring to= o: + * instead of clearing dirty bit, it can be a way to explicitly wr-pro= tect + * guest pages. */ if (!s->kvm_dirty_ring_size) { dirty_log_manual_caps =3D @@ -2239,6 +2588,14 @@ static int kvm_init(MachineState *ms) ret =3D ram_block_discard_disable(true); assert(!ret); } + + if (s->kvm_dirty_ring_size) { + ret =3D kvm_dirty_ring_reaper_init(s); + if (ret) { + goto err; + } + } + return 0; =20 err: @@ -2551,6 +2908,17 @@ int kvm_cpu_exec(CPUState *cpu) case KVM_EXIT_INTERNAL_ERROR: ret =3D kvm_handle_internal_error(cpu, run); break; + case KVM_EXIT_DIRTY_RING_FULL: + /* + * We shouldn't continue if the dirty ring of this vcpu is + * still full. Got kicked by KVM_RESET_DIRTY_RINGS. + */ + trace_kvm_dirty_ring_full(cpu->cpu_index); + qemu_mutex_lock_iothread(); + kvm_dirty_ring_reap(kvm_state); + qemu_mutex_unlock_iothread(); + ret =3D 0; + break; case KVM_EXIT_SYSTEM_EVENT: switch (run->system_event.type) { case KVM_SYSTEM_EVENT_SHUTDOWN: diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events index e15ae8980d..72a01320a1 100644 --- a/accel/kvm/trace-events +++ b/accel/kvm/trace-events @@ -18,4 +18,11 @@ kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint32_t va= l, bool assign, uint32_t kvm_set_user_memory(uint32_t slot, uint32_t flags, uint64_t guest_phys_add= r, uint64_t memory_size, uint64_t userspace_addr, int ret) "Slot#%d flags= =3D0x%x gpa=3D0x%"PRIx64 " size=3D0x%"PRIx64 " ua=3D0x%"PRIx64 " ret=3D%d" kvm_clear_dirty_log(uint32_t slot, uint64_t start, uint32_t size) "slot#%"= PRId32" start 0x%"PRIx64" size 0x%"PRIx32 kvm_resample_fd_notify(int gsi) "gsi %d" +kvm_dirty_ring_full(int id) "vcpu %d" +kvm_dirty_ring_reap_vcpu(int id) "vcpu %d" +kvm_dirty_ring_page(int vcpu, uint32_t slot, uint64_t offset) "vcpu %d fet= ch %"PRIu32" offset 0x%"PRIx64 +kvm_dirty_ring_reaper(const char *s) "%s" +kvm_dirty_ring_reap(uint64_t count, int64_t t) "reaped %"PRIu64" pages (to= ok %"PRIi64" us)" +kvm_dirty_ring_reaper_kick(const char *reason) "%s" +kvm_dirty_ring_flush(int finished) "%d" =20 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d45f78290e..753ca90668 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -329,6 +329,10 @@ struct qemu_work_item; * @ignore_memory_transaction_failures: Cached copy of the MachineState * flag of the same name: allows the board to suppress calling of the * CPU do_transaction_failed hook function. + * @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dir= ty + * ring is enabled. + * @kvm_fetch_index: Keeps the index that we last fetched from the per-vCPU + * dirty ring structure. * * State of one CPU core or thread. */ @@ -400,9 +404,12 @@ struct CPUState { */ uintptr_t mem_io_pc; =20 + /* Only used in KVM */ int kvm_fd; struct KVMState *kvm_state; struct kvm_run *kvm_run; + struct kvm_dirty_gfn *kvm_dirty_gfns; + uint32_t kvm_fetch_index; =20 /* Used for events with 'vcpu' and *without* the 'disabled' properties= */ DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS); --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500361; cv=none; d=zohomail.com; s=zohoarc; b=CmzcJgSk31gYTuCmBKOk9dHfq+QB0kR5Q6G4YOOQCmZExcQKuy/xacKEnpwT3nyOfkPpDjr2qjZrIp5uUv06fSigfkxr1ecbIilRsVx7a5iU7/OQ56XZi1TkR4xlacpAU0FFZDevdOK5UM+LG5cZc4RJzFUgHITQiwx2lJhfl9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500361; 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=4v/9OYPB+jHGFxocgWm85QsiZNWsRItB2trj79AKSsE=; b=PU4a97zdE9I8tRK5J1goWV5ONkQbSueGRncrwxE6bcsuPIrRVrE7/mJ2zWv7+a1HneCWQiTgzo4aODUJhuxMkGAvSnJVXWsFeVAsAg2la2WQg7H4mPi5OH+yqwbEL3DLb3XrpECjqljW/H/xgULL9mZW7rcodl1WkniWnpObFKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500361781185.89900914374323; Thu, 20 May 2021 01:46:01 -0700 (PDT) Received: from localhost ([::1]:41344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeJc-0008HH-PW for importer@patchew.org; Thu, 20 May 2021 04:46:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RM-8P for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:43794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0001Ys-6k for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:21 -0400 Received: by mail-wr1-x435.google.com with SMTP id p7so12940434wru.10 for ; Thu, 20 May 2021 01:23:12 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4v/9OYPB+jHGFxocgWm85QsiZNWsRItB2trj79AKSsE=; b=YS7dpZ8wyJeZCP0lsoyn1FI23oT8uPsFxCujyU0AHYkpINptrDNTp4LEMSI9VwGoUK ulpNwNIrOuArIJ/ntO9h8Un5DTI1MriMP3luTaBY6kZwFpqBnp6CLjDlQQquYgRbreow HTWtvNYcvqNIceuTBlDp4Q/+7Yg0y68ZfTTInJIsh3p8rxQfZvq15grlPWx/zkRQ8Z7n jxqAYt+ChikdAIePso8UkDEtjIM236YSVU3vQ8woo0/gTK287zX5D8Q2SfbZasURluhx DAEL/c5ceSaIA1E8ucdra1id2uMBXxOgLPmiFw+axZIyAMsYxcxrrV/OVaRtUZmiygJE mfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4v/9OYPB+jHGFxocgWm85QsiZNWsRItB2trj79AKSsE=; b=iI0aroCQ2KfK593x+blYn4TT+vHNUcOFe6S2a3uv/eVpHv8exuhtDrIMbJXQ7UHyfI pUEmRW3Ys7MWSs2vsqgT9XGIjD+vUNfOrHhH8Ha9BJEnKs9IrYmFmL5PWM0m0DQ5EggR 2drQgsnSwOG3EaGMnb+p5ibTHM7G0mH5bQnkurBdYkhxk2KmNubiWblBx6RC3EvVwjU6 0ShB2VsxLJY2pqLqkBpFyObXca2bUWmvL/g2QHaOdo6EWXUxbAn/TDb8jp8qgkj1k63i ZGDWC4ZUTLKhkgM/XFnzK+4FkWCPiMd4lY9kf7kWdY6EejveBHpq8WULORQ+N4ciMzXC p4xQ== X-Gm-Message-State: AOAM532gHvQr+nYdfCEubCloCU99fe5ekigR2hGkwIf40pOJVky35mFs UINFMuwnmBSZPP7k42Qvgr6/kYPirmF1OQ== X-Google-Smtp-Source: ABdhPJx5f6JFWfLz5ObCKOO3DzN5kIi5AfQ3LSQsWUrm3B8hVNg9GWbqhQzwQid/nZeTUjM61lsxrQ== X-Received: by 2002:a5d:570c:: with SMTP id a12mr2926995wrv.354.1621498991673; Thu, 20 May 2021 01:23:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/26] tests/qtest/fuzz: Fix build failure Date: Thu, 20 May 2021 10:22:51 +0200 Message-Id: <20210520082257.187061-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 On Fedora 32, using clang (version 10.0.1-3.fc32) we get: tests/qtest/fuzz/fuzz.c:237:5: error: implicit declaration of function 'q= emu_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration] qemu_init(result.we_wordc, result.we_wordv, NULL); ^ qemu_init() is declared in "sysemu/sysemu.h", include this header to fix. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210513162008.3922223-1-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- tests/qtest/fuzz/fuzz.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 04b70e114b..5f77c84983 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -16,6 +16,7 @@ #include =20 #include "qemu/datadir.h" +#include "sysemu/sysemu.h" #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "qemu/main-loop.h" --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621499748; cv=none; d=zohomail.com; s=zohoarc; b=VBPEFhcDFjIO/ynNzm8GRFmfPPbN8ibcxRvWywAGzl6qY0IvoW6TFm0R6Xc+VOA3RbjC0LgtpdE/5ZoP07Xg3NvnoeRxnap0O8cNV9xQwr+mrxkb7JWErKXJ1t+i6LROfCFsSEEnTffRe9BF+gStEmMSZwcesDvGZFKhnUFCicU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621499748; h=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=8IhabcaqhDrc9tLSsH3atAhctazNweFNZbmm5n9WDvA=; b=HVEpeTMOq1wpQ783PeN+lORxzWk6nvQrztq8jkS8LVljCY6NNbshvEBvzc2/qcH1Yh9IeSJP/AqtrIWKHSMsZcNMQ7OK5Kts6ZXB8m0snkMzrdtMq6I3bxYLnrC0rNZiadFRG0lV9MKXR8ao91IUoNycjAl5Q3r2zy9mft6gPMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621499748461808.1738038039133; Thu, 20 May 2021 01:35:48 -0700 (PDT) Received: from localhost ([::1]:47178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lje9j-0001Gb-Cn for importer@patchew.org; Thu, 20 May 2021 04:35:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RH-8a for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:33650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxb-0001ZN-6s for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:21 -0400 Received: by mail-wm1-x332.google.com with SMTP id z137-20020a1c7e8f0000b02901774f2a7dc4so4605173wmc.0 for ; Thu, 20 May 2021 01:23:13 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8IhabcaqhDrc9tLSsH3atAhctazNweFNZbmm5n9WDvA=; b=eFZ9hed3TMl3fgoe41lt9QHFooIZ/ovGc/u6D8zKsewJxk4qsWqlsjZFN9UvElZK/t lw2YLcmNF0+kEtiSidbzCnBxS3eTnN2UoGnYsuaYDK2CAnuqMpGSSR+QKDkL29amMhJ2 KML0YbVW4e/hCqq3dWFN94sWzAlyvkTUBnlVGldDBHs7gAPGlFK4th9f5AtbvI/ePHV1 R2hEgf+MxfomhOBr1AiArsF36WILEu9kNGhDVZ+16IbzFiP2rbDdFr55M2vDLJ5/Yf0s c+3melFZO/W8D7Q7wQonyoKzdp+ZbFwljHrGYcSd5uf949fQYGnfdYsmOyz+5gp+KlBI m5SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8IhabcaqhDrc9tLSsH3atAhctazNweFNZbmm5n9WDvA=; b=k3XGxB4yDr91VzQQWd4d28qnrzbnlcSVTaqRUuMBT1u860OxVPZQsywRpNua3YHDL2 ffxzxBmNScy53cWeM2SiqkhWnMefYduu8Yac0RmLE7ixXsuO6v9AJFFqzX5MJ4OpxXPV EEh3BD0BlDomU+3ZkQBewtI01Mx92QnejObZpIpgml8NM8sOZhOG07KTUaImIHxD5j4N pouEZ9m8BX/HQuOTBpdpBO3EB0C2bxknj01FGVIebbhi4BwOlNpkONXOeolK6VONlEXB fcU6ie3E77Hxp0zQlJKNYkxXSKdyWILxiwtMlXki8/26LbkjZK81mYPDdlWHHIsvhpiT Hc5Q== X-Gm-Message-State: AOAM5301QWdpybJ7EKSwaztq3HqW4U+KFGcs3uYhHrA5rkjZxsaD1fBQ 6YUs8fjOYRgrpEJVLqtXI4J9HDBchf8gdQ== X-Google-Smtp-Source: ABdhPJw4uGBo8tq+a0Qmwv313pVKv2zYMnsvRKX5cqrilt5SJlKmjj98T5gTlWogYHCWmW3l0r4Apw== X-Received: by 2002:a1c:2b05:: with SMTP id r5mr2339578wmr.66.1621498992285; Thu, 20 May 2021 01:23:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 21/26] meson: Set implicit_include_directories to false Date: Thu, 20 May 2021 10:22:52 +0200 Message-Id: <20210520082257.187061-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::332; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Graf , Katsuhiro Ueno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Katsuhiro Ueno Without this, libvixl cannot be compiled with macOS 11.3 SDK due to include file name conflict (usr/include/c++/v1/version conflicts with VERSION). Signed-off-by: Katsuhiro Ueno Message-Id: Tested-by: Alexander Graf Signed-off-by: Paolo Bonzini --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 1559e8d873..82977bf11f 100644 --- a/meson.build +++ b/meson.build @@ -2141,6 +2141,7 @@ common_all =3D common_ss.apply(config_all, strict: fa= lse) common_all =3D static_library('common', build_by_default: false, sources: common_all.sources() + genh, + implicit_include_directories: false, dependencies: common_all.dependencies(), name_suffix: 'fa') =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500495; cv=none; d=zohomail.com; s=zohoarc; b=n8yv9HGaSrWyUEnY5hVXA2s0A5QapT14MmazGBEsdyJGmIC1bIa7CwM1nS2FCgj0KcgCusCizwGFVjskd7jpu16+XSA4eRybvo13gjPkqvZqrVv1KY656HJjelSXkYzUHy9YnYqvY5oHZTKstvgyQF0G7ka90N69evheXKlR7Gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500495; h=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=7CKD3OtHqojn7OMLGARJQq+Hx6C8OYSiCkvBwkT+gLE=; b=hbHxKrxoTa07p6NG2xDv7gerM+YPQeD7Ssacisk5Dy0OnYo5wRPJdbx2abteGvoxzmeLh6JuM487I9JV5k1+aJEvpyPv308FM6YNZs3Q5vpfz+Ge1P+wPrhCt0W7Ka+iaVWlHvwgP0Dk8+n10W8/XpoH1R5+Q6NgUstTlGEPjoU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500495574987.3080835496983; Thu, 20 May 2021 01:48:15 -0700 (PDT) Received: from localhost ([::1]:47682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeLm-0004Ai-AM for importer@patchew.org; Thu, 20 May 2021 04:48:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RY-P9 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:53916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxe-0001Zl-Vw for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:24 -0400 Received: by mail-wm1-x336.google.com with SMTP id 62so7588397wmb.3 for ; Thu, 20 May 2021 01:23:13 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7CKD3OtHqojn7OMLGARJQq+Hx6C8OYSiCkvBwkT+gLE=; b=CRxHG0AIiK5E8RGhWaaPV0yLpDZc8fdsXM98Mq8G+7P9XZfyyg9m7TQSujC2U4X6aF SgN3zpcMVXy4ke7wlFnI9PAhIO1b6aJxe34Si1qdSfW+5vm+csmy/oE/Xd3W5EvGPVpa 32XfPs7+yzgKfPhCFRbvGxM/8OYZYE6TcfSLgACHXw0fh+DmrdeqvmIPXniY0605NNq1 +8sl25whyoUo6Up7Ti6CTVAFS7DOBlXlHgF/l41BKai36S32cKc+A95xDsTAViMoXShN Ygc0jSy1aMhbl8OaVOeUjhvxloOkRp5Zee57A3vqu5KJAn4cNC3PmhGxMuaqQSW3gv0o UiEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7CKD3OtHqojn7OMLGARJQq+Hx6C8OYSiCkvBwkT+gLE=; b=TT9BDkQ8Bx4oIorA/yYvhKPJXy/UI2/9bmieTgqSTJodiIxs1nWBgoDhWyzIiWzn/Z 5ik8zewoTQO7UCm1GGZ3kgn/whEt3LtdiPI62aXGhQuhFlZbI8agpmff0jsY+3EZbB2q g4PmUgQ4co+NpkyFr5ralYz8TGJTLq1L8NuRGnPo+9pYsPSQyuMchzP/Nkxr5xiCALb7 DXY0avqjlnqWC/PxLv2rghsNgg5iQ8TmG1c+cunL9NKykHkNa6XWerikhM0tiNGqi3Xi goWXEajo3eWE8OM0sP/zKAebD2Cvs8cpfzta0dPot4vD8p3NkoSj66bImtzPJ+YMUgFv J7HQ== X-Gm-Message-State: AOAM531t2nR6fcncUJIZ8DyF4rrg6qFlqUO7magkQn5xSReapVYsIYmS HhKD3OFm8Gmh85NZDdw+XT0JcbAiZ+XV7A== X-Google-Smtp-Source: ABdhPJw4+2C9F1aS3wWI8JNXb67mWKd4wkVqIzgfN/f493BdxxjntXTuHJkUI13nGhoZ+C9C5tM5GQ== X-Received: by 2002:a05:600c:48a8:: with SMTP id j40mr2442127wmp.114.1621498992905; Thu, 20 May 2021 01:23:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 22/26] remove qemu-options* from root directory Date: Thu, 20 May 2021 10:22:53 +0200 Message-Id: <20210520082257.187061-23-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::336; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" These headers are also included from softmmu/vl.c, so they should be in include/. Remove qemu-options-wrapper.h, since elsewhere we include "template" headers directly and #define the parameters in the including file; move qemu-options.h to include/. Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- qemu-options.h =3D> include/qemu/qemu-options.h | 9 ++++- os-posix.c | 2 +- os-win32.c | 1 - qemu-options-wrapper.h | 40 ------------------- qemu-options.hx | 4 ++ softmmu/vl.c | 24 ++++++++--- 6 files changed, 31 insertions(+), 49 deletions(-) rename qemu-options.h =3D> include/qemu/qemu-options.h (88%) delete mode 100644 qemu-options-wrapper.h diff --git a/qemu-options.h b/include/qemu/qemu-options.h similarity index 88% rename from qemu-options.h rename to include/qemu/qemu-options.h index b4ee63cd60..4a62c83c45 100644 --- a/qemu-options.h +++ b/include/qemu/qemu-options.h @@ -29,8 +29,13 @@ #define QEMU_OPTIONS_H =20 enum { -#define QEMU_OPTIONS_GENERATE_ENUM -#include "qemu-options-wrapper.h" + +#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ + opt_enum, +#define DEFHEADING(text) +#define ARCHHEADING(text, arch_mask) + +#include "qemu-options.def" }; =20 #endif diff --git a/os-posix.c b/os-posix.c index a6846f51c1..ae6c9f2a5e 100644 --- a/os-posix.c +++ b/os-posix.c @@ -32,7 +32,7 @@ #include "qemu-common.h" /* Needed early for CONFIG_BSD etc. */ #include "net/slirp.h" -#include "qemu-options.h" +#include "qemu/qemu-options.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "sysemu/runstate.h" diff --git a/os-win32.c b/os-win32.c index fd1137bab1..e31c921983 100644 --- a/os-win32.c +++ b/os-win32.c @@ -27,7 +27,6 @@ #include #include #include "qemu-common.h" -#include "qemu-options.h" #include "sysemu/runstate.h" =20 static BOOL WINAPI qemu_ctrl_handler(DWORD type) diff --git a/qemu-options-wrapper.h b/qemu-options-wrapper.h deleted file mode 100644 index 6f548e3922..0000000000 --- a/qemu-options-wrapper.h +++ /dev/null @@ -1,40 +0,0 @@ - -#if defined(QEMU_OPTIONS_GENERATE_ENUM) - -#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ - opt_enum, -#define DEFHEADING(text) -#define ARCHHEADING(text, arch_mask) - -#elif defined(QEMU_OPTIONS_GENERATE_HELP) - -#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ - if ((arch_mask) & arch_type) \ - fputs(opt_help, stdout); - -#define ARCHHEADING(text, arch_mask) \ - if ((arch_mask) & arch_type) \ - puts(stringify(text)); - -#define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL) - -#elif defined(QEMU_OPTIONS_GENERATE_OPTIONS) - -#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ - { option, opt_arg, opt_enum, arch_mask }, -#define DEFHEADING(text) -#define ARCHHEADING(text, arch_mask) - -#else -#error "qemu-options-wrapper.h included with no option defined" -#endif - -#include "qemu-options.def" - -#undef DEF -#undef DEFHEADING -#undef ARCHHEADING - -#undef QEMU_OPTIONS_GENERATE_ENUM -#undef QEMU_OPTIONS_GENERATE_HELP -#undef QEMU_OPTIONS_GENERATE_OPTIONS diff --git a/qemu-options.hx b/qemu-options.hx index ecdb064409..8116f79818 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -5276,3 +5276,7 @@ ERST =20 =20 HXCOMM This is the last statement. Insert new options before this line! + +#undef DEF +#undef DEFHEADING +#undef ARCHHEADING diff --git a/softmmu/vl.c b/softmmu/vl.c index 11ac3750d8..ac0ff6e160 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -88,7 +88,7 @@ #include "qapi/qobject-input-visitor.h" #include "qemu/option.h" #include "qemu/config-file.h" -#include "qemu-options.h" +#include "qemu/qemu-options.h" #include "qemu/main-loop.h" #ifdef CONFIG_VIRTFS #include "fsdev/qemu-fsdev.h" @@ -854,8 +854,17 @@ static void help(int exitcode) "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n", error_get_progname()); =20 -#define QEMU_OPTIONS_GENERATE_HELP -#include "qemu-options-wrapper.h" +#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ + if ((arch_mask) & arch_type) \ + fputs(opt_help, stdout); + +#define ARCHHEADING(text, arch_mask) \ + if ((arch_mask) & arch_type) \ + puts(stringify(text)); + +#define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL) + +#include "qemu-options.def" =20 printf("\nDuring emulation, the following keys are useful:\n" "ctrl-alt-f toggle full screen\n" @@ -880,8 +889,13 @@ typedef struct QEMUOption { =20 static const QEMUOption qemu_options[] =3D { { "h", 0, QEMU_OPTION_h, QEMU_ARCH_ALL }, -#define QEMU_OPTIONS_GENERATE_OPTIONS -#include "qemu-options-wrapper.h" + +#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ + { option, opt_arg, opt_enum, arch_mask }, +#define DEFHEADING(text) +#define ARCHHEADING(text, arch_mask) + +#include "qemu-options.def" { NULL }, }; =20 --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500494; cv=none; d=zohomail.com; s=zohoarc; b=OQDsATsrztwBEkfSaNSPuNSrW2h9TbP/KFgEyLoAUGOJCYaBUPuBL5/gedoRSaERp2xATEw6vXfBrjNHr+TsxKyBjYlqiSvTuGeQyqTuixdFih1mBPAakzmux0CUdktUc3kyq+ynlz5Es5hRI5P2/w0fSotTwVl41zfKgHVVpY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500494; h=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=rHESXCpUsGCW+It7hlotQkLFwpit1gHAqFSU/qRoQUY=; b=nL5z7pO47bpJZYrlTjDmqkNOLTBPoZESVD2Z2GWG7EA61Z1tvXHHs1vqvANWCOyvrQONUNO33j5/kunFRytbAWK796rCW7NJPdR0Qang8pqw+dGoPwzKmJhWXKp6AUZPxYJE3VzvilcHY8o0o+mvFc2XNh8OyxxH+P4lhUhTWnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500494658495.7894256974472; Thu, 20 May 2021 01:48:14 -0700 (PDT) Received: from localhost ([::1]:47696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeLl-0004B9-FH for importer@patchew.org; Thu, 20 May 2021 04:48:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RL-9X for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:43789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxe-0001Zo-V5 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:22 -0400 Received: by mail-wr1-x42f.google.com with SMTP id p7so12940550wru.10 for ; Thu, 20 May 2021 01:23:14 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rHESXCpUsGCW+It7hlotQkLFwpit1gHAqFSU/qRoQUY=; b=k2P9SKE0RpsDhBtE3q5Dv5muXSXbu1ZhbZhscOWqVtcJnMI4rOWvb9EbKpTb3vESRM XiPUOA52T+jMTQ6UV+WEKRWoJHhl872caqAUBALOmQttvuF48Inv7Gv2bRAivC7FLTF6 Y4pLq7LhCCEHLoFEk7PyyQkUf3AVux9zWt3V8jGXbjCqoN8zwUqxPWRmYkaHBonsYhC3 mC7wg6g3RJ0wNLsEF4XFM+ggT0rclAHc/zcWbfTnsv1EKS5EKzP2j8fAMo4T3KkR0DMi EB+FqNg7dqQRXOg99rDfZ2w5yiPu/Xn+mUxoT3yjeglUqJ6wqTgpc5+mSb98KNdZ6DYs kR2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rHESXCpUsGCW+It7hlotQkLFwpit1gHAqFSU/qRoQUY=; b=qSPM4HMCEntNEtcguc7l88ngpyP79J7CGa1R2PBsRn+QjJB59O5zpHIM9XJBUgpuhk 5qFkvsDX3gd50ZqAV5PwLkowKLrtTbg+kdtoPpvRICjz1Guvjb1iFsjo5oiY801jvnM9 G8yFIEc+hsmZWQQCzC2KrIXxPsz7qgtS+RTFl8TAiL8ZB7AQybmbfjMkecxcXXNgDxSM u65asTKx+YU09ipHVzIbYK6HoBABk12Dc9cnGYCpxdkC/MAdC3U/qFr9ECU9MRJ4MnoZ tE+I1Vg5jIJk5CdinXkoU2y17bBqhTn2uZvU0nCn0Fm5IiXqSGfrq76WFpCQsHyeQ4oE dzgA== X-Gm-Message-State: AOAM533cpVoI97FGX1rbdhNI+EYaDAT9AnNVJGOvNOAXAUf0VPnfBWaf VwHbCU8UuVt29gyfKk9PWA3OoHzx1WlvmA== X-Google-Smtp-Source: ABdhPJx1VpVCVUoz2REn3dvsiI8FV3rgLzMADnwS71fdEb3nWmzEEZ3XyLdxxUYul4kBUGB3kdf5DA== X-Received: by 2002:adf:d081:: with SMTP id y1mr2928212wrh.179.1621498993541; Thu, 20 May 2021 01:23:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 23/26] replication: move include out of root directory Date: Thu, 20 May 2021 10:22:54 +0200 Message-Id: <20210520082257.187061-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The replication.h file is included from migration/colo.c and tests/unit/tes= t-replication.c, so it should be in include/. Signed-off-by: Paolo Bonzini --- block/replication.c | 2 +- replication.h =3D> include/block/replication.h | 4 ++-- migration/colo.c | 2 +- replication.c | 2 +- tests/unit/test-replication.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename replication.h =3D> include/block/replication.h (98%) diff --git a/block/replication.c b/block/replication.c index 97be7ef4de..52163f2d1f 100644 --- a/block/replication.c +++ b/block/replication.c @@ -22,7 +22,7 @@ #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" -#include "replication.h" +#include "block/replication.h" =20 typedef enum { BLOCK_REPLICATION_NONE, /* block replication is not starte= d */ diff --git a/replication.h b/include/block/replication.h similarity index 98% rename from replication.h rename to include/block/replication.h index d49fc22cb9..21931b4f0c 100644 --- a/replication.h +++ b/include/block/replication.h @@ -23,7 +23,7 @@ typedef struct ReplicationOps ReplicationOps; typedef struct ReplicationState ReplicationState; =20 /** - * SECTION:replication.h + * SECTION:block/replication.h * @title:Base Replication System * @short_description: interfaces for handling replication * @@ -32,7 +32,7 @@ typedef struct ReplicationState ReplicationState; * * How to use replication interfaces * - * #include "replication.h" + * #include "block/replication.h" * * typedef struct BDRVReplicationState { * ReplicationState *rs; diff --git a/migration/colo.c b/migration/colo.c index de27662cab..e498fdb125 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -28,7 +28,7 @@ #include "migration/failover.h" #include "migration/ram.h" #ifdef CONFIG_REPLICATION -#include "replication.h" +#include "block/replication.h" #endif #include "net/colo-compare.h" #include "net/colo.h" diff --git a/replication.c b/replication.c index be3a42f9c9..4acd3f8004 100644 --- a/replication.c +++ b/replication.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "replication.h" +#include "block/replication.h" =20 static QLIST_HEAD(, ReplicationState) replication_states; =20 diff --git a/tests/unit/test-replication.c b/tests/unit/test-replication.c index b067240add..afff908d77 100644 --- a/tests/unit/test-replication.c +++ b/tests/unit/test-replication.c @@ -14,7 +14,7 @@ #include "qapi/qmp/qdict.h" #include "qemu/option.h" #include "qemu/main-loop.h" -#include "replication.h" +#include "block/replication.h" #include "block/block_int.h" #include "block/qdict.h" #include "sysemu/block-backend.h" --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500626; cv=none; d=zohomail.com; s=zohoarc; b=nH3FVjXqNVtVpopQDyCU7Moia0mTISoqvYIuISkTbS9aaHPuSdhcpmk/qvYnEiQYaWJBggAhtjk0dknkEJ901GCMytwETU2znf11/fsXITn9ZwwE5clf2uaWV1toUGJGoRBBCRSuNAhp9xbEIzC8TZYLeXSWt/yJCdaBVbomexc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500626; h=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=NURTTjYEkN5qlT+hGLhGVfDulriBn9GBwNW8du6ptW0=; b=ZiqNsn6T4pcyDS6oIkaO02kiRpRz3QWBa02iCJWt1NVZJYvh7bcheXCHgLAl4Vws1CvWZMSRQe0hELkcTTgb8O1yTLEgE93OpZ+Lre6yCgDMRZ1IlbAN9Ydfe2TMJyjQhwln2Vp0RotFM6cqZ2hj6lgBD+tg+E8250xPG5l1mGI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500626097776.9898113384526; Thu, 20 May 2021 01:50:26 -0700 (PDT) Received: from localhost ([::1]:54194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeNs-00007J-Uq for importer@patchew.org; Thu, 20 May 2021 04:50:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RS-OK; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:53206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxg-0001Zw-95; Thu, 20 May 2021 04:23:25 -0400 Received: by mail-wm1-x330.google.com with SMTP id z130so8617902wmg.2; Thu, 20 May 2021 01:23:15 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NURTTjYEkN5qlT+hGLhGVfDulriBn9GBwNW8du6ptW0=; b=URwszSumYIrvfAs60g4B2RtmFdJ2cBYbIGRs3Oe54uk9a2SaAr4nzRhj2aex4CJw32 gPlY190Htn42Apx+VA8/d6nP63OS4xsigXsSI7MHCgI2NkwIUfB31/kNtULO9SB/yUkZ 54kCj0FMQtY5AY6In6jNJ2R1JQdohM7NHKpQbbBsMQmzX0WY8n8YhNljN7cn5jp3xsqa PxRynBZKchM6tod2gRiwmn1TB9dJwRadPbMOffOUdwuT1SkA3KJ27fjWTT3QA+15ONng l1EvNu6ed52PCnKyQ8T2krHMLYKtnt4FHZG3ywZkbNInF0y3DdAJ6x+J5VontOPZSogg bwVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NURTTjYEkN5qlT+hGLhGVfDulriBn9GBwNW8du6ptW0=; b=H5SYiLI0LvBovGpzL2whWscUzBCs6pcpOhIznZXN/IakJETNZ+n44BjgCv1yBGcKUc eFm9Q8p9I/cXVFSlSnq6WU0caQou4WsDqFvOprtKzNxNpEoQgGtA6MI00LPOPgCkDqnn 9Kg0wf0ux82AwdE2qWKLjHirCqItvLw0rdqjDfpZvIbVlLzatsfXKht8CZq5iAW91c1A st9MsxI1VY25xVcadMSsX8I66jiTthioHpSV5JDz1R/LFplx4W9gG1J7nRmNqnTbMBmg yUBB0tOtRMPBzKw0MTGF1oLdUSr2f12TMlM+mcGN/lmz40rcyQtodJq7VhevvJPZDxav EzYA== X-Gm-Message-State: AOAM532s7oRUtZmh/gFGaGkgGDtDpsQ01lNKPEaSlqiMkPAOAzurPjLC tpKsTXhjF2mgKZ01vcLteraTsvQRSPBKWA== X-Google-Smtp-Source: ABdhPJxh+pH/8DNw5pcxS5s9K+bdA8646jjq1HXX4ZGBrIEc+bxhTMi55tr1dgIGOU4m0PggYYsUfw== X-Received: by 2002:a1c:b4c6:: with SMTP id d189mr2350993wmf.39.1621498994280; Thu, 20 May 2021 01:23:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 24/26] vl: allow not specifying size in -m when using -M memory-backend Date: Thu, 20 May 2021 10:22:55 +0200 Message-Id: <20210520082257.187061-25-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::330; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Starting in QEMU 6.0's commit f5c9fcb82d ("vl: separate qemu_create_machine", 2020-12-10), a function have_custom_ram_size() replaced the return value of set_memory_options(). The purpose of the return value was to record the presence of "-m size", and if it was not there, change the default RAM size to the size of the memory backend passed with "-M memory-backend". With that commit, however, have_custom_ram_size() is now queried only after set_memory_options has stored the fixed-up RAM size in QemuOpts for "future use". This was actually the only future use of the fixed-up RAM size, so remove that code and fix the bug. Cc: qemu-stable@nongnu.org Fixes: f5c9fcb82d ("vl: separate qemu_create_machine", 2020-12-10) Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index ac0ff6e160..21e55718a6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2039,8 +2039,6 @@ static void set_memory_options(MachineClass *mc) exit(EXIT_FAILURE); } =20 - /* store value for the future use */ - qemu_opt_set_number(opts, "size", ram_size, &error_abort); maxram_size =3D ram_size; =20 if (qemu_opt_get(opts, "maxmem")) { --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500329; cv=none; d=zohomail.com; s=zohoarc; b=SKgGd/22md9RPp+Z/Q8CYPU+Qp5ih/NFF/VZ4N7cJpVDjjlJL07Pkc16+/glCKGUYX9FI5ZTOKs6YLtdJnIf6wJkuT/MTcIn+ZI5eDTBQZ0rlwwuGM/D+6d1/Xtgdzu2TrNJnjN1bxJldYMMiEHiklihjUuxxTIZoZteO0OCltQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500329; h=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=TzYzur0aoGcQcPzxTRLpL0L9tdlIkO4njHPHcUkBeIQ=; b=LgTgFVaCcWQI5v/XEtl7EMeeWW3+z7S8wuLPv4smDH0YqYfcfTAZGlWjZzF7S1zlVFIwpxEMNH8blhHEkWzg0Ag8BCJzy8mGryzYikdYc7XpCjobgDtK1EMC0Od5nRO2PjuzQ8ZWxNExfZyVHDtjTKY1MDhVCFYDp2pV7HMikYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500329503383.69749792160314; Thu, 20 May 2021 01:45:29 -0700 (PDT) Received: from localhost ([::1]:40154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeJ6-0007Tw-Db for importer@patchew.org; Thu, 20 May 2021 04:45:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxm-0005RW-PB; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxf-0001aW-Ce; Thu, 20 May 2021 04:23:24 -0400 Received: by mail-wr1-x42c.google.com with SMTP id j14so14936013wrq.5; Thu, 20 May 2021 01:23:15 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TzYzur0aoGcQcPzxTRLpL0L9tdlIkO4njHPHcUkBeIQ=; b=TZuepqtSVyNOsHYJfSmxL8gSPUwQzx9YjmRu1386qnZjhudiWB7GhpEIH1qegAp7Mq CXWVWYgH5cTfeN2zckNHlbp0b2qB8XBQrZwjeRqHecsHt2UYyNvhxjR8ke3T+tqxN1HN 9Vo/YOv3smsMqG11qLzAcaG7F5gw4ONr2rGM3aRx0PXxdAb/AUosVt0tFgh3iJgEqun9 wskNA8c84wkPNLu3iBdLN/73dcrlOaZeXWSsrNMJFii4l5VL73njUfylWTDrB8cMqWkW 1Nqb6GHOpQUMqjCVXs8le+Z7DjMPoFDFWYVwLpVU2kb3jp5Uw9B7pLQIVmsxEqKlkv6s f8dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TzYzur0aoGcQcPzxTRLpL0L9tdlIkO4njHPHcUkBeIQ=; b=Hnu75gkjBWL5Pb55vBPIDO1IPz8bC+cyW6IHuHpl/umw44xbiJaUtXPj0JP1Lr+1CQ 28rXxA5FzPoZtCZFq/YJsYzPmx0cxL9HY1vudYopqY1MlaBMkzZlAfKWxe+mFuUL9+o0 LqM2JyKPRKMlKKtIjHlVoXq4T/EuxWl3WnMpEgA55sWXrYUiKtyUZdCZjKlFB1e28AbI Ey6aFVb8qJti0PvkqOE8VPMq6sZi8BCi+JkZ9tusNU8mAsIir7u91CG+o6f0RctQox0E ATpFCSDbVIKtZIa5qS54Dcmc5Rsbp5x4emrLDc/sUbLB0gdBDr1jzogT1YZnjjSK4TD9 VHxw== X-Gm-Message-State: AOAM530R7NdjZQYNRjM6EDBESyM1gaRyjnZzk0FIcDqTlSbjIXEALk1G /M1pEF19xZp0zVQ+1SHxG/Cmk1z2R+th0g== X-Google-Smtp-Source: ABdhPJymirXYMt9D3I3ovbxh51bUx2/IQrNQ4BY/+fhZyU39c2i010z/7AXFDPZeEJsHRfUJP56Lvw== X-Received: by 2002:a5d:4c49:: with SMTP id n9mr2877485wrt.417.1621498994869; Thu, 20 May 2021 01:23:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 25/26] qemu-config: load modules when instantiating option groups Date: Thu, 20 May 2021 10:22:56 +0200 Message-Id: <20210520082257.187061-26-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::42c; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Right now the SPICE module is special cased to be loaded when processing of the -spice command line option. However, the spice option group can also be brought in via -readconfig, in which case the module is not loaded. Add a generic hook to load modules that provide a QemuOpts group, and use it for the "spice" and "iscsi" groups. Fixes: #194 Fixes: https://bugs.launchpad.net/qemu/+bug/1910696 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- include/qemu/config-file.h | 2 +- softmmu/vl.c | 21 +++++++++++++++++---- stubs/meson.build | 1 + stubs/module-opts.c | 6 ++++++ util/qemu-config.c | 1 + 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 stubs/module-opts.c diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 8d3e53ae4d..0500b3668d 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -1,7 +1,7 @@ #ifndef QEMU_CONFIG_FILE_H #define QEMU_CONFIG_FILE_H =20 - +void qemu_load_module_for_opts(const char *group); QemuOptsList *qemu_find_opts(const char *group); QemuOptsList *qemu_find_opts_err(const char *group, Error **errp); QemuOpts *qemu_find_opts_singleton(const char *group); diff --git a/softmmu/vl.c b/softmmu/vl.c index 21e55718a6..6054f6f0b9 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2627,6 +2627,23 @@ void qmp_x_exit_preconfig(Error **errp) } } =20 +#ifdef CONFIG_MODULES +void qemu_load_module_for_opts(const char *group) +{ + static bool spice_tried; + if (g_str_equal(group, "spice") && !spice_tried) { + ui_module_load_one("spice-core"); + spice_tried =3D true; + } + + static bool iscsi_tried; + if (g_str_equal(group, "iscsi") && !iscsi_tried) { + block_module_load_one("iscsi"); + iscsi_tried =3D true; + } +} +#endif + void qemu_init(int argc, char **argv, char **envp) { QemuOpts *opts; @@ -3386,10 +3403,6 @@ void qemu_init(int argc, char **argv, char **envp) break; case QEMU_OPTION_spice: olist =3D qemu_find_opts_err("spice", NULL); - if (!olist) { - ui_module_load_one("spice-core"); - olist =3D qemu_find_opts("spice"); - } if (!olist) { error_report("spice support is disabled"); exit(1); diff --git a/stubs/meson.build b/stubs/meson.build index 3faef16892..f3f979c3fe 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -22,6 +22,7 @@ stub_ss.add(files('isa-bus.c')) stub_ss.add(files('is-daemonized.c')) stub_ss.add(when: 'CONFIG_LINUX_AIO', if_true: files('linux-aio.c')) stub_ss.add(files('migr-blocker.c')) +stub_ss.add(files('module-opts.c')) stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('pci-bus.c')) diff --git a/stubs/module-opts.c b/stubs/module-opts.c new file mode 100644 index 0000000000..a7d0e4ad6e --- /dev/null +++ b/stubs/module-opts.c @@ -0,0 +1,6 @@ +#include "qemu/osdep.h" +#include "qemu/config-file.h" + +void qemu_load_module_for_opts(const char *group) +{ +} diff --git a/util/qemu-config.c b/util/qemu-config.c index 670bd6ebca..34974c4b47 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -16,6 +16,7 @@ static QemuOptsList *find_list(QemuOptsList **lists, cons= t char *group, { int i; =20 + qemu_load_module_for_opts(group); for (i =3D 0; lists[i] !=3D NULL; i++) { if (strcmp(lists[i]->name, group) =3D=3D 0) break; --=20 2.31.1 From nobody Wed May 1 21:11:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621500031; cv=none; d=zohomail.com; s=zohoarc; b=jE8R4tEUWpuQQMQk1fv4E6mBa5RPDEVG3yb8HAg2Kq7WBUT9zTRunmE1auOXnyoU3LKdIJitYxhKRtoBKNsxxL99AzPO0UkXIoClJ4seo7mF/3k8iOnbwpERRqRmEAlJdL82wUwtyIyMVgoMzXVXAvjFg5yL0pR3av3077wshr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621500031; h=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=mfZamIf15Ke/BeRA5FMstz0DDkSoart1dVqPlrNSeDc=; b=WnlsB9xwusKw93LzNQp0xeZQdHE5q8n4LR14CgtdtJ2eYenCuYcbC96Wrb/bl5Vw55K4UxE9WZM8yljTrdhDhxoZt53aTtRkFGrJq1MpJUzZalpni7BiShgwGK7jOR98DhB7qT3pwKk2J0DL7ARletFbiABwnqV5UfmyZ5AZLX8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621500031698377.34154137175483; Thu, 20 May 2021 01:40:31 -0700 (PDT) Received: from localhost ([::1]:54256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljeEI-0006K8-Is for importer@patchew.org; Thu, 20 May 2021 04:40:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdxj-0005RI-98 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:29 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:39932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljdxe-0001bZ-W4 for qemu-devel@nongnu.org; Thu, 20 May 2021 04:23:22 -0400 Received: by mail-wr1-x435.google.com with SMTP id v12so16673106wrq.6 for ; Thu, 20 May 2021 01:23:16 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id v10sm2603506wrq.0.2021.05.20.01.23.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 01:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mfZamIf15Ke/BeRA5FMstz0DDkSoart1dVqPlrNSeDc=; b=I1RxqJIAGCZETtJiQ3/FCP+aDY4XqtU0xy6PW9CzitxLHzkV3HmMTVRJSQRLPTQIGR keL6aGjv+2IPQ0Q6IrDAdmsuweMcaeKNyReE3M84HQD6WssSwF1Estp+YqUyWKQ7+HxO sO/lhmalHGEK/osf+UNx8rV08+oSfNy1lSl2QvgNiyokqZ0lhluLqJE7CiV+vnTtVICC qtUIrI9cfn2PfmN+ccu1XSOUviDpjbvldqpl+CRgkUorC9DDt2pVpziSoBSx4JENcTtA JcJyWQdAVBcX1ppt5fUBWDX+yuY+V1Muzs1sKyhqMxPTFz5Mg2VTvN0BoKJMDK2aaUBa 10Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mfZamIf15Ke/BeRA5FMstz0DDkSoart1dVqPlrNSeDc=; b=MJHJa1YKP4JecaWTCvo9uvyqzeaf3g8bE3T3Q/NkGh6jowVHphnJP6b1nY7c4EXjVJ +E5In56HQxRksR7dcvd9syWFIToqpBeHLvO+X09g9/DLcnA5ed5z3Vn3b74RI8ptLK+b dNAZbtZ+nuvPdfqL53b1TlarUH4DopJ+yC7528MmfhQXjQdDxQZ7DMCZa6SVOA2PvHMS XuKcSSuzfpAr9mUa5QXM6DajQaTkCAEZmkwMeKy+HpmkLxNuyGVsWyy/z0F8vHNFGA+u jLSUgINYeOuwai9xMhqUPnvkUF2NoyzieXmQysdBY3KXZZvd2PWU6BArBkSrKYwzeiUm PPgg== X-Gm-Message-State: AOAM533NHUWFQEZs8EDuYcMGdXBMmBwO0E0E5BQEgM1Ai/K+h6zQLs/d ZKauFdCFsqqA0NTtRj06C5eO7DyL1v4NwQ== X-Google-Smtp-Source: ABdhPJyCdQRDXg2SyeudYiC9s8IxLwanuBspulh9+FnW9YDj6zADI0veQyqLhC1npaiPbLQjbhOKqw== X-Received: by 2002:adf:b64b:: with SMTP id i11mr2998959wre.157.1621498995569; Thu, 20 May 2021 01:23:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 26/26] scsi-generic: pass max_segments via max_iov field in BlockLimits Date: Thu, 20 May 2021 10:22:57 +0200 Message-Id: <20210520082257.187061-27-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com> References: <20210520082257.187061-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=2a00:1450:4864:20::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" I/O to a disk via read/write is not limited by the number of segments allow= ed by the host adapter; the kernel can split requests if needed, and the limit imposed by the host adapter can be very low (256k or so) to avoid that SG_IO returns EINVAL if memory is heavily fragmented. Since this value is only interesting for SG_IO-based I/O, do not include it in the max_transfer and only take it into account when patching the block limits VPD page in the scsi-generic device. Signed-off-by: Paolo Bonzini --- block/file-posix.c | 3 +-- hw/scsi/scsi-generic.c | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 10b71d9a13..59c889d5a7 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1228,8 +1228,7 @@ static void raw_refresh_limits(BlockDriverState *bs, = Error **errp) =20 ret =3D sg_get_max_segments(s->fd); if (ret > 0) { - bs->bl.max_transfer =3D MIN(bs->bl.max_transfer, - ret * qemu_real_host_page_size); + bs->bl.max_iov =3D ret; } } =20 diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 98c30c5d5c..82e1e2ee79 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -179,10 +179,12 @@ static void scsi_handle_inquiry_reply(SCSIGenericReq = *r, SCSIDevice *s) (r->req.cmd.buf[1] & 0x01)) { page =3D r->req.cmd.buf[2]; if (page =3D=3D 0xb0) { - uint32_t max_transfer =3D - blk_get_max_transfer(s->conf.blk) / s->blocksize; + uint32_t max_transfer =3D blk_get_max_transfer(s->conf.blk); + uint32_t max_iov =3D blk_get_max_iov(s->conf.blk); =20 assert(max_transfer); + max_transfer =3D MIN_NON_ZERO(max_transfer, max_iov * qemu_rea= l_host_page_size) + / s->blocksize; stl_be_p(&r->buf[8], max_transfer); /* Also take care of the opt xfer len. */ stl_be_p(&r->buf[12], --=20 2.31.1