From patchwork Fri May 15 14:43:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186844 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp501216ilb; Fri, 15 May 2020 07:46:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqa/K/lLQXGWHOsfrKXL3ur2Scu/lqD+KPoLVnStiUbgDYKa+m24s+fnLFB4JuEVuztxul X-Received: by 2002:ac8:2f3c:: with SMTP id j57mr1336100qta.296.1589554002658; Fri, 15 May 2020 07:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554002; cv=none; d=google.com; s=arc-20160816; b=rEGmklzOmQx23pmz3e7m1RZd/LDLOuTXqZ3xQjoNfu6368n0DieEoW3YUDfa/Kc66+ UHQK/KHbykua6YYr3VvlU+BZ/petwWpSqixIz+5gWXk0DD7iXQIg8VnBHGmaQsJLects lgLSUC3HxWsMH0M1ELfyfRWIFi72RJ7jH9Fsp/+JlxT0bDYSS4csdER8qn63YXlXfT3R CUhmhogCRfsCDI9GqLYQnfoTuWFe9zqlsYGUV8fYyVXOGAlXfHvhgR4arsnLil9Gg5r7 tbRrem3uZ2PRwFRjse6Qe1NLCA/AoEs8DWWXyk9EHDiRoFwauveswRNzIiUby41l/8Nz 8vTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5Peitioauv/zcrWgnE0w1JUSarAbB8IhuZ1XyceMYTE=; b=HxRk4QEPgCgHHoY9UeAwQw+p9nF/TVE3tGNrKi34QN7HzjzZQ4doR3UL0AXCCA7IIL QCem1NSIYdLITrb5EQkQ7+f2pUBelcwvWrC6KcItGY6fhcC1XNMBXRRYxz0k9UgMf5fL 2uLgjl+PvxCBMBka+hdJ6Fd7w1LzOs+RkqR1q9j3yALhfH7BwUSERmUn9c6Jdpp3RtQ6 3St4j4CpFCvN9l901vNZkf0XpJrrJ1NmSg9Q5jTc1fz0UGGto/V4bzQiQNbhybYPPLuR bglftexN8zHesLB/te+4Dvgs1arayvHK1W35pjrKg42ovCVy/mbntZs+RKXJWkLulo15 t3Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WrcHqTpG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j17si1322532qke.112.2020.05.15.07.46.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:46:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WrcHqTpG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbbm-0005wI-4t for patch@linaro.org; Fri, 15 May 2020 10:46:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZL-000293-Or for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:11 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:40621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZK-0000xB-W5 for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:11 -0400 Received: by mail-wm1-x330.google.com with SMTP id u16so2943291wmc.5 for ; Fri, 15 May 2020 07:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Peitioauv/zcrWgnE0w1JUSarAbB8IhuZ1XyceMYTE=; b=WrcHqTpGSRiqh/XWWT8QL6Mub5sTUpWwXslO0JMNezCW2cGCgT7z+/g6oB9IX17MA/ xzRiYoIHqknObckm7cKgcywcQEZf22FCN34WvPKi4UMzQlwUC4QRhAXV5EqLATh2WQAv Qekc3QzMoEzLaVi+wtZMSz9AlYhrwyl1Ulq2wDV+9ieCGFT8j5KQ72dNbj2nVvesPqZb zU4/PV6GQP8tlY+KJWUKHT6dGkfnO/8zmh9+4pXtECva9mQjagsucrwa32n9EnYQMy/C pxm51nJE1D8Ag9H5h3Wc2kz0PQXOO08XEV1oOuH/vTnxo9aD3EkcDCqcF2yDu8E+QWrz 25LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Peitioauv/zcrWgnE0w1JUSarAbB8IhuZ1XyceMYTE=; b=NGEZiIv+Llpwoel1NT82rj1kXqrVipNZv0QmhIQzlvOB54Nj47GnrTmkxJYOPnlZtj N5QyVqOkj/TE5JXYsztRvnpfhQctE/j38vevjZJmSkNarlb/6asS5UWwKOgqD/JimWDi Dpmh52TAcdGS8nYh7mlKGLH93uJ7BJ1dNC3X1/+jq7TkUJDE8g0x8ylbl2sgCR8yMk+0 feCMw3M4iMzYChna76fWpWEpmEQJELtK9oX9mHmJTENdnTKSchxNB/tpKtehERdmmcIL zfBDZy9HEINyzL6T/XSk8CVoHFyto4RzuL4mggb6aJZynIzdGlaBZhssuHTROLnJwbeM 5KYw== X-Gm-Message-State: AOAM532qN3vEcvzM58k4suNecF3vY3pPp+xkFwRNWo3Iwwy+UmzOE5ew ZTulOlyxin+3sypfZbL+iFpCMA== X-Received: by 2002:a1c:b104:: with SMTP id a4mr4287554wmf.24.1589553849644; Fri, 15 May 2020 07:44:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s8sm3503903wrt.69.2020.05.15.07.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:06 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 380431FF87; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 01/13] tests/guest-debug: catch hanging guests Date: Fri, 15 May 2020 15:43:53 +0100 Message-Id: <20200515144405.20580-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" If gdb never actually connected with the guest we need to catch that and clean-up after ourselves. Signed-off-by: Alex Bennée Message-Id: <20200513175134.19619-2-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index d9af9573b9e..71c55690546 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -80,4 +80,10 @@ if __name__ == '__main__': print("GDB crashed? SKIPPING") exit(0) + try: + inferior.wait(2) + except subprocess.TimeoutExpired: + print("GDB never connected? Killed guest") + inferior.kill() + exit(result) From patchwork Fri May 15 14:43:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186842 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp499931ilb; Fri, 15 May 2020 07:44:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKSwvTLV1ZCoM1W2+q5AUJEZ5w7touwrwVKin7GcTGRrSQd9cOS2wjZex6JbDfU2965xSm X-Received: by 2002:a37:acc:: with SMTP id 195mr3634120qkk.419.1589553896356; Fri, 15 May 2020 07:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589553896; cv=none; d=google.com; s=arc-20160816; b=eoHNWSspbSg2mSQIEheWnFmdd2JsRV3tlTdCfK3eB4tDpT/DXiwrICliTpLgl0s+z3 1xtuoRUPBgmoJ2d5nVWsjFwZqbFKkCU9f+ZFpLbtHuqg4j5BFEpy0x/MlM4RJeDaJl2c nNULJJxM+aHi6aVzC/u91c/+GVOxuhcP6IC0lJabWsiU5ZFv7q78yGvr2PBWrmeHsk9r iJMjyplAN1vWnwn3V/wjrooHtHhXdMLkmHr+tNqw2v4BJQ+fijDI5mp91dc4q6TB/Z4W I/s9TG/x4nlN0Rchl56NCdhE+lr/LNCOBZsGG7nhfpYH1lS/MCZr3Qhw6H8ZbtiJEeem +zHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Bl/vg2rzNh/pMMBH42avZ0Yv7ojwGHbKqNqvCGN0etE=; b=I4R14uNT8PHvlHOvnsQyJpkCPz3jm/pCmMI758AuwxDlwE0Flecoeywb8X+GPMG2gK bMpjyo7wFc0zdYBEeOkyvxjEG0z2hlXrrpKpHPhTVjJtKF5qv5JfrDiQd6GvsLUct+R3 pyOwljbxvAUWwqdbZ0c29cyKpr+Z8GG/UWGUN/tTCHAFJiCTBhghoBBA8sQBlzYkboMs mmSfhAgRj12qMJP+EpF4YSoPPPycqjjKiu0IxoLHCyGUmEp6zR/UsuheOMB8FWToskOs v3NNsuENzq14el+yGU8R+RQ+NfSHP2nw6tGAJ3FW06xKvHTyIVACSXMHa0mVrEQWpKT9 91ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ePzg996w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g14si1356044qtp.107.2020.05.15.07.44.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:44:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ePzg996w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZba3-0002As-S9 for patch@linaro.org; Fri, 15 May 2020 10:44:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZL-00028D-AL for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:11 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:36937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZJ-0000vp-8U for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:10 -0400 Received: by mail-wm1-x32b.google.com with SMTP id z72so2962816wmc.2 for ; Fri, 15 May 2020 07:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bl/vg2rzNh/pMMBH42avZ0Yv7ojwGHbKqNqvCGN0etE=; b=ePzg996wyYWDcCJ6dZtrv5aNYPdeTB3BfmYcyhcSpPxVw4Xjh0yL1TNiXdSX3PKJpy UEH984JfDy24sw8nKTVxEZZfIWopZTbo6F5CHsqujW5reXxV3DotsE3xqIdOMwwgGGIC rv9DausuJcmw4htwsV1067ahJLhuCVH/ar5oAHSZzL+3+S/tOfN9frd3X6tfUprvBuCu XxNdyayxYTlyOs6yYd8inf/W9QVVjPDicpFlH8AvMv1alXn+YP6xP4UtHGU6HQlHG+5v qb/2VxXT1kBoI/XfbbjVNqZkAXFRECg3SVSK8btDcgCztw95Y+F+pdfdm9fu3H6NFDrL S2kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bl/vg2rzNh/pMMBH42avZ0Yv7ojwGHbKqNqvCGN0etE=; b=CMmO1tNjiXqvSiTZ0diSoSCVcF5XkXGnR8o18gMO1U+z63Mta48obxO1a8SPXAWV2o +9UGjJxKZQsHQq/WcYFFOsN9GNgNPi60RfIwxBqvmCaJfkoo+Rmh6qEAibpSR7U9YaGo /fWM+sowCiNT3Su0o++j7G7MVILxdGauKsXkTrTsdJAy8BtypfemxboHlfwxZH1Autcr q+aV08CA8UBWWydPFIvxBYV2YtBDnQym4PDYE24jrEq66FovUgIa2ilt38aJi01ADTlo MvKpiwdqtscB6LGTLv1vNZWmxrGt+3pElMHMPU4VmTPXOMqmzpNFBkeZiQM/ybJVEuwc CrVw== X-Gm-Message-State: AOAM533ZJwQOFoJZgirJ6m0yLIVYGBoNaEK0wrc/nCJduXTu80Qg33iu LxshAqVQIgvnvWjtFunPmXNttg== X-Received: by 2002:a1c:545b:: with SMTP id p27mr4222422wmi.81.1589553847593; Fri, 15 May 2020 07:44:07 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c143sm1896286wmd.43.2020.05.15.07.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:06 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4C54B1FF8C; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 02/13] travis.yml: Improve the --disable-tcg test on s390x Date: Fri, 15 May 2020 15:43:54 +0100 Message-Id: <20200515144405.20580-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cornelia Huck , qemu-devel@nongnu.org, "open list:S390 general arch..." , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Since the s390x containers do not allow KVM, we only compile-test the --disable-tcg build on s390x and do not run the qtests. Thus, it does not make sense to install genisoimage here, and it also does not make sense to build the s390-ccw.img here again - it is simply not used without the qtests. On the other hand, if we do not build the s390-ccw.img anymore, we can also compile with Clang - so let's use that compiler here to get some additional test coverage. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Signed-off-by: Alex Bennée Message-Id: <20200512133849.10624-1-thuth@redhat.com> Message-Id: <20200513175134.19619-3-alex.bennee@linaro.org> -- 2.20.1 diff --git a/.travis.yml b/.travis.yml index fe708792ca2..1ec8a7b4657 100644 --- a/.travis.yml +++ b/.travis.yml @@ -502,9 +502,10 @@ jobs: $(exit $BUILD_RC); fi - - name: "[s390x] GCC check (KVM)" + - name: "[s390x] Clang (disable-tcg)" arch: s390x dist: bionic + compiler: clang addons: apt_packages: - libaio-dev @@ -528,21 +529,10 @@ jobs: - libusb-1.0-0-dev - libvdeplug-dev - libvte-2.91-dev - # Tests dependencies - - genisoimage env: - TEST_CMD="make check-unit" - - CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools" - script: - - ( cd ${SRC_DIR} ; git submodule update --init roms/SLOF ) - - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$? - - | - if [ "$BUILD_RC" -eq 0 ] ; then - mv pc-bios/s390-ccw/*.img pc-bios/ ; - ${TEST_CMD} ; - else - $(exit $BUILD_RC); - fi + - CONFIG="--disable-containers --disable-tcg --enable-kvm + --disable-tools --host-cc=clang --cxx=clang++" # Release builds # The make-release script expect a QEMU version, so our tag must start with a 'v'. From patchwork Fri May 15 14:43:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186848 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp503020ilb; Fri, 15 May 2020 07:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyJTW3mVmOp1Se06K2rjH/JAcCM+LYq4secazj8OCAFYlO3YTKQ/oikmcLZVZS7f0ZQ8SX X-Received: by 2002:a37:4397:: with SMTP id q145mr3398411qka.117.1589554149540; Fri, 15 May 2020 07:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554149; cv=none; d=google.com; s=arc-20160816; b=0mj+wPBr1JoMyA2FxAhCN23f136XfuCcSJIbmqvd91iRS/4LFYfnHFbq1Mo/q0JVFV yUpzENaw4U95XilO+PZrQMCrugmtCnGE3a5IHBshEXi/XMlE5x5e3v7JWvzX9qXCTQ5I sZ7SbhzXfG60sdc8NSoRm+/1GQqyeolX3s+6PIe27HccQQnLfRs7WLeqQG9SLJDHhoRQ fkKDgQfqntQS3nakSTzNPJ40W5wi9/sOLOjKWyyCvwJCA3G5nZJGDTXE2vpsamXNg//K ql49eHbKB36gJj1lEIcHOhSvB97POqqDq9cYMPS/aiONSyTMef/+Cq9os043vyb6hJkM DirQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PEFfCso5QDCYapt0Rnis0UBdoZzLm9SPIz2S8ggcys4=; b=FM/6+wNfcyskSe6UOc06Ib+exPI1MhEg5RJ9VLlxKqxzaAYq2I+D19F2emJ/RF/4tE pea1seEjo/rYm6yPzcGRhXPAxRd2W5EFwN76hYHvmD2qZLNUQBWK1rmUV+mWRrvZ5zP6 cg2/PczgUpB6yxr1R0CLK51nWcTZmzftY7/6fWuMXwqPk9ZsiWwTw2JHaCvKCZywUDS7 UMwHUmXr6napZPmBxQamNImMovTZzRo0hN24zhiRsZ6PIeR5bvq1C70NPen3BX+OW6Rr 2dgTRLpyh3O5bb9CUn2KKRIlKeK0+aNJzVp07q93OziC9Vz39VXXREERpbn/Yjc1YTrY pUww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hxMpAujj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p10si1212295qkm.267.2020.05.15.07.49.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hxMpAujj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbe8-0000QM-F6 for patch@linaro.org; Fri, 15 May 2020 10:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZR-0002NJ-HZ for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:17 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:42402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZO-0000yU-9Q for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:17 -0400 Received: by mail-wr1-x42b.google.com with SMTP id s8so3828674wrt.9 for ; Fri, 15 May 2020 07:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PEFfCso5QDCYapt0Rnis0UBdoZzLm9SPIz2S8ggcys4=; b=hxMpAujj5PP4ThPz+CbbRknKzmOHjswTeB4+CcJYoLTESjbtN0cKmpxS+aj1uokSc7 Tm1CnWPE0t9vOwM48yFGGkF0O6TdiUa0F5jKRWg5KqgBfg+02wvNTG9FmsSWWOJY26sh P5VXu8TSv4fzdsqvPATsYWbC80wnZLlpgRvZT1dqrDeC2EGJJfa4ee9lk68Te6Qi6tsB D0q8KaegeVoNMOuX9R4CgOkqILig4i4YH+hg0krYV4HZim46wdRLTebrZp2q1zfk03Ss DZoEP0N/swZBvL9hioUwXzfkbMI6eM+ft53wHbBMtO7rG0ShtElXVtJycOVBOkpGm5ms gZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PEFfCso5QDCYapt0Rnis0UBdoZzLm9SPIz2S8ggcys4=; b=mU+0kpsPQX2flMzYwsyClzYcMpI0Ha/gf02lr6SkmexQMHQJAQZroQoChj9JDKHlOD SsXeBO7ZDB4CXBG/C187fI9cw53E+HOHtnBSpmaaoMsXC5vcHlMjEWZyeJ+zpWG30GPQ Kj16ZpXi+0UJRpq6fk2z4kWSdv8ocH6DdRL2nDGYkawUWu3Nqh9Yfg8xi6ZQvSqUUHIL EdzK2atoU4DUstEL2abrpH6/8A+brgN5HJgPtWGS+GgRvNkwC/xqHzaQA40lQ27rQHwi CPjnlwEBVlgMFLICwXVApVom1QeaOrfGEjfZ9kLTLhVFt9AtZV+0LhnHdUG9Dg9x+tjI sHCQ== X-Gm-Message-State: AOAM530V/2ou2FOgzjc7Uvq7ojjHrr9Rsfg5EK+4gPnd7SSQz70eOC7p xEWsuYBhbVbzQ4MxFsjivlWGrquGlyY= X-Received: by 2002:a5d:6448:: with SMTP id d8mr4928501wrw.118.1589553852111; Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t22sm3803389wmj.37.2020.05.15.07.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:06 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 690871FF8F; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 03/13] linux-user: completely re-write init_guest_space Date: Fri, 15 May 2020 15:43:55 +0100 Message-Id: <20200515144405.20580-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" First we ensure all guest space initialisation logic comes through probe_guest_base once we understand the nature of the binary we are loading. The convoluted init_guest_space routine is removed and replaced with a number of pgb_* helpers which are called depending on what requirements we have when loading the binary. We first try to do what is requested by the host. Failing that we try and satisfy the guest requested base address. If all those options fail we fall back to finding a space in the memory map using our recently written read_self_maps() helper. There are some additional complications we try and take into account when looking for holes in the address space. We try not to go directly after the system brk() space so there is space for a little growth. We also don't want to have to use negative offsets which would result in slightly less efficient code on x86 when it's unable to use the segment offset register. Less mind-binding gotos and hopefully clearer logic throughout. Signed-off-by: Alex Bennée Acked-by: Laurent Vivier Message-Id: <20200513175134.19619-5-alex.bennee@linaro.org> -- 2.20.1 diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 792c74290f8..ce902f5132a 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -219,18 +219,27 @@ void init_qemu_uname_release(void); void fork_start(void); void fork_end(int child); -/* Creates the initial guest address space in the host memory space using - * the given host start address hint and size. The guest_start parameter - * specifies the start address of the guest space. guest_base will be the - * difference between the host start address computed by this function and - * guest_start. If fixed is specified, then the mapped address space must - * start at host_start. The real start address of the mapped memory space is - * returned or -1 if there was an error. +/** + * probe_guest_base: + * @image_name: the executable being loaded + * @loaddr: the lowest fixed address in the executable + * @hiaddr: the highest fixed address in the executable + * + * Creates the initial guest address space in the host memory space. + * + * If @loaddr == 0, then no address in the executable is fixed, + * i.e. it is fully relocatable. In that case @hiaddr is the size + * of the executable. + * + * This function will not return if a valid value for guest_base + * cannot be chosen. On return, the executable loader can expect + * + * target_mmap(loaddr, hiaddr - loaddr, ...) + * + * to succeed. */ -unsigned long init_guest_space(unsigned long host_start, - unsigned long host_size, - unsigned long guest_start, - bool fixed); +void probe_guest_base(const char *image_name, + abi_ulong loaddr, abi_ulong hiaddr); #include "qemu/log.h" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 619c054cc48..01a9323a637 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -11,6 +11,7 @@ #include "qemu/queue.h" #include "qemu/guest-random.h" #include "qemu/units.h" +#include "qemu/selfmap.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO @@ -382,68 +383,30 @@ enum { /* The commpage only exists for 32 bit kernels */ -/* Return 1 if the proposed guest space is suitable for the guest. - * Return 0 if the proposed guest space isn't suitable, but another - * address space should be tried. - * Return -1 if there is no way the proposed guest space can be - * valid regardless of the base. - * The guest code may leave a page mapped and populate it if the - * address is suitable. - */ -static int init_guest_commpage(unsigned long guest_base, - unsigned long guest_size) -{ - unsigned long real_start, test_page_addr; - - /* We need to check that we can force a fault on access to the - * commpage at 0xffff0fxx - */ - test_page_addr = guest_base + (0xffff0f00 & qemu_host_page_mask); - - /* If the commpage lies within the already allocated guest space, - * then there is no way we can allocate it. - * - * You may be thinking that that this check is redundant because - * we already validated the guest size against MAX_RESERVED_VA; - * but if qemu_host_page_mask is unusually large, then - * test_page_addr may be lower. - */ - if (test_page_addr >= guest_base - && test_page_addr < (guest_base + guest_size)) { - return -1; - } +#define ARM_COMMPAGE (intptr_t)0xffff0f00u - /* Note it needs to be writeable to let us initialise it */ - real_start = (unsigned long) - mmap((void *)test_page_addr, qemu_host_page_size, - PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +static bool init_guest_commpage(void) +{ + void *want = g2h(ARM_COMMPAGE & -qemu_host_page_size); + void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - /* If we can't map it then try another address */ - if (real_start == -1ul) { - return 0; + if (addr == MAP_FAILED) { + perror("Allocating guest commpage"); + exit(EXIT_FAILURE); } - - if (real_start != test_page_addr) { - /* OS didn't put the page where we asked - unmap and reject */ - munmap((void *)real_start, qemu_host_page_size); - return 0; + if (addr != want) { + return false; } - /* Leave the page mapped - * Populate it (mmap should have left it all 0'd) - */ - - /* Kernel helper versions */ - __put_user(5, (uint32_t *)g2h(0xffff0ffcul)); + /* Set kernel helper versions; rest of page is 0. */ + __put_user(5, (uint32_t *)g2h(0xffff0ffcu)); - /* Now it's populated make it RO */ - if (mprotect((void *)test_page_addr, qemu_host_page_size, PROT_READ)) { + if (mprotect(addr, qemu_host_page_size, PROT_READ)) { perror("Protecting guest commpage"); - exit(-1); + exit(EXIT_FAILURE); } - - return 1; /* All good */ + return true; } #define ELF_HWCAP get_elf_hwcap() @@ -2075,239 +2038,267 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, return sp; } -unsigned long init_guest_space(unsigned long host_start, - unsigned long host_size, - unsigned long guest_start, - bool fixed) -{ - /* In order to use host shmat, we must be able to honor SHMLBA. */ - unsigned long align = MAX(SHMLBA, qemu_host_page_size); - unsigned long current_start, aligned_start; - int flags; - - assert(host_start || host_size); - - /* If just a starting address is given, then just verify that - * address. */ - if (host_start && !host_size) { -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - if (init_guest_commpage(host_start, host_size) != 1) { - return (unsigned long)-1; - } +#ifndef ARM_COMMPAGE +#define ARM_COMMPAGE 0 +#define init_guest_commpage() true #endif - return host_start; - } - /* Setup the initial flags and start address. */ - current_start = host_start & -align; - flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; - if (fixed) { - flags |= MAP_FIXED; - } +static void pgb_fail_in_use(const char *image_name) +{ + error_report("%s: requires virtual address space that is in use " + "(omit the -B option or choose a different value)", + image_name); + exit(EXIT_FAILURE); +} - /* Otherwise, a non-zero size region of memory needs to be mapped - * and validated. */ +static void pgb_have_guest_base(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr, long align) +{ + const int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; + void *addr, *test; -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - /* On 32-bit ARM, we need to map not just the usable memory, but - * also the commpage. Try to find a suitable place by allocating - * a big chunk for all of it. If host_start, then the naive - * strategy probably does good enough. - */ - if (!host_start) { - unsigned long guest_full_size, host_full_size, real_start; - - guest_full_size = - (0xffff0f00 & qemu_host_page_mask) + qemu_host_page_size; - host_full_size = guest_full_size - guest_start; - real_start = (unsigned long) - mmap(NULL, host_full_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - if (host_size < host_full_size - qemu_host_page_size) { - /* We failed to map a continous segment, but we're - * allowed to have a gap between the usable memory and - * the commpage where other things can be mapped. - * This sparseness gives us more flexibility to find - * an address range. - */ - goto naive; - } - return (unsigned long)-1; + if (!QEMU_IS_ALIGNED(guest_base, align)) { + fprintf(stderr, "Requested guest base 0x%lx does not satisfy " + "host minimum alignment (0x%lx)\n", + guest_base, align); + exit(EXIT_FAILURE); + } + + /* Sanity check the guest binary. */ + if (reserved_va) { + if (guest_hiaddr > reserved_va) { + error_report("%s: requires more than reserved virtual " + "address space (0x%" PRIx64 " > 0x%lx)", + image_name, (uint64_t)guest_hiaddr, reserved_va); + exit(EXIT_FAILURE); } - munmap((void *)real_start, host_full_size); - if (real_start & (align - 1)) { - /* The same thing again, but with extra - * so that we can shift around alignment. - */ - unsigned long real_size = host_full_size + qemu_host_page_size; - real_start = (unsigned long) - mmap(NULL, real_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - if (host_size < host_full_size - qemu_host_page_size) { - goto naive; - } - return (unsigned long)-1; - } - munmap((void *)real_start, real_size); - real_start = ROUND_UP(real_start, align); + } else { + if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) { + error_report("%s: requires more virtual address space " + "than the host can provide (0x%" PRIx64 ")", + image_name, (uint64_t)guest_hiaddr - guest_base); + exit(EXIT_FAILURE); } - current_start = real_start; } - naive: -#endif - while (1) { - unsigned long real_start, real_size, aligned_size; - aligned_size = real_size = host_size; + /* + * Expand the allocation to the entire reserved_va. + * Exclude the mmap_min_addr hole. + */ + if (reserved_va) { + guest_loaddr = (guest_base >= mmap_min_addr ? 0 + : mmap_min_addr - guest_base); + guest_hiaddr = reserved_va; + } - /* Do not use mmap_find_vma here because that is limited to the - * guest address space. We are going to make the - * guest address space fit whatever we're given. - */ - real_start = (unsigned long) - mmap((void *)current_start, host_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - return (unsigned long)-1; - } + /* Reserve the address space for the binary, or reserved_va. */ + test = g2h(guest_loaddr); + addr = mmap(test, guest_hiaddr - guest_loaddr, PROT_NONE, flags, -1, 0); + if (test != addr) { + pgb_fail_in_use(image_name); + } +} - /* Check to see if the address is valid. */ - if (host_start && real_start != current_start) { - qemu_log_mask(CPU_LOG_PAGE, "invalid %lx && %lx != %lx\n", - host_start, real_start, current_start); - goto try_again; +/* Return value for guest_base, or -1 if no hole found. */ +static uintptr_t pgb_find_hole(uintptr_t guest_loaddr, uintptr_t guest_size, + long align) +{ + GSList *maps, *iter; + uintptr_t this_start, this_end, next_start, brk; + intptr_t ret = -1; + + assert(QEMU_IS_ALIGNED(guest_loaddr, align)); + + maps = read_self_maps(); + + /* Read brk after we've read the maps, which will malloc. */ + brk = (uintptr_t)sbrk(0); + + /* The first hole is before the first map entry. */ + this_start = mmap_min_addr; + + for (iter = maps; iter; + this_start = next_start, iter = g_slist_next(iter)) { + uintptr_t align_start, hole_size; + + this_end = ((MapInfo *)iter->data)->start; + next_start = ((MapInfo *)iter->data)->end; + align_start = ROUND_UP(this_start, align); + + /* Skip holes that are too small. */ + if (align_start >= this_end) { + continue; + } + hole_size = this_end - align_start; + if (hole_size < guest_size) { + continue; } - /* Ensure the address is properly aligned. */ - if (real_start & (align - 1)) { - /* Ideally, we adjust like - * - * pages: [ ][ ][ ][ ][ ] - * old: [ real ] - * [ aligned ] - * new: [ real ] - * [ aligned ] - * - * But if there is something else mapped right after it, - * then obviously it won't have room to grow, and the - * kernel will put the new larger real someplace else with - * unknown alignment (if we made it to here, then - * fixed=false). Which is why we grow real by a full page - * size, instead of by part of one; so that even if we get - * moved, we can still guarantee alignment. But this does - * mean that there is a padding of < 1 page both before - * and after the aligned range; the "after" could could - * cause problems for ARM emulation where it could butt in - * to where we need to put the commpage. - */ - munmap((void *)real_start, host_size); - real_size = aligned_size + align; - real_start = (unsigned long) - mmap((void *)real_start, real_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - return (unsigned long)-1; + /* If this hole contains brk, give ourselves some room to grow. */ + if (this_start <= brk && brk < this_end) { + hole_size -= guest_size; + if (sizeof(uintptr_t) == 8 && hole_size >= 1 * GiB) { + align_start += 1 * GiB; + } else if (hole_size >= 16 * MiB) { + align_start += 16 * MiB; + } else { + align_start = (this_end - guest_size) & -align; + if (align_start < this_start) { + continue; + } } - aligned_start = ROUND_UP(real_start, align); - } else { - aligned_start = real_start; } -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - /* On 32-bit ARM, we need to also be able to map the commpage. */ - int valid = init_guest_commpage(aligned_start - guest_start, - aligned_size + guest_start); - if (valid == -1) { - munmap((void *)real_start, real_size); - return (unsigned long)-1; - } else if (valid == 0) { - goto try_again; + /* Record the lowest successful match. */ + if (ret < 0) { + ret = align_start - guest_loaddr; } -#endif - - /* If nothing has said `return -1` or `goto try_again` yet, - * then the address we have is good. - */ - break; - - try_again: - /* That address didn't work. Unmap and try a different one. - * The address the host picked because is typically right at - * the top of the host address space and leaves the guest with - * no usable address space. Resort to a linear search. We - * already compensated for mmap_min_addr, so this should not - * happen often. Probably means we got unlucky and host - * address space randomization put a shared library somewhere - * inconvenient. - * - * This is probably a good strategy if host_start, but is - * probably a bad strategy if not, which means we got here - * because of trouble with ARM commpage setup. - */ - if (munmap((void *)real_start, real_size) != 0) { - error_report("%s: failed to unmap %lx:%lx (%s)", __func__, - real_start, real_size, strerror(errno)); - abort(); + /* If this hole contains the identity map, select it. */ + if (align_start <= guest_loaddr && + guest_loaddr + guest_size <= this_end) { + ret = 0; } - current_start += align; - if (host_start == current_start) { - /* Theoretically possible if host doesn't have any suitably - * aligned areas. Normally the first mmap will fail. - */ - return (unsigned long)-1; + /* If this hole ends above the identity map, stop looking. */ + if (this_end >= guest_loaddr) { + break; } } + free_self_maps(maps); - qemu_log_mask(CPU_LOG_PAGE, "Reserved 0x%lx bytes of guest address space\n", host_size); - - return aligned_start; + return ret; } -static void probe_guest_base(const char *image_name, - abi_ulong loaddr, abi_ulong hiaddr) +static void pgb_static(const char *image_name, abi_ulong orig_loaddr, + abi_ulong orig_hiaddr, long align) { - /* Probe for a suitable guest base address, if the user has not set - * it explicitly, and set guest_base appropriately. - * In case of error we will print a suitable message and exit. - */ - const char *errmsg; - if (!have_guest_base && !reserved_va) { - unsigned long host_start, real_start, host_size; + uintptr_t loaddr = orig_loaddr; + uintptr_t hiaddr = orig_hiaddr; + uintptr_t addr; - /* Round addresses to page boundaries. */ - loaddr &= qemu_host_page_mask; - hiaddr = HOST_PAGE_ALIGN(hiaddr); + if (hiaddr != orig_hiaddr) { + error_report("%s: requires virtual address space that the " + "host cannot provide (0x%" PRIx64 ")", + image_name, (uint64_t)orig_hiaddr); + exit(EXIT_FAILURE); + } - if (loaddr < mmap_min_addr) { - host_start = HOST_PAGE_ALIGN(mmap_min_addr); + loaddr &= -align; + if (ARM_COMMPAGE) { + /* + * Extend the allocation to include the commpage. + * For a 64-bit host, this is just 4GiB; for a 32-bit host, + * the address arithmetic will wrap around, but the difference + * will produce the correct allocation size. + */ + if (sizeof(uintptr_t) == 8 || loaddr >= 0x80000000u) { + hiaddr = (uintptr_t)4 << 30; } else { - host_start = loaddr; - if (host_start != loaddr) { - errmsg = "Address overflow loading ELF binary"; - goto exit_errmsg; - } + loaddr = ARM_COMMPAGE & -align; } - host_size = hiaddr - loaddr; + } - /* Setup the initial guest memory space with ranges gleaned from - * the ELF image that is being loaded. + addr = pgb_find_hole(loaddr, hiaddr - loaddr, align); + if (addr == -1) { + /* + * If ARM_COMMPAGE, there *might* be a non-consecutive allocation + * that can satisfy both. But as the normal arm32 link base address + * is ~32k, and we extend down to include the commpage, making the + * overhead only ~96k, this is unlikely. */ - real_start = init_guest_space(host_start, host_size, loaddr, false); - if (real_start == (unsigned long)-1) { - errmsg = "Unable to find space for application"; - goto exit_errmsg; - } - guest_base = real_start - loaddr; + error_report("%s: Unable to allocate %#zx bytes of " + "virtual address space", image_name, + (size_t)(hiaddr - loaddr)); + exit(EXIT_FAILURE); + } + + guest_base = addr; +} + +static void pgb_dynamic(const char *image_name, long align) +{ + /* + * The executable is dynamic and does not require a fixed address. + * All we need is a commpage that satisfies align. + * If we do not need a commpage, leave guest_base == 0. + */ + if (ARM_COMMPAGE) { + uintptr_t addr, commpage; - qemu_log_mask(CPU_LOG_PAGE, "Relocating guest address space from 0x" - TARGET_ABI_FMT_lx " to 0x%lx\n", - loaddr, real_start); + /* 64-bit hosts should have used reserved_va. */ + assert(sizeof(uintptr_t) == 4); + + /* + * By putting the commpage at the first hole, that puts guest_base + * just above that, and maximises the positive guest addresses. + */ + commpage = ARM_COMMPAGE & -align; + addr = pgb_find_hole(commpage, -commpage, align); + assert(addr != -1); + guest_base = addr; } - return; +} -exit_errmsg: - fprintf(stderr, "%s: %s\n", image_name, errmsg); - exit(-1); +static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr, long align) +{ + const int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; + void *addr, *test; + + if (guest_hiaddr > reserved_va) { + error_report("%s: requires more than reserved virtual " + "address space (0x%" PRIx64 " > 0x%lx)", + image_name, (uint64_t)guest_hiaddr, reserved_va); + exit(EXIT_FAILURE); + } + + /* Widen the "image" to the entire reserved address space. */ + pgb_static(image_name, 0, reserved_va, align); + + /* Reserve the memory on the host. */ + assert(guest_base != 0); + test = g2h(0); + addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0); + if (addr == MAP_FAILED) { + error_report("Unable to reserve 0x%lx bytes of virtual address " + "space for use as guest address space (check your " + "virtual memory ulimit setting or reserve less " + "using -R option)", reserved_va); + exit(EXIT_FAILURE); + } + assert(addr == test); } +void probe_guest_base(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr) +{ + /* In order to use host shmat, we must be able to honor SHMLBA. */ + uintptr_t align = MAX(SHMLBA, qemu_host_page_size); + + if (have_guest_base) { + pgb_have_guest_base(image_name, guest_loaddr, guest_hiaddr, align); + } else if (reserved_va) { + pgb_reserved_va(image_name, guest_loaddr, guest_hiaddr, align); + } else if (guest_loaddr) { + pgb_static(image_name, guest_loaddr, guest_hiaddr, align); + } else { + pgb_dynamic(image_name, align); + } + + /* Reserve and initialize the commpage. */ + if (!init_guest_commpage()) { + /* + * With have_guest_base, the user has selected the address and + * we are trying to work with that. Otherwise, we have selected + * free space and init_guest_commpage must succeeded. + */ + assert(have_guest_base); + pgb_fail_in_use(image_name); + } + + assert(QEMU_IS_ALIGNED(guest_base, align)); + qemu_log_mask(CPU_LOG_PAGE, "Locating guest address space " + "@ 0x%" PRIx64 "\n", (uint64_t)guest_base); +} /* Load an ELF image into the address space. @@ -2399,6 +2390,12 @@ static void load_elf_image(const char *image_name, int image_fd, * MMAP_MIN_ADDR or the QEMU application itself. */ probe_guest_base(image_name, loaddr, hiaddr); + } else { + /* + * The binary is dynamic, but we still need to + * select guest_base. In this case we pass a size. + */ + probe_guest_base(image_name, 0, hiaddr - loaddr); } } diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 66901f39cc5..8fb448f0bf0 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -441,6 +441,12 @@ static int load_flat_file(struct linux_binprm * bprm, indx_len = MAX_SHARED_LIBS * sizeof(abi_ulong); indx_len = (indx_len + 15) & ~(abi_ulong)15; + /* + * Alloate the address space. + */ + probe_guest_base(bprm->filename, 0, + text_len + data_len + extra + indx_len); + /* * there are a couple of cases here, the separate code/data * case, and then the fully copied to RAM case which lumps diff --git a/linux-user/main.c b/linux-user/main.c index 2cd443237d8..e18c1fb9523 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -24,6 +24,7 @@ #include "qemu-version.h" #include #include +#include #include "qapi/error.h" #include "qemu.h" @@ -747,28 +748,6 @@ int main(int argc, char **argv, char **envp) target_environ = envlist_to_environ(envlist, NULL); envlist_free(envlist); - /* - * Now that page sizes are configured in tcg_exec_init() we can do - * proper page alignment for guest_base. - */ - guest_base = HOST_PAGE_ALIGN(guest_base); - - if (reserved_va || have_guest_base) { - guest_base = init_guest_space(guest_base, reserved_va, 0, - have_guest_base); - if (guest_base == (unsigned long)-1) { - fprintf(stderr, "Unable to reserve 0x%lx bytes of virtual address " - "space for use as guest address space (check your virtual " - "memory ulimit setting or reserve less using -R option)\n", - reserved_va); - exit(EXIT_FAILURE); - } - - if (reserved_va) { - mmap_next_start = reserved_va; - } - } - /* * Read in mmap_min_addr kernel parameter. This value is used * When loading the ELF image to determine whether guest_base From patchwork Fri May 15 14:43:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186846 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp501543ilb; Fri, 15 May 2020 07:47:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqVNNzP3OaFuTyN1trZIh0FeeHlbGarNLBojh1S7tboRuhH8XqNxkEHddHR57PNcGpbYkO X-Received: by 2002:ac8:34ec:: with SMTP id x41mr833904qtb.238.1589554029184; Fri, 15 May 2020 07:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554029; cv=none; d=google.com; s=arc-20160816; b=sedYNWGRCE/iyI6He9Qema+jtmo3NLOc896JLhmNwwCuV91Si3RRlGFm0tz2ihFapI zbvLQP135SaGV4tUKbdD0mhmW6d37+XDhAIbrpxjqt7lsTITgyD6gLKYjnhrTyM3yFZA dQMssZr9lqj3iJJjkungnduJjSp+jnPzHGvdXXwNzpqA3PhttxloQhVtIiiD6HA979K5 25EzRvGfqkm5YIL+DVmv9o9ekhxVudqRYZknhhCZaG8gK4smqBSYRFI6wkSnBeOaKXTp /9p89A0XX6Fk8rOPlJdrAf6Kl+xY1uhfpJEQ4Exm9Rf+LXic3lY7Q1jBN5eR8k+EEV3I fN8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Tj9rf4j5C/bY0s30aa+ssWmiD9kTfC6nQrJXTkeJFZM=; b=nEjzypXNzehnceFy3AV/wsRlikWSpSdL02HrYczj458q8KjF18rv43ZowIPgr0YF/g jQ+U6C82T65pBpQq0bkuztCul0Suludgyh1RqiEoy7/zFWHB+aKb/rjsZDCMnM+TyJah kEbnioIFtWlX8Sc+fiSpzS9mqLlIJiLARH1ARy6Y/9iPDWYQFID2YcEC6XecpSN+8Iv7 gfwUbvIzAf9k88gJWOEWme8+jnu1cFHIpj9kH8zhfQGpG0ww0AQ6FOyKW2Varz7VtI1a aRJHowpw1f8Ed6MDc2ShldN6ZU3vxdd7L4jp1VAu5Ifh6EfNxOI5B/IkI7dtdk4KCdpg aEeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=e3qgQf+b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w1si1370801qth.301.2020.05.15.07.47.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=e3qgQf+b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbcC-0005wq-NG for patch@linaro.org; Fri, 15 May 2020 10:47:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZN-0002Bq-21 for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:13 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:56104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZM-0000xZ-5H for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:12 -0400 Received: by mail-wm1-x32b.google.com with SMTP id f13so2567051wmc.5 for ; Fri, 15 May 2020 07:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tj9rf4j5C/bY0s30aa+ssWmiD9kTfC6nQrJXTkeJFZM=; b=e3qgQf+bgeq+F1siSNKcaP1T/CJZqYLzjpzrWH+kitXz51bSYaaN0xOFYEzD1ZZNn3 v7ZRa+qpGWPqbgp6ksLGfHOhotq5k91SSQ5jcSTXIeEYlZ+IeWomk3OGpOeVZh/gp0dn BH2B/iVonzfylzBssmPanpMNkL1fr/yYGozcwfDE4J125NQ5gKRxryt/wqm9+Cq65mxN WEfcXB+CIpHb/+9biZFG/YWbJEJv0HzjAJSfK1Bt1DgffUCQjUPB0hUC275jP8wHcjat x8YP/7X+q6s9kJ/QxCAkZa/q+olVjzXqRRnSo+zm7eqno2PbwpOr3V0Sn6MgrTFglNzn Yd/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tj9rf4j5C/bY0s30aa+ssWmiD9kTfC6nQrJXTkeJFZM=; b=mSbz7VpqARSz0RUoU23DlHUdJmCMk+vLe9ErbXdTRtmZC5ChEzC6lvODbbI3kLkdCM 5P8IB4g0mJmTWjj+j6Zkg2VUB6GFvfOg3sZnj/+2r7OfSIx0YKj7Vhz1HfY5h9aHQOLs VR6GaOCi6iZsTWg8nx0d1UxbrI27j8viPBhfsKLoJrnTHwqaGTAOdiB1cUULMEjNWG0u mZVYto1UQ7RLDoNvYaA3zQjVI2XraWV7iOofOvMLHIQ9fEUBxrlfiiTwEyf3F11r2Vun 8n0IDrG4QWgIjwV9a1MOEj400pMJdZRDH4fA/TxZs5vgLfegJjKkCA+NB37chDVarr4V DDXw== X-Gm-Message-State: AOAM530mGjdrLTJsCoCIxgOSMJ7riEyVUoOyqDx+x4/ncM+r/xgF3T5G cTxP+uapdr80wIFdBn2tx9W36g== X-Received: by 2002:a05:600c:20c6:: with SMTP id y6mr4280915wmm.131.1589553850852; Fri, 15 May 2020 07:44:10 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 77sm4266900wrc.6.2020.05.15.07.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:06 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 847271FF90; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 04/13] exec/cpu-all: Use bool for have_guest_base Date: Fri, 15 May 2020 15:43:56 +0100 Message-Id: <20200515144405.20580-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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_Mathieu-Daud=C3=A9?= , Riku Voipio , Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org, Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20200513175134.19619-6-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 43ddcf024c6..0895a57881a 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -159,7 +159,7 @@ static inline void tswap64s(uint64_t *s) * This allows the guest address space to be offset to a convenient location. */ extern unsigned long guest_base; -extern int have_guest_base; +extern bool have_guest_base; extern unsigned long reserved_va; #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS diff --git a/bsd-user/main.c b/bsd-user/main.c index 28f122b80e6..0bfe46cff93 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -42,7 +42,7 @@ int singlestep; unsigned long mmap_min_addr; unsigned long guest_base; -int have_guest_base; +bool have_guest_base; unsigned long reserved_va; static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; @@ -828,7 +828,7 @@ int main(int argc, char **argv) } } else if (!strcmp(r, "B")) { guest_base = strtol(argv[optind++], NULL, 0); - have_guest_base = 1; + have_guest_base = true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); } else if (!strcmp(r, "bsd")) { diff --git a/linux-user/main.c b/linux-user/main.c index e18c1fb9523..3597e99bb10 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -59,7 +59,7 @@ static const char *cpu_type; static const char *seed_optarg; unsigned long mmap_min_addr; unsigned long guest_base; -int have_guest_base; +bool have_guest_base; /* * Used to implement backwards-compatibility for the `-strace`, and @@ -334,7 +334,7 @@ static void handle_arg_cpu(const char *arg) static void handle_arg_guest_base(const char *arg) { guest_base = strtol(arg, NULL, 0); - have_guest_base = 1; + have_guest_base = true; } static void handle_arg_reserved_va(const char *arg) From patchwork Fri May 15 14:43:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186845 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp501252ilb; Fri, 15 May 2020 07:46:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuXjw9SRj0ov3YNH+qDP27f5yrqAJfCgQIvtcskX0962b1B6NPOxuhllWz9PMZHbWveL2W X-Received: by 2002:a05:6214:8cd:: with SMTP id da13mr3764388qvb.76.1589554005327; Fri, 15 May 2020 07:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554005; cv=none; d=google.com; s=arc-20160816; b=vn6loG4TJt74AnFLeiClATA4ydCfzVmo7hTcEcAO2Nv7T2NbJ0/Gaeo9vhlhjGuElr M0MwxwFyQ+A9V1fgZZ6dwY7PvCN9rYRXut6TMX/s8clkUwqur/ug9JKOH3FwDDdfA+dE gLXlpcRLlVzEE8FvYAC9P13LkW1ASlvXBJ4Ptiq3hr1FG8WSnMqi9NzZDOZmXqNhKANg e9W7+vagmpAcEMGU/aF9aUKKxYywxooH92Fy7VySHkdqaUuJCYLge6ucVnePIZqvUAEN QlmCb+sg+KjQE2ZB2AwGFU15xBgYL7P+9Zuh/JpMWNZ0/MJ591x78EFItctdL6plfUd1 D+7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NBIpR/SKBX2U0msLKof2GONE3NjLw6IkuS84AThlKu8=; b=pnQpm/Hx5kU+htai5QHcV/Rm0PIARHt5jjS7UF63uwZHY/UOW3FHnUdx0SbGDXK/MA QTR72t0VjevHdZibZbGOHl5EHHNrip31C5Ue4l4cZTVErqWTca45Wi1bSp+UQ3K8EDQS 4tGIFZFCOJAkRRkotcXU6lOMUn60+T8piqYI0VFZkKxIJC2hk0PWvWPKokX5UNoINFak u264YbUEqBoG7o4qJU9w+h/x/83Qrnx/o+gXgLIi5oH81Khj+VS4Y8ylZzHPpi9zU7yS ZPPyFsIial4znu/jo6b6vGBUSDYn2KW79OOKrjqU74p2RS1g1RQjro1M+oREVXne8fcc WYxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zICfkdDS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bc10si1210298qvb.155.2020.05.15.07.46.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:46:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zICfkdDS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbbo-0004wS-Ox for patch@linaro.org; Fri, 15 May 2020 10:46:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZQ-0002Jq-3O for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:16 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:43781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZP-0000yh-0A for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:15 -0400 Received: by mail-wr1-x42c.google.com with SMTP id i15so3810089wrx.10 for ; Fri, 15 May 2020 07:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NBIpR/SKBX2U0msLKof2GONE3NjLw6IkuS84AThlKu8=; b=zICfkdDS8h09FVj3XSxst0oeWEiM3esfVa4ePQdWih8m+D3xVmc2IETlhzrKvSnoUi UUmEZ9pR+XJado5715qwNQTNt3EVcYobKaLlRRTUu3srNd4m+9JsVrKbk8kU71WI/UEk 6iPpufEJxpkFjjb4tB6f3IYClcHD67LF2WpLCkWn9WPf2tklrdo1tIrMFzz+qEzxqA69 oHDbD/vOOvn9+MVllMJf4D9kq6WHicZCWZO7Xn4YrOmo9t5KhoT8r0JSNAePQCkTRp8W I2ybuKBS4ar7AgFHNgGE4itDz+Qb1PnEXFA2QeAWYxKPhl4YRrykY7Pc2rqHCobqnF6B cbLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NBIpR/SKBX2U0msLKof2GONE3NjLw6IkuS84AThlKu8=; b=F6ScnKNUFONkbghE4xCAlZH9RO2vzGvWQ1y2jTfco7cFeHzrGEgnhZt4NY7pncU6FW KMCrlcs0mes0EjzV1KyAOwBoIc2Oymmc/SoT5bZDAdKpXDJav74uxswn1fRgfi604ilK YWcLA7guVvo6+tIYC2uyPwRq8NkeZIlR/JRTiM+dJvxTUMZvggpuUDBWsu2WTA7914Yz jyndUE9FRVe6NV3gQaPclaziEn0/d0Bwv5JMSXP768QcawQq/4khBy/bdh3eTxBeKumq WL3K8si0MVlwgcT0LXu8hkAJmZ7IQJhTdfVE3ZDuc0F3u9UrviZPZb1nIQ7+1McUuPzQ tfNQ== X-Gm-Message-State: AOAM532QVgERgbG3M+zaBMsci5gfZWdDzfZd0+OovOTMGYlomCpAThOD yyJgQ/G9ApTXsOc1NfQYccuK/g== X-Received: by 2002:a5d:480a:: with SMTP id l10mr4557713wrq.318.1589553853590; Fri, 15 May 2020 07:44:13 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n7sm3929502wro.94.2020.05.15.07.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A055F1FF91; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 05/13] accel/tcg: Relax va restrictions on 64-bit guests Date: Fri, 15 May 2020 15:43:57 +0100 Message-Id: <20200515144405.20580-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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?Alex_Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We cannot at present limit a 64-bit guest to a virtual address space smaller than the host. It will mostly work to ignore this limitation, except if the guest uses high bits of the address space for tags. But it will certainly work better, as presently we can wind up failing to allocate the guest stack. Widen our user-only page tree to the host or abi pointer width. Remove the workaround for this problem from target/alpha. Always validate guest addresses vs reserved_va, as there we control allocation ourselves. Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20200513175134.19619-7-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 0895a57881a..d14374bdd49 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -162,12 +162,27 @@ extern unsigned long guest_base; extern bool have_guest_base; extern unsigned long reserved_va; -#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS -#define GUEST_ADDR_MAX (~0ul) +/* + * Limit the guest addresses as best we can. + * + * When not using -R reserved_va, we cannot really limit the guest + * to less address space than the host. For 32-bit guests, this + * acts as a sanity check that we're not giving the guest an address + * that it cannot even represent. For 64-bit guests... the address + * might not be what the real kernel would give, but it is at least + * representable in the guest. + * + * TODO: Improve address allocation to avoid this problem, and to + * avoid setting bits at the top of guest addresses that might need + * to be used for tags. + */ +#if MIN(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32 +# define GUEST_ADDR_MAX_ UINT32_MAX #else -#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \ - (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1) +# define GUEST_ADDR_MAX_ (~0ul) #endif +#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : GUEST_ADDR_MAX_) + #else #include "exec/hwaddr.h" diff --git a/target/alpha/cpu-param.h b/target/alpha/cpu-param.h index 692aee27ca9..1153992e42a 100644 --- a/target/alpha/cpu-param.h +++ b/target/alpha/cpu-param.h @@ -10,22 +10,11 @@ #define TARGET_LONG_BITS 64 #define TARGET_PAGE_BITS 13 -#ifdef CONFIG_USER_ONLY -/* - * ??? The kernel likes to give addresses in high memory. If the host has - * more virtual address space than the guest, this can lead to impossible - * allocations. Honor the long-standing assumption that only kernel addrs - * are negative, but otherwise allow allocations anywhere. This could lead - * to tricky emulation problems for programs doing tagged addressing, but - * that's far fewer than encounter the impossible allocation problem. - */ -#define TARGET_PHYS_ADDR_SPACE_BITS 63 -#define TARGET_VIRT_ADDR_SPACE_BITS 63 -#else + /* ??? EV4 has 34 phys addr bits, EV5 has 40, EV6 has 44. */ #define TARGET_PHYS_ADDR_SPACE_BITS 44 #define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS) -#endif + #define NB_MMU_MODES 3 #endif diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9924e66d1f7..e4f703a7e6d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -173,8 +173,13 @@ struct page_collection { #define TB_FOR_EACH_JMP(head_tb, tb, n) \ TB_FOR_EACH_TAGGED((head_tb)->jmp_list_head, tb, n, jmp_list_next) -/* In system mode we want L1_MAP to be based on ram offsets, - while in user mode we want it to be based on virtual addresses. */ +/* + * In system mode we want L1_MAP to be based on ram offsets, + * while in user mode we want it to be based on virtual addresses. + * + * TODO: For user mode, see the caveat re host vs guest virtual + * address spaces near GUEST_ADDR_MAX. + */ #if !defined(CONFIG_USER_ONLY) #if HOST_LONG_BITS < TARGET_PHYS_ADDR_SPACE_BITS # define L1_MAP_ADDR_SPACE_BITS HOST_LONG_BITS @@ -182,7 +187,7 @@ struct page_collection { # define L1_MAP_ADDR_SPACE_BITS TARGET_PHYS_ADDR_SPACE_BITS #endif #else -# define L1_MAP_ADDR_SPACE_BITS TARGET_VIRT_ADDR_SPACE_BITS +# define L1_MAP_ADDR_SPACE_BITS MIN(HOST_LONG_BITS, TARGET_ABI_BITS) #endif /* Size of the L2 (and L3, etc) page tables. */ @@ -2497,9 +2502,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) /* This function should never be called with addresses outside the guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ -#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS - assert(end <= ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); -#endif + assert(end - 1 <= GUEST_ADDR_MAX); assert(start < end); assert_memory_lock(); From patchwork Fri May 15 14:43:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186847 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp502089ilb; Fri, 15 May 2020 07:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0fGK2EFwBHdCXmzaDjqvhHtJYNmxr/15zrpdeDjb8hbN20TSghn08Vh14qMN/yDiBvtph X-Received: by 2002:ac8:2f64:: with SMTP id k33mr3795133qta.105.1589554077827; Fri, 15 May 2020 07:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554077; cv=none; d=google.com; s=arc-20160816; b=faKmkbCqoFB/eEN2lVvg+DfWJ68EuBxrapYwYy8NAfbEwmdH5Bz3k07EC9+91Tb5EX J3seeO625z9m91JVC5eRVi24zwoLgYi9hYWGOX7Bl4HPT8MH+QIyYFdnpSqHslEgUGAZ W+BdvzU+E3a3hjInP5mIXRChmO8MvEgYSxhPCEno7mAKGhiuo+T6hOG+UzPo+FocrByT aBqSzRqeY4bFCgzOfyF/E8tAoJSokbODyMaNp29ExPWAmjbEwwEQGgmHXNiwkmjf7MpK NwQ2lh8O/PFzEXPEydPBNjW5kjLDdr7O72Asnv9q3uHk5Z6FxKJv9ZInUxMQZDwzSQ9r iV2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=shIR+tStLvvJHR4Gop6YH3kVk2PMh0U4kUFwicdynrY=; b=S5DDJq8vWjyIFt4QpuXLmBwzcS68ceEB892LAHQsBy9ugit4ByY2KI+ND8DNTWEz8I xWy1x4S9/n386CxlSy36BQo6j8xlbOL7C+FbFAwgH8NOaDkpJEFSe7dPv1p1le86L7QV 2EwifRHirbGmrNtrCbTymiFJ1bBAFj+5FK4d6zucecOXKEIlwol153yfxcECaT9naFF/ 27eNTWQ8x0kWlkxg7urHaonHuc8Y0vqke0A6m+38b5Xr19ddZcOalMjegtWkEGbb+d+f s9TonY8WS0Whem3wvbywGwU3vsezgaqHLBVl5YnaG+SOVQeRwKaxGoz46pxWgrYScCMY at2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v6Ihq+HM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s131si1268168qke.265.2020.05.15.07.47.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v6Ihq+HM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbcy-00086v-MY for patch@linaro.org; Fri, 15 May 2020 10:47:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZS-0002Pp-Hw for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:18 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:40785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZQ-0000yo-J2 for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:18 -0400 Received: by mail-wr1-x42b.google.com with SMTP id e16so3843600wra.7 for ; Fri, 15 May 2020 07:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=shIR+tStLvvJHR4Gop6YH3kVk2PMh0U4kUFwicdynrY=; b=v6Ihq+HMqawdA8xXa+LH7phlq10TP3+j0uU+vmjmsetX5aowjTMFnTUDJQ49Onn5TD S1o7SwlWhPXhyj/emZgC8CswixlHLC0q4zU7ov95tyaSyw+2m51LkvoIpadn7rwVpdUA AtaULYlIhoDP7D4ITZYdTuONU5/D8zyGXE87sByhHoqCNlnv1Cm+LhO0R+aElAZ+sCWt f7sFOLfaSylLEbNT/J6fsxze/NtExFNHXc0pU+jWaptUZjztJKwEEQLZu1nPMIibVaDK pMgF1GykwwL7RVJLHR/1ABwJufCGUaeNz1JCkMBOTSUo6Yi9VY3HztmOR/aj6MaMS9h0 TWzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=shIR+tStLvvJHR4Gop6YH3kVk2PMh0U4kUFwicdynrY=; b=XE9eaAY4acPZhOUGxeXB6otK9QvYUti/4adiA//FJDOhEq4h6xIffy41NSk/CGxVt1 Du2NmwdXVVHmBShlRooa1Y1Jf/Wvqk+0u074an6eMSsfJksbaxdfKkSlb050k9qBJR7s 6hqwCYNvbcPkdqoj2+qR/lEe45KNUL8MoeUHrQbKdW3t3HOp1ou3Va4yLFayl6AvmRfv d0Pm/KVtyWPEpM/Gu0eZ7KReX3VqFVwIbSoQdGEamoV8nK0NvwyguEYDTAhztClXyl2f PPiQHxyZCPMIrO6h+lIQC5eeBUfuu8HFcWX0wYTwgj/CB8C0WOipeVItnDMBPWuCWcBP cwjA== X-Gm-Message-State: AOAM530DznDzsmEr6CpnfNMqqs93gkd6eVlAzaXMWM3vgvjjiOPYAhhZ ZZcjPzfVocVYbULhQk6hvkoHSw== X-Received: by 2002:a5d:5011:: with SMTP id e17mr5017213wrt.347.1589553855265; Fri, 15 May 2020 07:44:15 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b19sm4182142wmd.26.2020.05.15.07.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B54DA1FF92; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 06/13] accel/tcg: don't disable exec_tb trace events Date: Fri, 15 May 2020 15:43:58 +0100 Message-Id: <20200515144405.20580-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" I doubt the well predicted trace event check is particularly special in the grand context of TCG code execution. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200513175134.19619-8-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index 01852217a66..385b9f749b8 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -1,10 +1,10 @@ # See docs/devel/tracing.txt for syntax documentation. -# TCG related tracing (mostly disabled by default) +# TCG related tracing # cpu-exec.c -disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR -disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR -disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=0x%x" +exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR +exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR +exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=0x%x" # translate-all.c translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p" From patchwork Fri May 15 14:43:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186851 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp504682ilb; Fri, 15 May 2020 07:51:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKuPQjqm6jMplKoUDEprh19HU0FfKouq9FC5xLhHQoEtDFBBjMXpW0EJJ4K8EzUS76m92+ X-Received: by 2002:a05:620a:2190:: with SMTP id g16mr3814761qka.104.1589554290037; Fri, 15 May 2020 07:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554290; cv=none; d=google.com; s=arc-20160816; b=ui0eSEp49ETZLEwq2OBhjgrHGLepOBVKjJJAUFh9vVxHApRLDYcIXiWC1KqbJZkB7M Y12J+a/FNI9RUNTqLGYxKB/ngU/1SpHS2YLpc18elCHRFWtlw59HngjwvgpDDUojCBut 6d/khp8I4mDgTW8mmdlP0b3oX4EiD/he5sXCdYbaBQwcy9MXPjo0pkoRH1RRMgtSR2VA z9ka84s0HafUIdBfMJK/FmAK+T0MHmatreZTjHRf84c+s0LwWdttTqzG0umC7ACDC34C wFpb3zaEcU6kqGb3QxxBjhQ+FtqM6KGudar0TivZc0rcrIb52Y/93Y6M/m0UrM5sFz14 GsOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KIk6ooatV8XnS7vaKVLS3g3ZtQSw6C7qVIF3uAG+cLk=; b=UFjwZ1jGFg1wK1nhqY69E/UwODXKC4JUlA5n/u9u5hpReX3zhxzB6vqHHOv2ZSwwT9 /zUK/n7Ep7Ukr3+aPgxW9bXqpq7hc/r3ifrw4TXlbSIW0/MeGUYpT+1ac6Ywy4+Sal0B FRuCEPlHBkbjiJIPNNPO8auYd+EBijHAJwnCBmyuQIszFaZNLFxHSZl3ZyKXXd6mdqNW hYzsfJY4Ya+EVbpRP/SO5Xzu+PAI51tEgi0Rrr1B9GEcQd7DmBO2Y714cFbD4Mzp0ymc UVKxdLE3Ae2U54VLo3/Nxuze9Ml75z3sab4qGonlnnuAKvyFtLmbRiJTo4DEnFdGTUF4 y1Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZfqpQNvN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b28si1168378qka.214.2020.05.15.07.51.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZfqpQNvN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbgP-00048T-I4 for patch@linaro.org; Fri, 15 May 2020 10:51:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZU-0002Qj-6c for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:22 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:40624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZR-0000z2-Lo for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:19 -0400 Received: by mail-wm1-x332.google.com with SMTP id u16so2943717wmc.5 for ; Fri, 15 May 2020 07:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KIk6ooatV8XnS7vaKVLS3g3ZtQSw6C7qVIF3uAG+cLk=; b=ZfqpQNvNQ7UCoebosaHhnei3f3jwIMNf/xuQw6RgHEhcAoIZQZztgWjD5yS1Zq7opp KJsVT7UHaC2tcsbCdJy73LodPZc1WTqsio9vmrku6AYzrzjDzs/8VdpRN8eu9LSl4KSG 6Ctes9U4WKMOP8pyh8WSPQmFfr0XOq7iWkD/6Fydva9195SFMPy22IU4NVm/6IuwBJIU 5FZa3BubkzHsnzuES0n0eYDaL75zyAazRoSED7GPafkGR5cDlPe8ODTR6aD5vaGMhk5z WvLzoLF4mOvrmussYy62dNAxF9xevD85l0U1mvgJahJlfHNVzxx/gZe6TmzCiuOo+sTv YLMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KIk6ooatV8XnS7vaKVLS3g3ZtQSw6C7qVIF3uAG+cLk=; b=H5QUJRJcdBeQpDrvlnV3Y1vtY/E17ecATZ4DpTObF+ndkgehS/9Gcx6XtoVJlVdJ8A 1xbegx0uztAbqGlKAosV6Cb8nCoQruv0qXUVCiHmHvqYjMLR1HxNvXrfHoH4/FNDkeY7 4pVPjaDGEIadU1w8U/v1SuwWOTKN0W0pFmZ0A5avINTsYvvFXEP7uXZfQO0uH02Ktg2B 49L7Swa68hCA++5RXAEHidHeF8KF6XPctqjoAqSAJBFwnNVOz3dv+dGw+VfXnCvUbt1G 0Sch7Doi2NqQlP+7E2J/cFG7IK0TjP24puUoDD8BVR0W4KTxz7zygVvUtXTBGh+rpmxN IPKg== X-Gm-Message-State: AOAM5327pYLysFENLrC2hISggYwoqSzfnsZoqhCayKBnsNmsQnEU6GLf SXkclAFUp2kY47md5iLFPc6YIA== X-Received: by 2002:a1c:4b02:: with SMTP id y2mr4154073wma.115.1589553856262; Fri, 15 May 2020 07:44:16 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d6sm4583930wra.63.2020.05.15.07.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D0EC51FF93; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 07/13] disas: include an optional note for the start of disassembly Date: Fri, 15 May 2020 15:43:59 +0100 Message-Id: <20200515144405.20580-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will become useful shortly for providing more information about output assembly inline. While there fix up the indenting and code formatting in disas(). Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200513175134.19619-9-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/disas/disas.h b/include/disas/disas.h index 36c33f6f194..1b6e035e32d 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -7,7 +7,7 @@ #include "cpu.h" /* Disassemble this for me please... (debugging). */ -void disas(FILE *out, void *code, unsigned long size); +void disas(FILE *out, void *code, unsigned long size, const char *note); void target_disas(FILE *out, CPUState *cpu, target_ulong code, target_ulong size); diff --git a/include/exec/log.h b/include/exec/log.h index fcc7b9e00ba..3ed797c1c8c 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -56,13 +56,13 @@ static inline void log_target_disas(CPUState *cpu, target_ulong start, rcu_read_unlock(); } -static inline void log_disas(void *code, unsigned long size) +static inline void log_disas(void *code, unsigned long size, const char *note) { QemuLogFile *logfile; rcu_read_lock(); logfile = atomic_rcu_read(&qemu_logfile); if (logfile) { - disas(logfile->fd, code, size); + disas(logfile->fd, code, size, note); } rcu_read_unlock(); } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index e4f703a7e6d..cdf58bb420e 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1800,7 +1800,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, size_t data_size = gen_code_size - code_size; size_t i; - log_disas(tb->tc.ptr, code_size); + log_disas(tb->tc.ptr, code_size, NULL); for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) { if (sizeof(tcg_target_ulong) == 8) { @@ -1814,7 +1814,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, } } } else { - log_disas(tb->tc.ptr, gen_code_size); + log_disas(tb->tc.ptr, gen_code_size, NULL); } qemu_log("\n"); qemu_log_flush(); diff --git a/disas.c b/disas.c index 3937da61571..7e8692de301 100644 --- a/disas.c +++ b/disas.c @@ -586,7 +586,7 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) } /* Disassemble this for me please... (debugging). */ -void disas(FILE *out, void *code, unsigned long size) +void disas(FILE *out, void *code, unsigned long size, const char *note) { uintptr_t pc; int count; @@ -674,10 +674,16 @@ void disas(FILE *out, void *code, unsigned long size) for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { fprintf(out, "0x%08" PRIxPTR ": ", pc); count = print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) - break; + if (note) { + fprintf(out, "\t\t%s", note); + note = NULL; + } + fprintf(out, "\n"); + if (count < 0) { + break; + } } + } /* Look up symbol for debugging purpose. Returns "" if unknown. */ diff --git a/tcg/tcg.c b/tcg/tcg.c index dd4b3d76844..a2268d9db0a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1092,7 +1092,7 @@ void tcg_prologue_init(TCGContext *s) size_t data_size = prologue_size - code_size; size_t i; - log_disas(buf0, code_size); + log_disas(buf0, code_size, NULL); for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) { if (sizeof(tcg_target_ulong) == 8) { @@ -1106,7 +1106,7 @@ void tcg_prologue_init(TCGContext *s) } } } else { - log_disas(buf0, prologue_size); + log_disas(buf0, prologue_size, NULL); } qemu_log("\n"); qemu_log_flush(); From patchwork Fri May 15 14:44:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186849 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp503711ilb; Fri, 15 May 2020 07:50:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweGa74mPOiI9Pp3+2FoSgcWRGAzFTTj7EizuGzLxFzKMLFF22w8+jv24CwMRKre5ePRE+d X-Received: by 2002:ac8:1622:: with SMTP id p31mr3768176qtj.256.1589554204590; Fri, 15 May 2020 07:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554204; cv=none; d=google.com; s=arc-20160816; b=D5qi/4ojknLMBpFu9tHreQYTpUu635TuzCGNIuLSE9aoLRBZDslWnAK3n5U/ttKTKm xe7wskBz/w8axthMmQzw9Ci5UT/6+iPdUwEqP7xcgK5mFQhFzY1hhibWMwQ6u13Aq/n0 Pf3YYlciyNJ+bBz/ee1d76n1IXngZLiJiIkQ/brtQyMdHw5zYW3MtHunI11vfmCAIkO1 CC0E37dOjcYw8qQZFl2hVAkllMKBP4xaNnlC/wFBOpEk+ZXOPlPGWH5s/BExrS4Crjqz E4gH35wNQ1HhHouz+sIsl83euuyf2cPUpxf9EK9Zw2elCNjbdGEtFWHzmQCiDInCE8jM 6J0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=nJshK4Gmxn9NtKVYQkApWjq7ip9+eMHY3X093/AxgHA=; b=n37lJV9+5bq80HIUKpKjXeL2ek6mUm1LPlGQmLd2PlwgVIpDw0+fPym23CodT4RicF TtpnxWUOOY/0MRRxNvgG1fTeO8jd9Qv6sEWAVvx4AEn4wAuIUWaCOw1WFoBkyZdm526I zELGq31+Dxq4czce/6KZ9S5PYqhotJx3MJVoUA4AUbMWvts87LG5lwGPj4GMzl0uwWRQ bjgbVRKmUPqZe5ZckzQIfvkpRS1kllKR3kuBqtwIBY7Utm0SK71pwX7nL0nrDDwqZW+h DXl44XbRNMQXBGCcTh5gXjjwTc9dJ/PnrKhQNkI/mJ4WZHXGNzzsRCDz1fAYHQPKAn+i uKwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=w685uZIu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q43si1416340qte.23.2020.05.15.07.50.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:50:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=w685uZIu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbf2-0002Cn-3Y for patch@linaro.org; Fri, 15 May 2020 10:50:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZU-0002Qk-9P for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:22 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZT-0000zD-0p for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:20 -0400 Received: by mail-wr1-x434.google.com with SMTP id v12so3800570wrp.12 for ; Fri, 15 May 2020 07:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nJshK4Gmxn9NtKVYQkApWjq7ip9+eMHY3X093/AxgHA=; b=w685uZIuhvpWnqw5ymPY9UXQaJCskyBrSZhLrhHbDYBNOAo/gt9I6kxVROzPe7co8I Zq9ES3UJAyu3phgtUqQwwXkdDUp1dXCGiFPf6DbN2tAtGsbLr//J0iPJVe/fDZ1Wl6xK 9EcHJ6LOwwHmL+mgI7i9Kp5GMYqW/08yn7FKKyeUqPkfpMQIYqoGRbv6xi+4ScGDOOcF fbH2GA43WVelP/rS0XpvVgso4jjqO6VUBCPA/QoUcXeOHXnsvOM8cXrs2kpB3cvfURNU gZHIF5jbBCZOeiQWiQYlHDo4Chu5PVWikXAICZ1e4uvxgNEUrIlgi6OzV322tfroSt7B 5jVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nJshK4Gmxn9NtKVYQkApWjq7ip9+eMHY3X093/AxgHA=; b=VIRuHmhZDgKAgLK1dIThKhI8ceOYX7pUn2xJP0sXFSQJYRx5NGEKk2fxCVwXB7svPS uQv5NWvRj6bbt4w+byILmXoMXZsmTgNVRkJU7d85aTUH2cVFLL5SNLAnvOiXzlMGUREI /4ZiWFoKJOKDcSAZQ+LE5Fejyv7LJpptsyWgT4BrjH+PDdOOg+W2Iyy4E7R9iKe43Cex qP6099vYAwcuH+0pGfZPOCQsmjQIO0helSSy1IcmN+2omiB72GPaw/4Ozb88USOstP/0 rLZB7QI3IjcH/feU9/ORyTGh9vspWDJY6u8AggSvXotVu3cRON0HB3gDdcRfjU8xdnV+ y2pA== X-Gm-Message-State: AOAM530qciOB1C7K3N3oqE5q0pu1RZ1OrV8HgOgbOTh7nfk1aTAZ4JgU cnWA4ay5jKOoB1gI+onX0c8hClJ7wU8= X-Received: by 2002:adf:d089:: with SMTP id y9mr4592371wrh.26.1589553857656; Fri, 15 May 2020 07:44:17 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x17sm3872693wrp.71.2020.05.15.07.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E696F1FF96; Fri, 15 May 2020 15:44:05 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 08/13] disas: add optional note support to cap_disas Date: Fri, 15 May 2020 15:44:00 +0100 Message-Id: <20200515144405.20580-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Include support for outputting a note at the top of a chunk of disassembly to capstone as well. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200513175134.19619-10-alex.bennee@linaro.org> -- 2.20.1 diff --git a/disas.c b/disas.c index 7e8692de301..45285d3f63f 100644 --- a/disas.c +++ b/disas.c @@ -260,7 +260,8 @@ static void cap_dump_insn_units(disassemble_info *info, cs_insn *insn, } } -static void cap_dump_insn(disassemble_info *info, cs_insn *insn) +static void cap_dump_insn(disassemble_info *info, cs_insn *insn, + const char *note) { fprintf_function print = info->fprintf_func; int i, n, split; @@ -281,7 +282,11 @@ static void cap_dump_insn(disassemble_info *info, cs_insn *insn) } /* Print the actual instruction. */ - print(info->stream, " %-8s %s\n", insn->mnemonic, insn->op_str); + print(info->stream, " %-8s %s", insn->mnemonic, insn->op_str); + if (note) { + print(info->stream, "\t\t%s", note); + } + print(info->stream, "\n"); /* Dump any remaining part of the insn on subsequent lines. */ for (i = split; i < n; i += split) { @@ -313,7 +318,7 @@ static bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size) size -= tsize; while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { - cap_dump_insn(info, insn); + cap_dump_insn(info, insn, NULL); } /* If the target memory is not consumed, go back for more... */ @@ -342,7 +347,8 @@ static bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size) } /* Disassemble SIZE bytes at CODE for the host. */ -static bool cap_disas_host(disassemble_info *info, void *code, size_t size) +static bool cap_disas_host(disassemble_info *info, void *code, size_t size, + const char *note) { csh handle; const uint8_t *cbuf; @@ -358,7 +364,8 @@ static bool cap_disas_host(disassemble_info *info, void *code, size_t size) pc = (uintptr_t)code; while (cs_disasm_iter(handle, &cbuf, &size, &pc, insn)) { - cap_dump_insn(info, insn); + cap_dump_insn(info, insn, note); + note = NULL; } if (size != 0) { (*info->fprintf_func)(info->stream, @@ -402,7 +409,7 @@ static bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count) csize += tsize; if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { - cap_dump_insn(info, insn); + cap_dump_insn(info, insn, NULL); if (--count <= 0) { break; } @@ -416,7 +423,7 @@ static bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count) #endif /* !CONFIG_USER_ONLY */ #else # define cap_disas_target(i, p, s) false -# define cap_disas_host(i, p, s) false +# define cap_disas_host(i, p, s, n) false # define cap_disas_monitor(i, p, c) false # define cap_disas_plugin(i, p, c) false #endif /* CONFIG_CAPSTONE */ @@ -664,7 +671,7 @@ void disas(FILE *out, void *code, unsigned long size, const char *note) print_insn = print_insn_hppa; #endif - if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { + if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size, note)) { return; } From patchwork Fri May 15 14:44:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186850 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp503742ilb; Fri, 15 May 2020 07:50:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmhM3iF2BM3L87+v3gtQPxVp3i+ilVjlwkFWCsbfUfuyGA9ac2pyQ1HbZmMhjtcqG9nWK1 X-Received: by 2002:ac8:2965:: with SMTP id z34mr3758562qtz.44.1589554207596; Fri, 15 May 2020 07:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554207; cv=none; d=google.com; s=arc-20160816; b=i0nKW/jyK1B9a+4Pkznakt9tEud+OUPNt/JOLJ0Fs1LZJBKvOl8zAfxfU5TVuoKjPh a87B8ZblBW11eUdaSFKuuRRXy4C1zK+v+WmfYS/8rWoq/QUfVW2Qh3EBTFQEivtdR4/W UFyz77ccv8tz7Ml9Cq+FcXPifBfDoh2lgYzQvzgOnuRq0faSkfelhb95tqYxhPo9W6zS 5g3Pr58aolafzlRiNCVfWvSV/RVQedaDTgyS9uVBHiHR3TBbQf9eVxR2ppgqGlCj6Ayu 3dtcDGWLbEikubzgrBcirh6E1ytbwCxZ+46R/6po/Vs/G9W2oDJJl4oNxskGvdCMnorN JWWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NDEc+9+kZ2Q3/E6kQh66WfIBSt6HPjYYbPv1ArIk0sg=; b=n4qfJ4UQDxl7+QPKdw0keNSox6jnjVYo60kubG/z5g14OzZzdT0uw569AKbw2jxOxT QwlFFUcM+WorOLCgA8uboRnLGip0Zo8EdL7jFjt25IZ3aFKXHz7dSicq3aHw04FmPR9x sBcJxC0WZD+IuEq6zU9XKKp+Up5LnD14J6i+E+S4Zmw6qSYo2FXRAppcqnMlrkuV44Wl sIpIJBqtd/pnz5XDRmrlOLhR20qPDQsxYuwYaVchnBhoFgGeU6Svrh9AvMefXdeWST8F EORmZNUbOtm1wpazZBLkGbGZcPs/2XvgJJ5J1UWwDTA9xxADqcwk0U+BmlRcxG08dTNA LSXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cM+oCqVY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y1si1233363qki.52.2020.05.15.07.50.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:50:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cM+oCqVY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbf4-0002l7-TM for patch@linaro.org; Fri, 15 May 2020 10:50:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZV-0002Qt-5V for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:22 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:36942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZU-0000zK-BB for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:20 -0400 Received: by mail-wm1-x32e.google.com with SMTP id z72so2963545wmc.2 for ; Fri, 15 May 2020 07:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NDEc+9+kZ2Q3/E6kQh66WfIBSt6HPjYYbPv1ArIk0sg=; b=cM+oCqVY+A15dg+aq9QHooynfIT+ojxkuGKe+xiNpZf8uzD5ogo3LsPU+aJ+UlLPqb 38EJPyjAzIEkFJibQM06boqrZvTaANnF9Tnkw/Jb54xrwNz3v2oFum3KZhvik6mDHuCL pRoOpACSbCMcNINL5l10jMfbScuBUCEcwIm81xPsxX+MiWkMqSHXBB8mQKf8EwI0YBPU BfPTPvqCXEMdIHZDZMY2GZsPBro8azBI8MUY59AGkmOpupMc9E6rqNyi/RlA1cJQ2FEM J63iD5JeDUzJ/rmhtaNMpx0+1aT8Y1ZQj8MWKSYQnLC2wSg7umeXCTSqsYDEekFz8z8j aNiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NDEc+9+kZ2Q3/E6kQh66WfIBSt6HPjYYbPv1ArIk0sg=; b=aDaKPRnq/rs3+46NlRDxx5qA/riwVXufWevfXISaga+s99lLdq/p4Rp0g4waEbhjB5 2Z0D8xFm4M6JU7Bv+ewWHYW3B2Ov0qYp6PKaTXJuDR/hzsYakcWLlw4dE8Wi4R0yMHh8 bDGAFr+QMh9TL+2vKZHTvJhwrx7u5Sm0qU5Krbs1mGqF/QGMqC3bbgWq7geVHcNDngKi XUrL2t9tdel+csJiK86WIxBjJssK6A89fEmD44zEvhIgeO1cvAuembe7DL/az5ybJkOg sxhqRBgpUvUa2SKWl7DMmeA8fiOGiozwD8bCukFkZus+xlupuxvZkGSz/9azAur+Ch2Y ZnWA== X-Gm-Message-State: AOAM5307lEdO9Fst0VQUGhZGlurQKX+8JwVCm3nI3vw9whPaPAyNic/0 46qqfxAzBuFoKZVEboj5cr6V0Q== X-Received: by 2002:a7b:c84b:: with SMTP id c11mr4258054wml.19.1589553858874; Fri, 15 May 2020 07:44:18 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d6sm4584006wra.63.2020.05.15.07.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 06B951FF98; Fri, 15 May 2020 15:44:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 09/13] translate-all: include guest address in out_asm output Date: Fri, 15 May 2020 15:44:01 +0100 Message-Id: <20200515144405.20580-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We already have information about where each guest instructions representation starts stored in the tcg_ctx->gen_insn_data so we can rectify the PC for faults. We can re-use this information to annotate the out_asm output with guest instruction address which makes it a bit easier to work out where you are especially with longer blocks. A minor wrinkle is that some instructions get optimised away so we have to scan forward until we find some actual generated code. Signed-off-by: Alex Bennée Message-Id: <20200513175134.19619-11-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index cdf58bb420e..42ce1dfcff7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1794,14 +1794,43 @@ TranslationBlock *tb_gen_code(CPUState *cpu, if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { FILE *logfile = qemu_log_lock(); + int code_size, data_size = 0; + g_autoptr(GString) note = g_string_new("[tb header & initial instruction]"); + size_t chunk_start = 0; + int insn = 0; qemu_log("OUT: [size=%d]\n", gen_code_size); if (tcg_ctx->data_gen_ptr) { - size_t code_size = tcg_ctx->data_gen_ptr - tb->tc.ptr; - size_t data_size = gen_code_size - code_size; - size_t i; + code_size = tcg_ctx->data_gen_ptr - tb->tc.ptr; + data_size = gen_code_size - code_size; + } else { + code_size = gen_code_size; + } - log_disas(tb->tc.ptr, code_size, NULL); + /* Dump header and the first instruction */ + chunk_start = tcg_ctx->gen_insn_end_off[insn]; + log_disas(tb->tc.ptr, chunk_start, note->str); + /* + * Dump each instruction chunk, wrapping up empty chunks into + * the next instruction. The whole array is offset so the + * first entry is the beginning of the 2nd instruction. + */ + while (insn <= tb->icount && chunk_start < code_size) { + size_t chunk_end = tcg_ctx->gen_insn_end_off[insn]; + if (chunk_end > chunk_start) { + g_string_printf(note, "[guest addr: " TARGET_FMT_lx "]", + tcg_ctx->gen_insn_data[insn][0]); + log_disas(tb->tc.ptr + chunk_start, chunk_end - chunk_start, + note->str); + chunk_start = chunk_end; + } + insn++; + } + + /* Finally dump any data we may have after the block */ + if (data_size) { + int i; + qemu_log(" data: [size=%d]\n", data_size); for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) { if (sizeof(tcg_target_ulong) == 8) { qemu_log("0x%08" PRIxPTR ": .quad 0x%016" PRIx64 "\n", @@ -1813,8 +1842,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, *(uint32_t *)(tcg_ctx->data_gen_ptr + i)); } } - } else { - log_disas(tb->tc.ptr, gen_code_size, NULL); } qemu_log("\n"); qemu_log_flush(); From patchwork Fri May 15 14:44:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186852 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp505416ilb; Fri, 15 May 2020 07:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz7ie1oKeDBaKlpQE4EehXv+FFsGFru3P9G5XUN3VzbMSnpXQfD07mZZXlPjBt+LNiK54l X-Received: by 2002:a0c:f214:: with SMTP id h20mr3967615qvk.200.1589554352816; Fri, 15 May 2020 07:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554352; cv=none; d=google.com; s=arc-20160816; b=h6sESyZywHtLz46uWcerp1LYYEbAZafJKij1/UKcNhQS7k4YVx4jG/wFVUoN0DUY95 79krnh5efUxKoNgrupMDTtHafSduRUtsXqU1F1RP79W7N45MyVljcY1JPI+bz8vRLUpa cqyLfrpYhOeKrNtSJDBLvZiwiAcCIz8dtuwjIeBWY+5ulcFFnb6qDdQRW9UI+QXseKkY 8UdgaRDd6gvtMDeGddcA6VLLCHGveC5qxWLo+8sHU+JDr72mnregH2Uv/nY15ifH71cc Dx/fDcW4gcujvulJ27YFxM+UIgnShuffaZFLfDM0tiU3jISAdUCgX5h3Sh85lUBhpe7z njXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+a2TvwRII2J7AoPGBoNpj53l/Ezc+QlB4IwOZgMmlqY=; b=FWPosUusyXE30daEkzxZ91W8sj0ouXq109DxXsK0V9I+T8+qKy8JhV/CWVDwo3rksd 0BVwkJ9+8cmnWGNRprTLut4dLruXukTmHkbwFgEOskGcuzKvtBaADr6Eb9rP+uS9oXnZ 6/2CUELaZGYjbLbRC4MiYKlTyvGK8+v7QuBVEmj+Kam9XJEfNZlD7Y3zVCib3Q+5emUd Fww/Wzn8pU3iYK7NtSXuHLeohR2bUQZbUqQA0Eig5iF+h1oT/1n8rC1xUlPyuMwf/QXk DSPhoPREpz898WhJ1FVyT4LrTluTmTrmXroiS1MmXNiuF96Ce8mxbcLmdo1AoJfdu10U cg9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=if1+c6mF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id eb11si1125941qvb.2.2020.05.15.07.52.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=if1+c6mF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbhQ-00067d-BE for patch@linaro.org; Fri, 15 May 2020 10:52:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZX-0002Sm-Jo for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:24 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:54912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZW-000106-8o for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:22 -0400 Received: by mail-wm1-x32e.google.com with SMTP id h4so2581667wmb.4 for ; Fri, 15 May 2020 07:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+a2TvwRII2J7AoPGBoNpj53l/Ezc+QlB4IwOZgMmlqY=; b=if1+c6mFY3gjwptzcSIKYu57JQSJPsBtm2MSa1f5mOhsDDcOMRUO5DQO/Xa04vkEDE D9vm4MGzPns7zad2RecwqmUMhyYTLrRqlV6OxMhbEAolgHg48MrCM0+8JoBEqXVljKdS Aw9gdZg8zXOtkQw5fp2vZhU2iAhDFnFJLXReO4D09A2k5FcwAhPC8O0R39sPQPUtdkSM pmNo88+HPjGbMFO81Rn3iqImmXk8GMPixDJvyrh1e3RBCeMRP5ov6sW7RNneJWtMzL7U gALE11rnlV01ut2HJSLzhgzA6Ff40jyiKvh9dU5yJpmiOMdIjsYula/1671Py9mZR2Uf FsuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+a2TvwRII2J7AoPGBoNpj53l/Ezc+QlB4IwOZgMmlqY=; b=Kdmt82YPPNtL4HmamauxUtJ0oUSWJjytn36GvRG2W4qH27yRrn4SNwrCNvsPbU7wgG wM3wSLAdy48IpFFOl0uTO5Z/YnrIUE0HiNlLIem9EotclOzGy1eKIpL1feuO1N4DZLMY epTpXRXNFs7aqYb3Xw/1EErx9wCcqvPNOXyWOmcpptvNhrc4ECtq7lm8reBmgIqGzW95 QN+lcf+vRjw/Q5iBL5P+Up5i6aTQWlVfBPsLwZKt4kxoJEeVkiEUkCHFdEjnJmEIb3LJ zuR8Vv0L0rYA3hcJUEX6RzQazH5Kds/nf28rb+sMDmiTeP+cP8D3XB4oBZ4VmjGIuGL5 phfw== X-Gm-Message-State: AOAM531jxu0SCwujh5t0WiYnDZWaHZm7izTsqv2R+EEi8Fn97GATaKZr 5yUMKrKf3mlZ0o3X5en5d4z5iA== X-Received: by 2002:a1c:b354:: with SMTP id c81mr4355499wmf.136.1589553860752; Fri, 15 May 2020 07:44:20 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t7sm3982423wrq.39.2020.05.15.07.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1D6E61FF99; Fri, 15 May 2020 15:44:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 10/13] qemu/plugin: Trivial code movement Date: Fri, 15 May 2020 15:44:02 +0100 Message-Id: <20200515144405.20580-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: "open list:Trivial patches" , Michael Tokarev , Laurent Vivier , qemu-devel@nongnu.org, "Emilio G . Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Move the qemu_plugin_event enum declaration earlier. This will make the next commit easier to review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Emilio G. Cota Signed-off-by: Alex Bennée Message-Id: <20200510171119.20827-2-f4bug@amsat.org> Message-Id: <20200513173200.11830-2-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 11687e8cdc3..e45f950fe36 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -13,6 +13,22 @@ #include "qemu/queue.h" #include "qemu/option.h" +/* + * Events that plugins can subscribe to. + */ +enum qemu_plugin_event { + QEMU_PLUGIN_EV_VCPU_INIT, + QEMU_PLUGIN_EV_VCPU_EXIT, + QEMU_PLUGIN_EV_VCPU_TB_TRANS, + QEMU_PLUGIN_EV_VCPU_IDLE, + QEMU_PLUGIN_EV_VCPU_RESUME, + QEMU_PLUGIN_EV_VCPU_SYSCALL, + QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, + QEMU_PLUGIN_EV_FLUSH, + QEMU_PLUGIN_EV_ATEXIT, + QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */ +}; + /* * Option parsing/processing. * Note that we can load an arbitrary number of plugins. @@ -47,22 +63,6 @@ static inline int qemu_plugin_load_list(QemuPluginList *head) } #endif /* !CONFIG_PLUGIN */ -/* - * Events that plugins can subscribe to. - */ -enum qemu_plugin_event { - QEMU_PLUGIN_EV_VCPU_INIT, - QEMU_PLUGIN_EV_VCPU_EXIT, - QEMU_PLUGIN_EV_VCPU_TB_TRANS, - QEMU_PLUGIN_EV_VCPU_IDLE, - QEMU_PLUGIN_EV_VCPU_RESUME, - QEMU_PLUGIN_EV_VCPU_SYSCALL, - QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, - QEMU_PLUGIN_EV_FLUSH, - QEMU_PLUGIN_EV_ATEXIT, - QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */ -}; - union qemu_plugin_cb_sig { qemu_plugin_simple_cb_t simple; qemu_plugin_udata_cb_t udata; From patchwork Fri May 15 14:44:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186843 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp500235ilb; Fri, 15 May 2020 07:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRkd77i9VfDOPV6ghvxcqOCrsJL7vx8t0uAIp/99/Ed3znwaf0mM/8iPEhjdG0C02nxifx X-Received: by 2002:a0c:ec8f:: with SMTP id u15mr3905836qvo.102.1589553921376; Fri, 15 May 2020 07:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589553921; cv=none; d=google.com; s=arc-20160816; b=wKyKrgsI/hyLVDA9dhBwuIaLESwkzyty1lqF/KpQWx668JtFXQ47AKE/Vk/dYyPhqB yi51gMSHfpiCtUYmNA6ZgR563V3QFwdHArSFkhdZ3fqZtQ1lrN56mIjxoL2ChlkG9FOh sgtbBhynKhpwp5d3mG7CfVo6R+nlz2QmlazWiLR/H8jNRX1NohLWFyCCFr8vdY1+jBUj m3WNZflw/xZpWrJIiiMtpEIbnCb2jZEJkmL+I9576TOBwQg5IojzIlz9kGmrQn2Vu76i F3ntR9AiqJRzC1RyeRy2WiZRCi8LKsK2etdzpnyZ5Hm1MINK0laRJ8KA5GqIwP47eLTO 41Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=tQttWf6rj7Sr02MvNzPrzDKjaidbgt9rChCOOlqQ7tY=; b=wNH4dztOugjL/3KlY5+yzu//jvm3zo/V1waFdjzXUFGt17743K5vnWEs9/A5Gm8KuO hlnwz9EQ/c27yOp73NXRbJSV6uerSibhj504s+cMHEWkcrLcmlQyvDTPoNrZFB2SToYg KI3bJfo0mOrC8sM+JSUAxInnLxRMCMQJAgHB0MzFm8niXxOPP/ZxP6WT4+jpBD3Jc2nx kxs6sBA4UxFp/WR9zCGNvJo5jPpQqswE1YUK4RXMKIBwayLA1auDGxmnrc3zuFzBXZs5 vJUP57VltPvbwKCH8hQ5P7JtE88RUHgvWCiN+yRkC1VFEwzxbkX28YjfZf2JV28ZnOOn aBJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h3YvXUce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk6si1167470qvb.137.2020.05.15.07.45.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:45:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h3YvXUce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbaS-0002fw-MZ for patch@linaro.org; Fri, 15 May 2020 10:45:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZZ-0002TS-0Y for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:25 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZW-0000zt-8l for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:24 -0400 Received: by mail-wr1-x42f.google.com with SMTP id k13so1752012wrx.3 for ; Fri, 15 May 2020 07:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tQttWf6rj7Sr02MvNzPrzDKjaidbgt9rChCOOlqQ7tY=; b=h3YvXUcey3SwVJH3uSvxflWNCFYtighn8umzhlgeM3Ygr38zm0QgbfA1BGEJ3syD3f kVPGwNuKD/68h0A1g/tUyYIJaRJ1AooXFvTJ1GydvZqC8ijDm03Qa/Bj/5owMUxS2OD8 7je+2tv+dwFbp+DG4Z+57+rH3KRYPnnxJHxLHmpatEQ3xUfKitX2bLMRyynof1Yec7Bo VFbXDx9XFEmt2/Z+Itqz1VFcCyV/36SIulZa5X50WDwAwBNgPcs6/Y8jYMVP0qbC/EIA Tss28nl0E3yKCTiYHJV8AeC58Ui7xVHd+Ks11+ygdr+O2F66rZjrZM/5jtj4htnPGgbc xgwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tQttWf6rj7Sr02MvNzPrzDKjaidbgt9rChCOOlqQ7tY=; b=eh19SkChZ2rDIuU7egGOQ8IMU1oll2mrRqeBbnlRoXmKuEzpKYcl4UIZygJoAxjvau dGftoBX5C/8iJvrq/GGT5glGi1/K4s/Nj1EdokKHOuF7lVvrVrqFMCQI+ZxMfBN9x4eU wbk5B75s0VytaSPDgCsPXW2worHMRKgVC2a8B0JtvNVLf4lY0cPUiN/bRdSem5b5z5v1 gN/JDO5cGvmMqc5ag35LoQOhOd5uzXKEYXjDL4aIPDe1BXkorV4C4rRJ037BPKxEX5aK fxj1vQfVxdUorldAbRPxBdu3B3+lIfm8ylNcG0AhAHi4zDQoDEsn87zmZXQCgCzL4JOy PetA== X-Gm-Message-State: AOAM531tnITXCBbngRCsQL1gy6Knx1/exUVCQMEvDWHMd8J2xdYRIODm Fkby5itvu5Rfc8rKOVkJfoGQcw== X-Received: by 2002:adf:c414:: with SMTP id v20mr4447467wrf.379.1589553859815; Fri, 15 May 2020 07:44:19 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m23sm3950760wmg.45.2020.05.15.07.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 326A91FF9A; Fri, 15 May 2020 15:44:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 11/13] qemu/plugin: Move !CONFIG_PLUGIN stubs altogether Date: Fri, 15 May 2020 15:44:03 +0100 Message-Id: <20200515144405.20580-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: "Emilio G . Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Simplify the ifdef'ry by moving all stubs together. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Emilio G. Cota Signed-off-by: Alex Bennée Message-Id: <20200510171119.20827-3-f4bug@amsat.org> Message-Id: <20200513173200.11830-3-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index e45f950fe36..ab790ad105c 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -46,22 +46,6 @@ static inline void qemu_plugin_add_opts(void) void qemu_plugin_opt_parse(const char *optarg, QemuPluginList *head); int qemu_plugin_load_list(QemuPluginList *head); -#else /* !CONFIG_PLUGIN */ -static inline void qemu_plugin_add_opts(void) -{ } - -static inline void qemu_plugin_opt_parse(const char *optarg, - QemuPluginList *head) -{ - error_report("plugin interface not enabled in this build"); - exit(1); -} - -static inline int qemu_plugin_load_list(QemuPluginList *head) -{ - return 0; -} -#endif /* !CONFIG_PLUGIN */ union qemu_plugin_cb_sig { qemu_plugin_simple_cb_t simple; @@ -182,8 +166,6 @@ struct qemu_plugin_insn *qemu_plugin_tb_insn_get(struct qemu_plugin_tb *tb) return insn; } -#ifdef CONFIG_PLUGIN - void qemu_plugin_vcpu_init_hook(CPUState *cpu); void qemu_plugin_vcpu_exit_hook(CPUState *cpu); void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb); @@ -207,6 +189,21 @@ void qemu_plugin_disable_mem_helpers(CPUState *cpu); #else /* !CONFIG_PLUGIN */ +static inline void qemu_plugin_add_opts(void) +{ } + +static inline void qemu_plugin_opt_parse(const char *optarg, + QemuPluginList *head) +{ + error_report("plugin interface not enabled in this build"); + exit(1); +} + +static inline int qemu_plugin_load_list(QemuPluginList *head) +{ + return 0; +} + static inline void qemu_plugin_vcpu_init_hook(CPUState *cpu) { } From patchwork Fri May 15 14:44:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186854 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp506915ilb; Fri, 15 May 2020 07:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIgm281t9t+wQsXz9ACGCMO2M7r4KN93XfuxiSWjmxfAVzdKemefHG8fUIjTO4X00m54FG X-Received: by 2002:a0c:8262:: with SMTP id h89mr3654154qva.173.1589554486864; Fri, 15 May 2020 07:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554486; cv=none; d=google.com; s=arc-20160816; b=VpBaNmD00FjnDqNrB4xu6EeCJkyrEUCHUGkKke4IQK6XUzvYdaGIdqE1dfI5qlFcs+ UkByFaugTHuI9RZbsJhHhwyWxZuzCItUffBBXu6N4RdvUEAC1BxCZnwlIPHPtyUL7UCd HOQyGvL9L5wh9m47F2Pg0CrRKI+CVLa19bUNX8wUBtlm7BB2jQFzTb7c8uWg0hNpBmPq DbhLLEYdze+PiF1tCPTyhRnO59miEHehi4PqNKtLlIXdl0Gag7fWCiLYs8fJ9m7J9XzX x+fpI8oQykO6Jc6xYMW8uZuGMf16J/vZHHAggvKJdXDqFUAKC17Ltr1wZ/2LaNrh1k/Y sHbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kKMoxXAM7m/jF9QY7qqcaTZMK0m+l3vXAyXZXTtWXsI=; b=GzDhSe0MBGkDSjQjixWQ7DPc/v43EzJ7W0PAoUxGEeVFSVuSjqwixkeyn3OV8iAlyB lYblOgDhsW7rjh83fmfRwsdtrLsV4bMzzAz/TPX+RMHGGbto7ug9aomOJd36w6+A7XIa ccUwriy3fJyhKKRVU9fA5yssKvWsTvQ/nKiWSQwy5Xlgis7W5DOvxwdhW0nA6gYDORvF 7evpOBoVqDEBmuKVJxlhpbAUpMpTfdl4cqHwvrzkaZIplk6UYizln4yCSUYDJHMrbHzx HtHIjpRFJ9GBTT/oN8cLgoV08A5TCKq+4jjinASry4CtMcxU7vVXwl9UQNIFOsnmgjrk xqvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=icIXrHxr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y57si1334178qth.248.2020.05.15.07.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=icIXrHxr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbja-0001Id-Dv for patch@linaro.org; Fri, 15 May 2020 10:54:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbfe-0003m3-Pf for qemu-devel@nongnu.org; Fri, 15 May 2020 10:50:42 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:40678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbfd-0002NS-Fh for qemu-devel@nongnu.org; Fri, 15 May 2020 10:50:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id u16so2967940wmc.5 for ; Fri, 15 May 2020 07:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kKMoxXAM7m/jF9QY7qqcaTZMK0m+l3vXAyXZXTtWXsI=; b=icIXrHxronYe/OpJ1UDOT+R3rBTwR7CYroDGueLRQMp7wTN+XJDVsYRG5vLRUQ9X1t wB3QK3ZjFN3ONBHMruFWpGXyEPQoT8gnWTPDujzTu4+Rb/zA3E6aq5/pWrPHfXdhZEZC 2tc58yNDJhCL+WeSGE2zs51uyLjboFADHHsh4ddO6R2ZPzD1+q1TbR/aYU/1MKQDCFAA HpnJB5kg4L0/JNPbBeyFIsznkBuONdAKC92XeLe/YYZSbFtiUaF7ZZMbmptZRNS43vCc B9LglIOqiNSutl1wHRIK4wF9L+5bMP/WuRVmdACAF2vzM4jHjFFuX7QXTByBmVkTUVqa bnxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kKMoxXAM7m/jF9QY7qqcaTZMK0m+l3vXAyXZXTtWXsI=; b=c9D+V5YFTuUaDqeaLoGI5pcupQ/V9XFkozkTgI9CZmmdWBB29Cf/utJHeXY5w46gd/ LIP325LfPuCYK7xQlgYjX61o1LB2moKbWXVNkbE1gBKuvrQkdChgU6GcB2C8Fyy/9A/Y KnPtCTxJpVMw4zxY36WfZGFqMjbGSPvVc6VcsZuJoBVs4tK2rtHGNHkHgbhcDji+Es39 Vbdzzl+jSI46a0FDPwib0hp8ssLF79txSjdVYlDTRxRivOsKN1WcFDayBH49Pnsw6MMv 9qK/rUrMEKabbwPagtQp0r0458iGlRIXtYhlESO7Wec5wRwmkDhklbOsrBu6N+TIvzX8 cwPg== X-Gm-Message-State: AOAM532P6YptU4UvGryWiGusIQ//vDtmUTcFOkB+GbeqaU1idZifatPP CmDKgX+jmnC7+PV83O8wxVrvZQ== X-Received: by 2002:a7b:c2a9:: with SMTP id c9mr4409414wmk.8.1589554239941; Fri, 15 May 2020 07:50:39 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h74sm4122337wrh.76.2020.05.15.07.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:50:38 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 47DBB1FF9B; Fri, 15 May 2020 15:44:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 12/13] qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const Date: Fri, 15 May 2020 15:44:04 +0100 Message-Id: <20200515144405.20580-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: "Emilio G . Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Rename qemu_plugin_hwaddr_is_io() address argument 'haddr' similarly to qemu_plugin_hwaddr_device_offset(), and make it const. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Emilio G. Cota Signed-off-by: Alex Bennée Message-Id: <20200510171119.20827-4-f4bug@amsat.org> Message-Id: <20200513173200.11830-4-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 5502e112c81..89ed579f559 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -331,7 +331,7 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info, * to return information about it. For non-IO accesses the device * offset will be into the appropriate block of RAM. */ -bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr); +bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr); uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr); typedef void diff --git a/plugins/api.c b/plugins/api.c index 53c8a735823..bbdc5a4eb46 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -275,10 +275,10 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info, } #endif -bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr) +bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr) { #ifdef CONFIG_SOFTMMU - return hwaddr->is_io; + return haddr->is_io; #else return false; #endif From patchwork Fri May 15 14:44:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 186853 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp506321ilb; Fri, 15 May 2020 07:53:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMAKXkIO0wlXKeKr4tYWsUuKorap40RJ7HClprBHD3fgBJheVofj2dFZ6CP8b+HuzfYBj7 X-Received: by 2002:a0c:f1d1:: with SMTP id u17mr3908863qvl.146.1589554437641; Fri, 15 May 2020 07:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589554437; cv=none; d=google.com; s=arc-20160816; b=oiy0TdfmuSsHnaTa4XkICuMjNUwsRnCUua+qt6NEBSWZfGLq4xFivq51iirm27rE5E /WY1SPDgGpu4lcN/DGGl8qFq6STMlZ6IEWHY7QUHByBpNfC474NP9AiJjS59cIcohbrY nt5TYonncEy/wOqduQQeNodw3GRmbx8t+0dNJYPEsfMACWFbfrsohr7NPYoBJTfbCAaR K05qPi59fFEv0zxErYvrdJ0qdZpcXDXRsXXFRsTJdtMIiEh60vxjnoXPmQrytzx/gXju UB3BjIGloCQg6KtJB+crfZ9taO7PQ1LzlKYbvm5cjoBQaU9DNH0cFD4ZfB1mrnXpvFe1 hl1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KIiMOFkFR1RmW/iOKb+Q1Re9AaDQXvi4+44fXAW725w=; b=B4UKdDUi6qLYEO5bM+WiyKw/9juwQ+mHcCS9wDzeectps93fECivOdao17eMNY5iLh 2pp5Kbns9G5sDZUUlFcuDSw0iu4QsB4az1MvzdfNybmra2NxHKBDPcs6iWLSHIuLF/et Ck5G0NFB/TXvmGTRIANXlHrjDXEWCrtKdhtZDk4dHik+BVqhpnskpuSFFJiRuSTsRSTs GUYx52e0PcLMrY3mLTNkBiDaFhKwTaClzBW7ngJkYMGbSo4/xKOCmLtasSAoM/C2cI/7 2UfzbiTb/3vONFbQTToymPkpXEu3Ud7VpzsomP+gWxVt/eaDWd7jv+rsKMMr0cLClnFc kUvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iVrCgyth; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v7si1158548qkg.356.2020.05.15.07.53.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 May 2020 07:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iVrCgyth; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZbin-0007hC-7h for patch@linaro.org; Fri, 15 May 2020 10:53:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZbZZ-0002TX-1o for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:25 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:36942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZbZY-00010f-0P for qemu-devel@nongnu.org; Fri, 15 May 2020 10:44:24 -0400 Received: by mail-wm1-x32d.google.com with SMTP id z72so2963894wmc.2 for ; Fri, 15 May 2020 07:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KIiMOFkFR1RmW/iOKb+Q1Re9AaDQXvi4+44fXAW725w=; b=iVrCgythiyjZNR1VRaz5Jvueln1XQIX7WFkM9j7/WxnYDCzIyjsSHZOSEXcQ2jsqyZ cIgYsyd+MZpDLWSVPj7SZWu1LHh7X6HaqzS3kF5NGg9zuXEcIqk/GX9Xrj/dk5h4CwlH BvWSKaoCgz/uG5Ep+lIMkddx2Ki8r23C3voClnzujhD7K7voo3uWH78EiJYpj8kQPNlM tV16RdiLSpbbY+IzVxk6UppQmJyl/8F7sb+Ksk8rUQ+Z0yEVHKlUyz2DKJuWEPYzqGEg 3ASke35YK6ferGGN2OW/yelPayqeixI4vTk9kSfWnjm4J4E5pJwMsbxf2OFg7D/mpTHO /QWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KIiMOFkFR1RmW/iOKb+Q1Re9AaDQXvi4+44fXAW725w=; b=moZCMAUfZP1DUflWw61VYUmZAmKDvt7hbLU/K3DFpGmkEF6CKK0+/7YaIEyNpo76Cj wvHMJhWjiCiMW9XeISF49mIrhtGTvJerEl3VLgd2TmhYtmMz7tgSMA/a7Kf/SSGMbBof 1mjEsMLsztZF1Vf0MUu0vHS4s4S2npLEGz7NW3tmOZk5gOVpje39H/75ZB0NrdsimV4w 0UyOfVKygeg32kFmGFnq9Ti+Mys1nNWiRnu1llwxspwzg3qpbb435tNOl5Ybod+gHO84 SWEgTUqSAjiDBKEYnlzzLApejUTvfoWaB2hcyHy76/+ZclAdtLIHAnckvlNqMB3QnHBH OZXQ== X-Gm-Message-State: AOAM530o262C+cp8hWkXNs5vFovWC5a07ZqcLNWPJ9hxgnp1FUGKi8MC LbVMviRzmMM1k36owVaO8xbm7A== X-Received: by 2002:a1c:1b44:: with SMTP id b65mr4550513wmb.181.1589553862523; Fri, 15 May 2020 07:44:22 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z124sm2598547wmg.20.2020.05.15.07.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:44:20 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5C1E81FF9C; Fri, 15 May 2020 15:44:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 13/13] MAINTAINERS: update the orphaned cpus-common.c file Date: Fri, 15 May 2020 15:44:05 +0100 Message-Id: <20200515144405.20580-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515144405.20580-1-alex.bennee@linaro.org> References: <20200515144405.20580-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We forgot to update MAINTAINERS when this code was re-factored. Fixes: 267f685b8b Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200513173200.11830-5-alex.bennee@linaro.org> -- 2.20.1 diff --git a/MAINTAINERS b/MAINTAINERS index f02e2907023..47ef3139e6d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -115,6 +115,7 @@ M: Richard Henderson R: Paolo Bonzini S: Maintained F: cpus.c +F: cpus-common.c F: exec.c F: accel/tcg/ F: accel/stubs/tcg-stub.c