From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231337; cv=none; d=zohomail.com; s=zohoarc; b=BXUksLtnZGeJkk81OxFrCjWz1B/eacW/P2MbZUFgAaoQ8FJ5H8g6/swZOCG17TpNnwQUCb0yxSP1efa5+Q3X0bV5tWIg7psP3JEw/WJfqktzu44Bw37Ca3ajuE/+LqBh+rv8uMzc65DEQdNhBp9Do4gb76vsXqSI3xQ8xNOFeFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231337; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dE/aepTkeWyaKeW9DSbNNJCa9P7NbA+RgibPE9dQEzk=; b=Hz3/yu4vOT3ZGHoxOUMdkdFvEmX5YZwBkRfhWoHL3eZNn5vTxK/VPrFthYBmXyLbLvP8E42qtM1/TrKjB/pterQSeRSD6jXyXylzwGa8ZsBAk527liyw8TOXCMO5zL3daXp8/YPJrg3xfwXcDAyhhZZ4Asn2sAV2LxvYs5NDZxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166023133712817.55691360180424; Thu, 11 Aug 2022 08:22:17 -0700 (PDT) Received: from localhost ([::1]:46110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMA0l-0005PY-RJ for importer@patchew.org; Thu, 11 Aug 2022 11:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tA-0005AA-0A for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:25 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:43704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9t4-0005fm-1k for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:23 -0400 Received: by mail-wr1-x432.google.com with SMTP id n4so19933084wrp.10 for ; Thu, 11 Aug 2022 08:14:16 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id e10-20020a05600c4e4a00b003a5c064717csm2454994wmq.22.2022.08.11.08.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:13 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5AD8D1FFB8; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=dE/aepTkeWyaKeW9DSbNNJCa9P7NbA+RgibPE9dQEzk=; b=aNDdNq8Sh2QFpX9tlIcaBhxLbmprD1gOwaBknKuG7qMqRK5ljpjnHxFhiDn/Ia2FEh tUyGUpSHKsB2VoBTNygKFhcRW2srWNFX8idwYPJODfyLg96dgxQa+xZmwnSjy532QXRa zDRGhRhzGWLgzizjgXLbchfoo6qiwxf8INUsPe9EY0mpOlKyXG4gzl98vsLuQbFUhC9m 3hjkAGP0bV86jpDxn4tDEWSHj1k1PYO6cLGTS3ESNpOXbG4KnWPTnNSZn7zytNrOUU/i d5P+rH7aRWaeNVpGsAy9LmxJAXKjaZ8rjTCNKMvM1nu2G7SwsucBD1CQLtx9M30dzThH lbkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=dE/aepTkeWyaKeW9DSbNNJCa9P7NbA+RgibPE9dQEzk=; b=vtoRe+RY94W/gTe5CTxWlqqQu698UI04apSp6xf2p5xt+NpS11mok/XrQoFnYYa6fx foJI577iJ20Eu6JkXNG2bp22dwbqs0FrqsyBYfB7SIkTS186HfnxZ7I64DgmCljKwV4e BU19N+x6Df6ghS+7VKON7tnmnHEeAACc4IZ0LUf5KyB2Wv00ulH9vLPqy3ZrJfH+4LzH kfXkdelUn9zuGVv5tzO/E/VLd3pHbe5UF7PqGJx2hc7eqLbdLImG94X2jupyx+RxMfXD aF1eQ8JSAyX3oIKlbkCILa2gv4Pyjy+EedgrFT1l6y/SWIq9QaPkOt3WrYtGlDZyA5XN ujcA== X-Gm-Message-State: ACgBeo2cXNMAuJjBF9iONFc+WiW0p3Np/k4DQGIEGnW6E7TBd+BtIzS3 H1sELSu+5xnyMwR7NqIp0Yr2a2NZ8Az+Qw== X-Google-Smtp-Source: AA6agR6ojNuv10uafWsnGcOALB8XBlhKNCR2mFMELK4OJicb/ZQMsS199tUhnETyFZ/raGKtTCKfdA== X-Received: by 2002:adf:f7c7:0:b0:21e:fc10:b81b with SMTP id a7-20020adff7c7000000b0021efc10b81bmr21128175wrq.51.1660230855771; Thu, 11 Aug 2022 08:14:15 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Subject: [PATCH v1 1/8] linux-user: un-parent OBJECT(cpu) when closing thread Date: Thu, 11 Aug 2022 16:14:06 +0100 Message-Id: <20220811151413.3350684-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231338964100001 While forcing the CPU to unrealize by hand does trigger the clean-up code we never fully free resources because refcount never reaches zero. This is because QOM automatically added objects without an explicit parent to /unattached/, incrementing the refcount. Instead of manually triggering unrealization just unparent the object and let the device machinery deal with that for us. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier Message-Id: <20220610143855.1211000-1-alex.bennee@linaro.org> --- v2 - move clearing of child_tidptr to before we finalise the CPU object. While ts itself can be cleared g2h needs the current CPU to resolve the address. --- linux-user/syscall.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f409121202..bfdd60136b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8594,7 +8594,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env, i= nt num, abi_long arg1, if (CPU_NEXT(first_cpu)) { TaskState *ts =3D cpu->opaque; =20 - object_property_set_bool(OBJECT(cpu), "realized", false, NULL); + if (ts->child_tidptr) { + put_user_u32(0, ts->child_tidptr); + do_sys_futex(g2h(cpu, ts->child_tidptr), + FUTEX_WAKE, INT_MAX, NULL, NULL, 0); + } + + object_unparent(OBJECT(cpu)); object_unref(OBJECT(cpu)); /* * At this point the CPU should be unrealized and removed @@ -8604,11 +8610,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, i= nt num, abi_long arg1, =20 pthread_mutex_unlock(&clone_lock); =20 - if (ts->child_tidptr) { - put_user_u32(0, ts->child_tidptr); - do_sys_futex(g2h(cpu, ts->child_tidptr), - FUTEX_WAKE, INT_MAX, NULL, NULL, 0); - } thread_cpu =3D NULL; g_free(ts); rcu_unregister_thread(); --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231341; cv=none; d=zohomail.com; s=zohoarc; b=StQ4FERhdD6Qz3SMBouI3FeWwyLw0WAz/8cBSoaYUeRZ3qyaBh/u+ZmFU1Ecrze5MsXqZ/OCyPg9YI6kx7cvuVnMwGfazlPHqgkbek7VzOLaSDPbwGbFrWLPz3D1LhrG+WFiMo/R8P7ukFrqoSDH52bxKXfADOzvgLcGA+s/g8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r439/WIT2yXmrXbhu3C3Szn53+ZncNSJ6N5enNtLdRM=; b=i5qfSogPzYSheurdbrTB6A5rRaZOE8OW73FbbAgYHmNoNkmlz6jL/Fh45l1brOWEBXnxnbNDXlrzmvWPBntQ/BylsDlP1ueY+cZasZW/Z0B97a2S/poj2JmYh2s3PDzDgEJQNQd4+qVrjnrwP8Kjr+1btJ8hgMARHPKIVN8QGfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16602313412101005.7920174815116; Thu, 11 Aug 2022 08:22:21 -0700 (PDT) Received: from localhost ([::1]:46452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMA0p-0005iu-R0 for importer@patchew.org; Thu, 11 Aug 2022 11:22:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9t9-0005A8-U5 for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:25 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:35511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9t5-0005ft-Bn for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:23 -0400 Received: by mail-wr1-x429.google.com with SMTP id bs25so3252700wrb.2 for ; Thu, 11 Aug 2022 08:14:18 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id b6-20020adfde06000000b0022069ccb6a1sm21634474wrm.94.2022.08.11.08.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 738C21FFBA; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=r439/WIT2yXmrXbhu3C3Szn53+ZncNSJ6N5enNtLdRM=; b=qhBOWzPHZ20E/P8oYJ4A9dN/hJX7DKtECEaH23/IPPm7SDqwTSOtfceAlPaOkNdLox yEWuNvzRNZqdlVaxp8WH5iFpLtD56olzZqVgZzPJyMk90blEluoqGUVzqy8jH1a9sSIY LNsArAqlbDLUzcFXvWzhuwZPppjLJ5D8Dd5fNMCpDEwj7cIrH3U2DqiveUcU7YiK0i0c PBtpTiKgCSb+MA0fkYkU1UkoMquOhN2K63XTfQhrp4366BetnWrchQoT2s90UJ13yFzt rgezt2RvgoOBkrcv7yRViJJDErwwXVOI0mQ+5LwxWmwZ+Jkf6CXuiGGkxxL8z7TYq6a0 qTqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=r439/WIT2yXmrXbhu3C3Szn53+ZncNSJ6N5enNtLdRM=; b=aQQjruasiLjo+JSnRQFspn47ziBmdE2ludHLQEXBBfcN1ucFDP1HEwv/XwyP1znCjz h9qDIN9VGjtiGNSo/y7+J4kPdb3x1jdCcxj93eweAWihGvit6pvyDdjeHxeV7nWEPgHw Byzp2IbzkMknuB5XZnZniEn0Kq0CvQ5LaFE9dGvLaq2QiwpY/Y0unoPqQB/AyI2iVdv6 IuAHIXgbYwSLQOFiAzjriWrQRFuiBLxkOJlPtz4HR0MfzL4B1o9h551k29YrS+khL0Jo afEWMdPCnmMyBbqGU6EjlWypgkg87ei74tC27Tqp12KZKBzU1LCSLGlHMOEhBkMRtgCe IOLQ== X-Gm-Message-State: ACgBeo15VBwnjZuZkUrNN5U8FeOL5IBU+qBPmLHbWRp7E7m/6F4AJFyg uUtWrc7/NvVT/mYn4/KWrxFXRA== X-Google-Smtp-Source: AA6agR4zk9hWory0PB1/8nwbfffdmIboWVeE1LbUKuLiO+IGT7/Gwowo2zarL6bZpjTh5Y1FmjogRw== X-Received: by 2002:a5d:47ca:0:b0:220:5cbc:1c59 with SMTP id o10-20020a5d47ca000000b002205cbc1c59mr20069251wrc.662.1660230858033; Thu, 11 Aug 2022 08:14:18 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Subject: [PATCH v1 2/8] cpu: cache CPUClass in CPUState for hot code paths Date: Thu, 11 Aug 2022 16:14:07 +0100 Message-Id: <20220811151413.3350684-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231342882100002 The class cast checkers are quite expensive and always on (unlike the dynamic case who's checks are gated by CONFIG_QOM_CAST_DEBUG). To avoid the overhead of repeatedly checking something which should never change we cache the CPUClass reference for use in the hot code paths. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 9 +++++++++ cpu.c | 9 ++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 500503da13..1a7e1a9380 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -51,6 +51,13 @@ typedef int (*WriteCoreDumpFunction)(const void *buf, si= ze_t size, */ #define CPU(obj) ((CPUState *)(obj)) =20 +/* + * The class checkers bring in CPU_GET_CLASS() which is potentially + * expensive given the eventual call to + * object_class_dynamic_cast_assert(). Because of this the CPUState + * has a cached value for the class in cs->cc which is set up in + * cpu_exec_realizefn() for use in hot code paths. + */ typedef struct CPUClass CPUClass; DECLARE_CLASS_CHECKERS(CPUClass, CPU, TYPE_CPU) @@ -317,6 +324,8 @@ struct qemu_work_item; struct CPUState { /*< private >*/ DeviceState parent_obj; + /* cache to avoid expensive CPU_GET_CLASS */ + CPUClass *cc; /*< public >*/ =20 int nr_cores; diff --git a/cpu.c b/cpu.c index 584ac78baf..14365e36f3 100644 --- a/cpu.c +++ b/cpu.c @@ -131,9 +131,8 @@ const VMStateDescription vmstate_cpu_common =3D { =20 void cpu_exec_realizefn(CPUState *cpu, Error **errp) { -#ifndef CONFIG_USER_ONLY - CPUClass *cc =3D CPU_GET_CLASS(cpu); -#endif + /* cache the cpu class for the hotpath */ + cpu->cc =3D CPU_GET_CLASS(cpu); =20 cpu_list_add(cpu); if (!accel_cpu_realizefn(cpu, errp)) { @@ -151,8 +150,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); } - if (cc->sysemu_ops->legacy_vmsd !=3D NULL) { - vmstate_register(NULL, cpu->cpu_index, cc->sysemu_ops->legacy_vmsd= , cpu); + if (cpu->cc->sysemu_ops->legacy_vmsd !=3D NULL) { + vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy= _vmsd, cpu); } #endif /* CONFIG_USER_ONLY */ } --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231048; cv=none; d=zohomail.com; s=zohoarc; b=lcqgBPza3e6GsTMSbpQNPmUjXzopgccKZpaCFCBSJfgYZk6JoW4xTJBkhVrjDTvYRdKIbAQwte6Mxp8uuFH6Lz3LXwDCOvoOcPLCZrT/HMr06bZzkdFi9x9KZfFoGZmoqtDWDd9NrDgLVdtQCOE1oBae97Z10ubheQMqEeke97A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231048; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mq28U3S+aorWbPhD7w2jGbd0fR6R3xwjskZSmzoaW9Y=; b=ZKCF/4TwT71BLMC7tqYd5ni1Da/lJAGq811Qtim+jXpbIFkZtNeHKtRVRspFSAEIv8NJ/6gUEWROAJJU9F1RyqRXYoOH2Zupbv4bmi2y8JZFqzAzLFDq4pMAVQJkJRJS1PFEtkAslpnpHIoI0IKO7p98I5UeHTJHw3rUXCfUy/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231048410754.0136567151598; Thu, 11 Aug 2022 08:17:28 -0700 (PDT) Received: from localhost ([::1]:38026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM9w6-00088u-7j for importer@patchew.org; Thu, 11 Aug 2022 11:17:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tA-0005A7-0u for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:25 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:44760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9t6-0005g0-GV for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:23 -0400 Received: by mail-wr1-x42a.google.com with SMTP id q30so21662015wra.11 for ; Thu, 11 Aug 2022 08:14:20 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id o15-20020adfcf0f000000b0021d6a520ce9sm19223338wrj.47.2022.08.11.08.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:15 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8A06A1FFBB; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=mq28U3S+aorWbPhD7w2jGbd0fR6R3xwjskZSmzoaW9Y=; b=i/zRjGLet1jdLxGhPKG23OM5MkOdIE3YkR+w0V3nJE9PYaljdmCoRna/6KrQPG2VB2 rOoSg9iu6GrFak9BEad+CZlNOwnKAlfwijvhPpPEx5lrCvRRjKF8PochqzwmqsyoPPiW AWzeKgVDLOdx6zY0NUpQhbJ3H7Vl42DiairRMaqrTF5bRZv/WSsX+bKPwmlLcYDzP1Qc vMtP0XuOv+BUo4N8lhJwJR3FD8sir2aKs4UDz2aFBpOm6IVE58XfKv7DJQ/we6vtMshQ bbeNOTwhv021bUUxhGv+CrRF3QKkfGJUV2PR3MEUb8gn0zNA+ydZkFGBBtAORQ5EY2TG lZsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=mq28U3S+aorWbPhD7w2jGbd0fR6R3xwjskZSmzoaW9Y=; b=gcowROsVBGrtCbUSN/rFlf4JEb+CDYW46G1HxJr6cQvHwmBJgx4wqmP4AIZoZxmsUm 8EBjWdGyqxiMeQNXesVnw44j4taHsUv+EtjB1rW0TLQd/s8VfpXlJuWRCzu3871ly3/D DaNDf6J7SLA/RaPb3l15D5GXQbh/qIGrGaPlFWp5WLb9lgdsIs9BjoKnhahblJ1+Ji7x Aieqs1a37HJqmrBhrgdQCCS8yc5ungc9DC/HvLbwPckzkkgPR2z/KDo86oqr1pbX8syh UE9bHPjc57uSaHM+/uH0Kw13VufNkADWWpbh/rrR+nNmPc6CWbqR85+K8b953KZUUTs7 Ly0g== X-Gm-Message-State: ACgBeo0tAksKeL8AG8JShnb+rEIsTrjOM9dS4Y+9AENC/3XEY8E6DHwE mN2e1BB9YVSiM10BzMHqteh/UQ== X-Google-Smtp-Source: AA6agR5EQwjVVVzYeRayhhSbcH/ChDiJtpV+rdWern872b4Zjxl+ztJ3gvtH7fe7lDBLlQ7BenIX7w== X-Received: by 2002:adf:dc87:0:b0:21e:ecad:a6bc with SMTP id r7-20020adfdc87000000b0021eecada6bcmr19884154wrj.218.1660230859198; Thu, 11 Aug 2022 08:14:19 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v1 3/8] hw/core/cpu-sysemu: used cached class in cpu_asidx_from_attrs Date: Thu, 11 Aug 2022 16:14:08 +0100 Message-Id: <20220811151413.3350684-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231049630100001 This is a heavily used function so lets avoid the cost of CPU_GET_CLASS. On the romulus-bmc run it has a modest effect: Before: 36.812 s =C2=B1 0.506 s After: 35.912 s =C2=B1 0.168 s Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/core/cpu-sysemu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 00253f8929..5eaf2e79e6 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -69,11 +69,10 @@ hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr add= r) =20 int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); int ret =3D 0; =20 - if (cc->sysemu_ops->asidx_from_attrs) { - ret =3D cc->sysemu_ops->asidx_from_attrs(cpu, attrs); + if (cpu->cc->sysemu_ops->asidx_from_attrs) { + ret =3D cpu->cc->sysemu_ops->asidx_from_attrs(cpu, attrs); assert(ret < cpu->num_ases && ret >=3D 0); } return ret; --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231052; cv=none; d=zohomail.com; s=zohoarc; b=aSpQ9RM3ush2XBtvR3ZKiVjjTCKIQPyg35YsOJ6Kv+4zYFu2qqbbIGCWqBRVk//RpfS/uhvQDljQrFCFWEoh49oCGw3rJSK7Vtx1JHUeDx6SFBuu9PTvKMSdSGRtgURE2F5xLW4PrMnnUPzVpE7fy8183TP6NxpsFB7B0Kcb9zY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231052; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=onWAhbnVy+ThaXQuHWs27Iy0XNnH2wugpFhqCGTKkg8=; b=mlBDrkezGsp2JVj09zEb7lsicki8X9Scbn4oSArmbcgnzh2OOthsjcwMXOFAXL3u50TgJYunnTpTSVxqC6uSgQxTHm2yk03iVO05Zd89hp/V3IHGpiGW2fMKWdVKrnOhuuRvVcsBQCZO8oT0vQkz+e80Vh1GJSttvZ9Kp43o3+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231052424451.2757215169404; Thu, 11 Aug 2022 08:17:32 -0700 (PDT) Received: from localhost ([::1]:38456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM9wB-0008S3-Du for importer@patchew.org; Thu, 11 Aug 2022 11:17:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9t9-0005A9-W2 for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:25 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:38870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9t7-0005gD-A7 for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:23 -0400 Received: by mail-wm1-x331.google.com with SMTP id p12-20020a7bcc8c000000b003a5360f218fso2872961wma.3 for ; Thu, 11 Aug 2022 08:14:20 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id e16-20020a5d65d0000000b0021b970a68f9sm19571421wrw.26.2022.08.11.08.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:15 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 952B11FFBC; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=onWAhbnVy+ThaXQuHWs27Iy0XNnH2wugpFhqCGTKkg8=; b=NDz44EPsPuVMVZrDjN+QIzylfhB8Fza2lKaO7WpF4RcHe5qAvvSdtfVV3JAvN2y/gR AYWpxGV+fhx947q4GqckMnbAKNOboe4OMT32XO3BhPTARfJIprGPT4gPBcj88Wf93wWI F0K8YQdjpZYbVqhGS0HAtBCBmq9NqxqtJW+6N4n7160/mjoP19F4BRrH0sYJ9c5PU9gR Zyad4/vvcuYIS09mfzg1420A4T+URaz0NFoCXH5MAxiGUGr6HMQiYCEHwae/mVPW9jPA D9BW6rTjlCb+Hc20Cj/+U8hrYbsG912DpPvMwk9o5Jbn/SzWQmYErg0Mq6j4+V2L7ODu vWLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=onWAhbnVy+ThaXQuHWs27Iy0XNnH2wugpFhqCGTKkg8=; b=aoVQ292fgLCJ02rh1IzW7gyBI1z1nF1JKr7Z7tSYiXmjhLyc6NlOg6XMb5hHs9trLj hUGB/XLkuYGTuKvROn2S751fMbi1lEnoPSadeJvB8dJmoF0ANHFHlMGQPbjOKWz17CNx V2gE1j8voHBcp+Kefg0B/78Sydq7oHBmh8jU+rD5YYB5gXA3aF2NVu3vA7I2fRYZo4oj eB/zSUFf2tootjmdksiVj5yDAb0LETl/LzHNFVw2+Qro2ikpnI0izbsbKNjhEY5j0jgy X4qeriTx9a+PB+ODoMtzTQL9VeT5zL8q1+4f02xon+snOMh5lJ2QTSQtwckAH1NPGgcp QiSg== X-Gm-Message-State: ACgBeo3vzhp2YYGExdc6ZpUyPPYsjso2OtaXGUe0kfJnAJXVQWH3g4jq srPzrQ+GyQwTvA7FEtpBRoWDgQ== X-Google-Smtp-Source: AA6agR7VYAMQ5zvnKjz5AqON44s0FePnwwjGxUEKpOwqtY+KJ9mr35WMk89uvS2j82UH3JJ0vQz0fQ== X-Received: by 2002:a1c:4c18:0:b0:3a5:3ddd:2f29 with SMTP id z24-20020a1c4c18000000b003a53ddd2f29mr5988674wmf.91.1660230859912; Thu, 11 Aug 2022 08:14:19 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini Subject: [PATCH v1 4/8] cputlb: used cached CPUClass in our hot-paths Date: Thu, 11 Aug 2022 16:14:09 +0100 Message-Id: <20220811151413.3350684-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231053582100001 Before: 35.912 s =C2=B1 0.168 s After: 35.565 s =C2=B1 0.087 s Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- accel/tcg/cputlb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index a46f3a654d..891f3f04c5 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1303,15 +1303,14 @@ static inline ram_addr_t qemu_ram_addr_from_host_no= fail(void *ptr) static void tlb_fill(CPUState *cpu, target_ulong addr, int size, MMUAccessType access_type, int mmu_idx, uintptr_t ret= addr) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); bool ok; =20 /* * This is not a probe, so only valid return is success; failure * should result in exception + longjmp to the cpu loop. */ - ok =3D cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); + ok =3D cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, + access_type, mmu_idx, false, retaddr); assert(ok); } =20 @@ -1319,9 +1318,8 @@ static inline void cpu_unaligned_access(CPUState *cpu= , vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - cc->tcg_ops->do_unaligned_access(cpu, addr, access_type, mmu_idx, reta= ddr); + cpu->cc->tcg_ops->do_unaligned_access(cpu, addr, access_type, + mmu_idx, retaddr); } =20 static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, @@ -1606,10 +1604,9 @@ static int probe_access_internal(CPUArchState *env, = target_ulong addr, if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(env, mmu_idx, index, elt_ofs, page_addr)) { CPUState *cs =3D env_cpu(env); - CPUClass *cc =3D CPU_GET_CLASS(cs); =20 - if (!cc->tcg_ops->tlb_fill(cs, addr, fault_size, access_type, - mmu_idx, nonfault, retaddr)) { + if (!cs->cc->tcg_ops->tlb_fill(cs, addr, fault_size, access_ty= pe, + mmu_idx, nonfault, retaddr)) { /* Non-faulting page table read failed. */ *phost =3D NULL; return TLB_INVALID_MASK; --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231354; cv=none; d=zohomail.com; s=zohoarc; b=eIBSzeWE6sL7ZmJYXpAmFWVvfdFuQV5bYr+ENJX1hUlyXlXMnxMwJo2g/Y2tZHhOtaMX/0wr6z8zuEzS9Cfgo9fB75JL4T41JcNCTJP21hI9yTVKKneuq+NEXfz8DvqfdRBCt67eG6gU3wb35sj5garTKiJYJc2tJPbqh5tGRHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231354; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o35sdKqtn5jbIbu1s5da6F1VZ4Qn/nY9QWiMeYkUz1s=; b=nC8+TC3HQOE2IAdKSCpDbRToR2lwkxbYigXceTHn/yRaecr/DC1EqUavNzmzEJ0+WR04jwaZ7ZPizu0jwkkYGvGyxRDGZecoN+UGsii5+OQFayNhB+60xRCRoExVg7SCiGK5V8wCIUzkfSogJlkv3Wjzn1/sZKl3XvOmcCLN51c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231354758303.90558481894254; Thu, 11 Aug 2022 08:22:34 -0700 (PDT) Received: from localhost ([::1]:47506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMA13-0006Qq-L7 for importer@patchew.org; Thu, 11 Aug 2022 11:22:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tC-0005B4-PU for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:28 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9tB-0005ix-1l for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:26 -0400 Received: by mail-wm1-x32e.google.com with SMTP id b6so9608137wmq.5 for ; Thu, 11 Aug 2022 08:14:24 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id cc11-20020a5d5c0b000000b002205ffe88edsm17062854wrb.31.2022.08.11.08.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AF27D1FFBD; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=o35sdKqtn5jbIbu1s5da6F1VZ4Qn/nY9QWiMeYkUz1s=; b=TzFWo3YL42lR8zGOdU9kRM01xNmksnY4CeY+ZNZv9F/3uPY9Pip8FUlJmrelW3+qna c7QGgv+tA2DXzXW8b3DpYj/WyzUqwVDzu5h8M0SfMk8BL9c4A7qrhRacStNtpJO/uIG9 81d3y4ZlmIB4ENsbAJcPORLY63FVNtOje6yqn4nODz2z7xpffmwWDUYyGeJtQ+LOa5Pb fXk558oKPZc6UvsoNiGv5FLPfyTG+fOhR3wjd8WWnLQqDzKGUviElDT0VooR7AXa78mI pKYMz+cxdXHqZBirUmHgE64ItZZSVVyxve/INvvi/h/ZDT3yATP3R+PbBNyT4w21tcOT GRNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=o35sdKqtn5jbIbu1s5da6F1VZ4Qn/nY9QWiMeYkUz1s=; b=lpOqnP/+aO2XT6N0AfUEn3NekvvW+hOQ1M9odQ5BK3zoyecYlF731suAJeeG1Xyt26 Mn4WjYCpta3nkDAS1f/v5hoQvoWAupQBpqKGry/FqMV6DhtUwAwccabucote36XHkvCg 3U6IWyzGsZwDNYX7zZKOi37PAGEpPkh8Xfi1ua6uRoOy4xZDVqESrHipNpxvmIABWYAR 8BB1VznBczgjYmaZYodBuLNcYGKxvgV/2VSNUbgGnxwCrPXu037eiJpLynLl6c7+YSOU Tv/EgPahSqKVJrbMmPNxB1KhbMl03aWzSnv5DT654dUyHitZWBnaYrk2E1KEbvt+NHuP HysA== X-Gm-Message-State: ACgBeo05IuAjt1GZT0dQ9Mu0WVL3Xz8pDn5/uKms2i8hb8JW20+qS4SJ DW+ONcu8uVl5BmYiRKvXyBmuk66lBjQiiQ== X-Google-Smtp-Source: AA6agR77PyVO6IcfVpv8Tfb6Z2tOSnLrRJrUw8/tUYLROz5LdgMFrm8zamOxW5fS7vO8KVQ4DSRZxQ== X-Received: by 2002:a1c:f709:0:b0:3a0:3b29:5eb2 with SMTP id v9-20020a1cf709000000b003a03b295eb2mr6082287wmh.133.1660230863593; Thu, 11 Aug 2022 08:14:23 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Alistair Francis Subject: [PATCH v1 5/8] ssi: cache SSIPeripheralClass to avoid GET_CLASS() Date: Thu, 11 Aug 2022 16:14:10 +0100 Message-Id: <20220811151413.3350684-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231356859100001 Investigating why some BMC models are so slow compared to a plain ARM virt machines I did some profiling of: ./qemu-system-arm -M romulus-bmc -nic user \ -drive file=3Dobmc-phosphor-image-romulus.static.mtd,format=3Draw,if=3Dmtd \ -nographic -serial mon:stdio And saw that object_class_dynamic_cast_assert was dominating the profile times. We have a number of cases in this model of the SSI bus. As the class is static once the object is created we just cache it and use it instead of the dynamic case macros. Profiling against: ./tests/venv/bin/avocado run \ tests/avocado/machine_aspeed.py:test_arm_ast2500_romulus_openbmc_v2_9_0 Before: 35.565 s =C2=B1 0.087 s After: 15.713 s =C2=B1 0.287 s Signed-off-by: Alex Benn=C3=A9e Cc: C=C3=A9dric Le Goater Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: C=C3=A9dric Le Goater --- v2 - split patches --- include/hw/ssi/ssi.h | 3 +++ hw/ssi/ssi.c | 18 ++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h index f411858ab0..6950f86810 100644 --- a/include/hw/ssi/ssi.h +++ b/include/hw/ssi/ssi.h @@ -59,6 +59,9 @@ struct SSIPeripheralClass { struct SSIPeripheral { DeviceState parent_obj; =20 + /* cache the class */ + SSIPeripheralClass *spc; + /* Chip select state */ bool cs; }; diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c index 003931fb50..d54a109bee 100644 --- a/hw/ssi/ssi.c +++ b/hw/ssi/ssi.c @@ -38,9 +38,8 @@ static void ssi_cs_default(void *opaque, int n, int level) bool cs =3D !!level; assert(n =3D=3D 0); if (s->cs !=3D cs) { - SSIPeripheralClass *ssc =3D SSI_PERIPHERAL_GET_CLASS(s); - if (ssc->set_cs) { - ssc->set_cs(s, cs); + if (s->spc->set_cs) { + s->spc->set_cs(s, cs); } } s->cs =3D cs; @@ -48,11 +47,11 @@ static void ssi_cs_default(void *opaque, int n, int lev= el) =20 static uint32_t ssi_transfer_raw_default(SSIPeripheral *dev, uint32_t val) { - SSIPeripheralClass *ssc =3D SSI_PERIPHERAL_GET_CLASS(dev); + SSIPeripheralClass *ssc =3D dev->spc; =20 if ((dev->cs && ssc->cs_polarity =3D=3D SSI_CS_HIGH) || - (!dev->cs && ssc->cs_polarity =3D=3D SSI_CS_LOW) || - ssc->cs_polarity =3D=3D SSI_CS_NONE) { + (!dev->cs && ssc->cs_polarity =3D=3D SSI_CS_LOW) || + ssc->cs_polarity =3D=3D SSI_CS_NONE) { return ssc->transfer(dev, val); } return 0; @@ -67,6 +66,7 @@ static void ssi_peripheral_realize(DeviceState *dev, Erro= r **errp) ssc->cs_polarity !=3D SSI_CS_NONE) { qdev_init_gpio_in_named(dev, ssi_cs_default, SSI_GPIO_CS, 1); } + s->spc =3D ssc; =20 ssc->realize(s, errp); } @@ -115,13 +115,11 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) { BusState *b =3D BUS(bus); BusChild *kid; - SSIPeripheralClass *ssc; uint32_t r =3D 0; =20 QTAILQ_FOREACH(kid, &b->children, sibling) { - SSIPeripheral *peripheral =3D SSI_PERIPHERAL(kid->child); - ssc =3D SSI_PERIPHERAL_GET_CLASS(peripheral); - r |=3D ssc->transfer_raw(peripheral, val); + SSIPeripheral *p =3D SSI_PERIPHERAL(kid->child); + r |=3D p->spc->transfer_raw(p, val); } =20 return r; --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231342; cv=none; d=zohomail.com; s=zohoarc; b=Mr2SyWFCojqLC+eO0H8DxD2Y9NYsgFLj37AVyP9kfFUb9hBqTkoFeqPPMwrLYldu/yUbP0N8R2AJmCJyOq070g57SXU/5ebXxyUSmpizQCH0de/IDMg5AYfURvJqDpTeX5HREtFhXs0m1zPyTGX15PoiIm/Na4efXntwUEpXL3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231342; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oFdZaY9ycRKP9o6Y/fbHM5Ey/fK+U1t+BkcB/gzZ+AY=; b=h1F96CfC9dXwbO0V5dgcOD5krupyDD8Ifp3jNWqyenHkzcfnuYGD/ctce8HCscjoFfQfzOJroj1BLjnRUqf88doMsbW8UOKCGU+xUZF+JzZeXdgcwb1dVvaDIobqmat0PlMVPHMALPsmpFADB7rQcwrBmNQ/tBgxf4jmG2ZbfKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231342402769.1694282335034; Thu, 11 Aug 2022 08:22:22 -0700 (PDT) Received: from localhost ([::1]:46492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMA0r-0005kd-3n for importer@patchew.org; Thu, 11 Aug 2022 11:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tB-0005B2-DV for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:28 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9t9-0005i8-UI for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:25 -0400 Received: by mail-wr1-x42d.google.com with SMTP id v3so21778262wrp.0 for ; Thu, 11 Aug 2022 08:14:23 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id v20-20020a1cf714000000b003a5125049c9sm8133809wmh.9.2022.08.11.08.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BAC031FFBE; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=oFdZaY9ycRKP9o6Y/fbHM5Ey/fK+U1t+BkcB/gzZ+AY=; b=LIlkVosDj5vsXkuJ/jgXlSRPWGfjmISvtCKGCDF5aCCjB8YVaX8o87ltppw7MzElQ2 jLDetEWRkOWpwAtWUwrehLRZtf2w5ckNz9NFZPV7pDnfVEKZx786nqQ73qRmbltUOsgg LylZW42UCwetuOKF65xgiwKr15y3A1N5+Z5qp0nMn+py1TIyTYIv4TqGKaT1nSgnv8Ex 0pgkrLq17/vu3K8qqmDyE+1hzUo4AceyN5MkHxgxHr4E2U+O26BAk5Ofen+fv2aZOum/ 9bzPMkYvZTdKg6k64SLzO+Kf6AkMvhK833MVsZBFFNMfy/KRLNfm8dX3ed/NWineCuA3 w4sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=oFdZaY9ycRKP9o6Y/fbHM5Ey/fK+U1t+BkcB/gzZ+AY=; b=Y03dL1IGautxO9RxNibTPojDNX6HCaqg4A36USOGbrSAjo3LploFblkw5iLa2HRFmA xaCnUgALzSDVx5SDQZ7FH/1/Qb5d7cZXirT5kKP0XVOKIS8I1AXQmDKsGTXdT5gHgXNZ S3kjwNm74fQyb6WCrjjDWzAQnbgjJPpecGccFBuJUlpP3NiDRHqONp305QZ11UWh7MFp IN/O4D63JQxNIJx3SR5Wo/Kr40Fu0SVeeIzKgmviRgOhCgC1XMu5fYiCOE8WFDa93Gmv axrDONe3yQyEqo5QmRiuA6/HquAgJbK+3h12dR9h8UTYPRH4s2jmF5FgOWXiYi999S4O gpMA== X-Gm-Message-State: ACgBeo3PavOV8D4vTQF8eFjPtOHlazdLtRqBZZOiQfmy7Zw9+SUJZnjQ N9Kb3GdTC04f9qljsy0sxfFApw== X-Google-Smtp-Source: AA6agR4R1EHYlv6ngQHt0a37oP013KVlSANanakaDh6Zmqs3ThDzge8j2nrOuRVLJiu2GPu0toZ3+w== X-Received: by 2002:a5d:4fcc:0:b0:21f:dd9:df09 with SMTP id h12-20020a5d4fcc000000b0021f0dd9df09mr21259260wrw.294.1660230862535; Thu, 11 Aug 2022 08:14:22 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PATCH v1 6/8] tests/avocado: add timeout to the aspeed tests Date: Thu, 11 Aug 2022 16:14:11 +0100 Message-Id: <20220811151413.3350684-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231342863100001 On some systems the test can hang. At least defining a timeout stops it from hanging forever. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/avocado/machine_aspeed.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed= .py index b4e35a3d07..c54da0fd8f 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -40,6 +40,8 @@ def test_ast1030_zephyros(self): =20 class AST2x00Machine(QemuSystemTest): =20 + timeout =3D 90 + def wait_for_console_pattern(self, success_message, vm=3DNone): wait_for_console_pattern(self, success_message, failure_message=3D'Kernel panic - not syn= cing', --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231045; cv=none; d=zohomail.com; s=zohoarc; b=a1wHedanqV7UZcd4Uzgl+uihhQmNKEt+CMhP/s1/NxAmU7kFr/Q6isWIl6mLDPW5AKK6SXLuYFM50I9s6uLE+GxDjzNtsqnTNcsrpHRhKzhxJumhDbLg2ZGLJY3tQrcMDS4bjdmqaDBKg1pxSGJMs4JzmMAGSZ8OHclPyHL8Rbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231045; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A4Im+0B8i1kKXa9xofWgQuBA5l5Ynpf3TEOMjj9zbKM=; b=jUHHAPv79l0nwKUjb2klx26wMfP7ylrDIBQMwbATciMyB2CryQ861m6om4qsCSztHS24KEZv1Pl/qyW7n5vWauX+okGxNdy3JNpRnh3xJYJItpEA5v+S/F5Pu2pgeL07eMHF7nYFVEeyAbzlenbFx+OaPnUasQCDCemDjudbikU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231045230304.58277056197267; Thu, 11 Aug 2022 08:17:25 -0700 (PDT) Received: from localhost ([::1]:37980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM9w4-00087R-4Z for importer@patchew.org; Thu, 11 Aug 2022 11:17:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tE-0005B8-Am for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:28 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9tB-0005i8-RT for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:27 -0400 Received: by mail-wr1-x42d.google.com with SMTP id v3so21778396wrp.0 for ; Thu, 11 Aug 2022 08:14:25 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id b17-20020a05600010d100b002206b4df832sm19125400wrx.110.2022.08.11.08.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:20 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D0CDB1FFBF; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=A4Im+0B8i1kKXa9xofWgQuBA5l5Ynpf3TEOMjj9zbKM=; b=BEy4XH5373rENUsQThPIfNYqgpxwBcRwvgyNj2IEZe0yCasZDq3UoDBMycqfzQhq9W 5sHQkWov7ugLSvEyHZ9qL56NNK7iRF53IIvdA3E2bh0iqleGGjN1iqHP0fi8GI7pQCii LFIGUIU1I/TCjQ9cwr0iM5+RjE0aJHzyS9HzrxFgNK0PYSiUCxSFwFPOr3xoESpbY3Y0 msZhE6QexukBqzJnDutV9zX7Z/YBpHzcA1VjPmS5YfJyf0UL94uC7jWoXPzMibzdSKre 0EKkumYTT+F2tmfp6AgIAIg7kwxk8RUTwW1S5s9cw3dddrRPVKTzs8I5JOrls2qqCsx9 LKiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=A4Im+0B8i1kKXa9xofWgQuBA5l5Ynpf3TEOMjj9zbKM=; b=26o9yYjvg266RpuNkOhN+C+8IX6ViWR4oigV2qipOPJI+CDyGiOWfnOvPNXGa8zFbj Khg+Acb56SGVtXVWtkD2AoVvC8WoO0Jm+uZ+QZ4BUzVeiZYtnCSV/Eh9vAB31+lSpV4g nBYisceoQ51CJZ39RHQkG9FAo4tQVn1YyunOmjPvErXHFVFqpUZrosMlQo4BmyukD3l3 dUXkGhRJltrbWaU/pEeHJ061+MeiSnwoo59uQvvQv5crejHnuPkbTTrD2OD72zSJpQCw Oqi5MPtz6i58g31sR/L2WjAvASFyaguyzeNzAE8HsSzBu3vj0pDGAWg2xEKWvha19xMu /dAA== X-Gm-Message-State: ACgBeo1+nTNJzJeVt+onine1k0CuBsZEGImd8vSHTBQPoqRGoxVpy+c+ 9DM3UjY8VaqvJGwgaCuagB6ZSRsq3gAqCw== X-Google-Smtp-Source: AA6agR4gIa16Ox2zmOy02kBBun+A2J1JHm3nkt6wlxjTKyxYYek5WWJK+JkHuOXOz52rhFai60gjKQ== X-Received: by 2002:a05:6000:381:b0:221:7507:bb24 with SMTP id u1-20020a056000038100b002217507bb24mr18164061wrf.373.1660230865189; Thu, 11 Aug 2022 08:14:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Snow , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PATCH v1 7/8] tests/avocado: apply a band aid to aspeed-evb login Date: Thu, 11 Aug 2022 16:14:12 +0100 Message-Id: <20220811151413.3350684-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231045955100001 This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: C=C3=A9dric Le Goater Acked-by: John Snow --- tests/avocado/machine_aspeed.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed= .py index c54da0fd8f..65d38f4efa 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_= id): self.wait_for_console_pattern('Starting kernel ...') self.wait_for_console_pattern('Booting Linux on physical CPU ' + c= pu_id) self.wait_for_console_pattern('lease of 10.0.2.15') + # the line before login: self.wait_for_console_pattern('Aspeed EVB') + time.sleep(0.1) exec_command(self, 'root') time.sleep(0.1) =20 --=20 2.30.2 From nobody Mon Apr 29 16:25:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660231456; cv=none; d=zohomail.com; s=zohoarc; b=MbkPhqkIa1lLEYwaY6mQwhkvD47AXHesx9XZBAsVfe3pJ1lxe8S1tys5EcO7KcJgvW0M1PK7uYxzruDBpkPQ4aTmG8LIqnIpZVQ5N6rrQkgCUxmtLZWOKePoUF52A1gumXfDCSPcDWb42AjdRERlgquEGvigO+6F5IoENKUOvhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660231456; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3mcreeC7sB94QXrxXmku0iTtPiRjYMbQWc4z8QaguNY=; b=POSyGEpvvR2YBWI5JSrcK4MLEVmQc0+brE8me7oTz8mowkCJghVi56xwdzGcVniubdfjsnw6ot/PWTCMn5P4Vii6DWEGwZtTx2c8Vbu9zvEhpHCnW5MrOJww6P3v8PATLTxtedn3UYvM7GkB5kZ6xl36HFMnaMkR0bniqEbuyRg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660231456287325.6528783106137; Thu, 11 Aug 2022 08:24:16 -0700 (PDT) Received: from localhost ([::1]:54026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMA2h-0002UJ-6r for importer@patchew.org; Thu, 11 Aug 2022 11:24:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM9tD-0005B5-D9 for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:28 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oM9tB-0005iz-DV for qemu-devel@nongnu.org; Thu, 11 Aug 2022 11:14:27 -0400 Received: by mail-wr1-x42f.google.com with SMTP id z12so21692340wrs.9 for ; Thu, 11 Aug 2022 08:14:25 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id p1-20020a5d48c1000000b0021e6277bc50sm23336426wrs.36.2022.08.11.08.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 08:14:20 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E33041FFC0; Thu, 11 Aug 2022 16:14:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=3mcreeC7sB94QXrxXmku0iTtPiRjYMbQWc4z8QaguNY=; b=yHxUCasXgroZKJs3i9Y1TBMetLE6YWRyrLgxgjQo2oXorsbbbS/E/QmbwoWUtdQV9V zKcgzRu0QJJoydWLWi3B4K5A6EhedWqn2dzZ44dEoKZveyN7+nF6MzybSEG3w2sb6BTM 8xt6Lk2AosqBnPqkVCHj7GWP3Dh9AP1xrXv3PnyNbCZSEGojnx77DOVVwALuy5BYV0Si 4y3jaSfo1oDIaIaTfnh1eTxoSKxNzUOnylE7EawdLeX+LbmMS2+5YeET7x116P/CsC4h Y2EXVsH1ReWLOYnPvyKYYmF3ncGs798W4Rx99j/ra9kCkKeHoeXbOdDxA5YRzlMWYTRO 0+mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=3mcreeC7sB94QXrxXmku0iTtPiRjYMbQWc4z8QaguNY=; b=X56keMO8ADPSbGYvCs3rUgNQ7+Cfc//rmvxSTqzHDknnK5zgWosDl15CEbuwFEzRPr 4pWKo/2Hv+cvKN2Nkfl/KfuMRXtcgxybK6hntt75fbZpg0yhaTW17UnRUFXduUe/dFeE CjqIYAaW4GRgYuaNZ7hm6Jf1T7Pw54MOZ4qsDjC5HLA7KQgiDoTboK7sMns3C67WoNXq 1SqAOZn6HkaiBoKVHZJmSeexc4X97c9EviH8IfgdK92bROrll5lUGkXMHBZbjn3xW3YW kBDHMiHQUl6+hBo9PvIm3PN6y1IWnTVGsHpiquGZ8n7RBvu8efmFO9btouXiu/OtWKcY P8kw== X-Gm-Message-State: ACgBeo3tQMG8IunZzrqH8DFZGNvyyKSHaiEZfyUaAUSxXjYijMs5VOMg CEG934h77yfdGkV0SX/0loGIxA== X-Google-Smtp-Source: AA6agR5qZQz1pVURpCavkr4xp9f9NhPl4ouClcApm3vrXUNTzlDgplmfIMiSb3pX801dn49c3vmyXg== X-Received: by 2002:a05:6000:184d:b0:220:8235:132 with SMTP id c13-20020a056000184d00b0022082350132mr20671192wri.178.1660230864067; Thu, 11 Aug 2022 08:14:24 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini Subject: [PATCH v1 8/8] accel/tcg: remove trace_vcpu_dstate TB checking Date: Thu, 11 Aug 2022 16:14:13 +0100 Message-Id: <20220811151413.3350684-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org> References: <20220811151413.3350684-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660231457426100001 We removed the ability to do vcpu tcg tracing between: d9a6bad542 (docs: remove references to TCG tracing) and 126d4123c5 (tracing: excise the tcg related from tracetool) but missed a bunch of other code. Lets continue the clean-up by removing the extra field from tb_hash saving us 4 bytes per-TB and the additional cost of hashing/checking something that was always empty anyway. There remain some per-vcpu trace points which don't look as though they are called anywhere and the command line/QMP machinery to clean-up. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/tb-hash.h | 6 +++--- include/exec/exec-all.h | 3 --- accel/tcg/cpu-exec.c | 6 +----- accel/tcg/translate-all.c | 13 ++----------- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/accel/tcg/tb-hash.h b/accel/tcg/tb-hash.h index 0a273d9605..d58115ee70 100644 --- a/accel/tcg/tb-hash.h +++ b/accel/tcg/tb-hash.h @@ -60,10 +60,10 @@ static inline unsigned int tb_jmp_cache_hash_func(targe= t_ulong pc) #endif /* CONFIG_SOFTMMU */ =20 static inline -uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t fl= ags, - uint32_t cf_mask, uint32_t trace_vcpu_dstate) +uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, + uint32_t flags, uint32_t cf_mask) { - return qemu_xxhash7(phys_pc, pc, flags, cf_mask, trace_vcpu_dstate); + return qemu_xxhash6(phys_pc, pc, flags, cf_mask); } =20 #endif diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 311e5fb422..21469da064 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -479,9 +479,6 @@ struct TranslationBlock { #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 =20 - /* Per-vCPU dynamic tracing state used to generate this TB */ - uint32_t trace_vcpu_dstate; - /* * Above fields used for comparing */ diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index a565a3f8ec..86f0276b1d 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -188,7 +188,6 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu= , target_ulong pc, tb->pc =3D=3D pc && tb->cs_base =3D=3D cs_base && tb->flags =3D=3D flags && - tb->trace_vcpu_dstate =3D=3D *cpu->trace_dstate && tb_cflags(tb) =3D=3D cflags)) { return tb; } @@ -494,7 +493,6 @@ struct tb_desc { tb_page_addr_t phys_page1; uint32_t flags; uint32_t cflags; - uint32_t trace_vcpu_dstate; }; =20 static bool tb_lookup_cmp(const void *p, const void *d) @@ -506,7 +504,6 @@ static bool tb_lookup_cmp(const void *p, const void *d) tb->page_addr[0] =3D=3D desc->phys_page1 && tb->cs_base =3D=3D desc->cs_base && tb->flags =3D=3D desc->flags && - tb->trace_vcpu_dstate =3D=3D desc->trace_vcpu_dstate && tb_cflags(tb) =3D=3D desc->cflags) { /* check next page if needed */ if (tb->page_addr[1] =3D=3D -1) { @@ -537,14 +534,13 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, tar= get_ulong pc, desc.cs_base =3D cs_base; desc.flags =3D flags; desc.cflags =3D cflags; - desc.trace_vcpu_dstate =3D *cpu->trace_dstate; desc.pc =3D pc; phys_pc =3D get_page_addr_code(desc.env, pc); if (phys_pc =3D=3D -1) { return NULL; } desc.phys_page1 =3D phys_pc & TARGET_PAGE_MASK; - h =3D tb_hash_func(phys_pc, pc, flags, cflags, *cpu->trace_dstate); + h =3D tb_hash_func(phys_pc, pc, flags, cflags); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); } =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index ef62a199c7..ce05cb4103 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -197,11 +197,6 @@ struct page_collection { #define V_L2_BITS 10 #define V_L2_SIZE (1 << V_L2_BITS) =20 -/* Make sure all possible CPU event bits fit in tb->trace_vcpu_dstate */ -QEMU_BUILD_BUG_ON(CPU_TRACE_DSTATE_MAX_EVENTS > - sizeof_field(TranslationBlock, trace_vcpu_dstate) - * BITS_PER_BYTE); - /* * L1 Mapping properties */ @@ -894,7 +889,6 @@ static bool tb_cmp(const void *ap, const void *bp) a->cs_base =3D=3D b->cs_base && a->flags =3D=3D b->flags && (tb_cflags(a) & ~CF_INVALID) =3D=3D (tb_cflags(b) & ~CF_INVALID) && - a->trace_vcpu_dstate =3D=3D b->trace_vcpu_dstate && a->page_addr[0] =3D=3D b->page_addr[0] && a->page_addr[1] =3D=3D b->page_addr[1]; } @@ -1186,8 +1180,7 @@ static void do_tb_phys_invalidate(TranslationBlock *t= b, bool rm_from_page_list) =20 /* remove the TB from the hash list */ phys_pc =3D tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); - h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, orig_cflags, - tb->trace_vcpu_dstate); + h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, orig_cflags); if (!qht_remove(&tb_ctx.htable, tb, h)) { return; } @@ -1349,8 +1342,7 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t phy= s_pc, } =20 /* add in the hash table */ - h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags, - tb->trace_vcpu_dstate); + h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags); qht_insert(&tb_ctx.htable, tb, h, &existing_tb); =20 /* remove TB from the page(s) if we couldn't insert it */ @@ -1426,7 +1418,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cs_base =3D cs_base; tb->flags =3D flags; tb->cflags =3D cflags; - tb->trace_vcpu_dstate =3D *cpu->trace_dstate; tcg_ctx->tb_cflags =3D cflags; tb_overflow: =20 --=20 2.30.2