From patchwork Wed Aug 5 18:12:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247463 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp762219ilo; Wed, 5 Aug 2020 11:24:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0AeIpPpIzLQFFd7C4BQvIFsMgWYr/wG3wzDF8EMjujwVWY1pbHmS3mRBRebZoWNUb7Ezy X-Received: by 2002:a25:138a:: with SMTP id 132mr6728627ybt.334.1596651846292; Wed, 05 Aug 2020 11:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651846; cv=none; d=google.com; s=arc-20160816; b=JKmvwsAZOgqG6fZN6Xy9THnWX7CQEAfATGaqadFlu62k5Ujl1Zm1VQMHVPIzUSqFEP vGjLaH4uSOV32ZazFe1p0jim8xCmvQa3jpjQfVel/SnVcRrrmrQrR35CtW7EUqFOyLoa LLrZ1dO/D/2/1705qZU2tPybc6b9fMs6JiyfZVhAqtSvVE8/wf/clb4PRsfnFAgK6gYb cVvqjJUhubULvEWr3Mnp1x9JjlaLmKYJRB/fl7qd1II+gicYhpJsIJNdmM8mmEQo88UN HCd0CKt6GvoIZKmG+uuZYSNGlfTdYVmup1yU+sKC0d4c7eFPCfNP/CIfqSX3LYMqWFfl uIng== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=7mh5d9hE+bxonA2bwtaQKP+LmgXiTqiWTHlCBZ977OU=; b=HsMQEKc+6IOSerJC6qeqcm3w0m6iqHMgsFMyksCuHrV5QTtKKghaLkW8h3rq60tv6a W2Z4A9Kc6ZMaiddL1h8rM+3rrMiqINYMYXrTNKMuKZwZmQvpiu+jcQ4x+fdiIAEmNiRt v4MgWbbkGXbZbiSYCuQt0GmOGtlKpt7tjTvTR7OKPs4MTCEZCIGgux/0zmPyM8g/+4Xa m7Jf8GhKSqXKYH2ufkVUbQriPrd57Qaevd7KWJAMGAkacRitqMOkgWSI1HwpzbwTFBGS 4PZzjD6NeSd6Hx3ohtlqWIRR24J2C/jKxwbuBVhH26h0ZCpXQwvXuw0D7j0lFEpbIBUf XQUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="SQMq/9we"; 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 w14si3434559ybt.100.2020.08.05.11.24.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:24:06 -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="SQMq/9we"; 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]:41826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O57-0006Ha-O0 for patch@linaro.org; Wed, 05 Aug 2020 14:24:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyf-0004AC-1Q for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:25 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:36642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyd-0006TM-1L for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:24 -0400 Received: by mail-pl1-x644.google.com with SMTP id w19so12780409plq.3 for ; Wed, 05 Aug 2020 11:17:22 -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; bh=7mh5d9hE+bxonA2bwtaQKP+LmgXiTqiWTHlCBZ977OU=; b=SQMq/9we4q+19/caWZFngtndjaN0uOziOTM4wIAbC/vnTqznC1Y3Gu/CGYE8A0GMqr NHEEPK+UnbNGEJgzFYXzCrrjrNtRXcTU0vkY4voIgj2BZMWKQtOXoTdu5pKF4l4g4bmH KMg1V+4sK8VRBcK+t5+vPaT6k0Ym2u2t2H+8/Cazx2c65T+xY1z1YL2uX/UpJBzBlW4i mqeUoSg3McCf0BCSUEfRnH7FBGyVwLvtFoqQ9REFw4seq6WdwTyphGQwsWQzdXETSUwf wfkzY9cKaTqYUshbYV5SjqSRtI5vKd57gkXacfTtyqxX7qzhcstDLr/qy9moLXrekVZq Nuww== 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; bh=7mh5d9hE+bxonA2bwtaQKP+LmgXiTqiWTHlCBZ977OU=; b=JZUFpftpqNn1Kqn+4XHizndbv8SW8EqCsHJbgWkJzpz/t7TcBnxn9h4sLU/nYmjOXn RBGmU2cK+uyGvkTbdqnJpSH26tMAxBKz3ALhh+DbtOissa9lEaHqgR+DNl6Au0wTk3tf 8nY1YMu3g6gDhIKFHzEPEfcPufoqhlXPVWPumYbGgj2fVF0z3+gwipW3l1WaGt8tHA3B bQZI0+2z2KMxZN1kCBc5kR8bXJVFu1yq7p9n9kepRa9nOzSKXMHxNUtWx6xxgqJzGhyx ro1zt4Kcg+o8lSl+0K/maTcWuVaVQjlTxhkQhMRqG7Oe0/H0ilNipXm9T6pKcvHU+Jvo 7hag== X-Gm-Message-State: AOAM5336hSYjEabgPY6YCTsRl5jwdbPmwrsLlmZ7yLf3Mos8N+g66HUP +wL1KL5rVNMawROFri4I1Es/E/0IpFk= X-Received: by 2002:a17:90a:5a01:: with SMTP id b1mr4072906pjd.27.1596651441319; Wed, 05 Aug 2020 11:17:21 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:38ab:50b1:ff8a:26ef]) by smtp.gmail.com with ESMTPSA id a15sm3670196pfo.185.2020.08.05.11.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:20 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 07/21] target/i386: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:49 -0400 Message-Id: <20200805181303.7822-8-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200805181303.7822-1-robert.foley@linaro.org> References: <20200805181303.7822-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x644.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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is part of a series of changes to remove the implied BQL from the common code of cpu_handle_interrupt and cpu_handle_exception. As part of removing the implied BQL from the common code, we are pushing the BQL holding down into the per-arch implementation functions of do_interrupt and cpu_exec_interrupt. The purpose of this set of changes is to set the groundwork so that an arch could move towards removing the BQL from the cpu_handle_interrupt/exception paths. This approach was suggested by Paolo Bonzini. For reference, here are two key posts in the discussion, explaining the reasoning/benefits of this approach. https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg08731.html https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg00044.html Signed-off-by: Robert Foley --- target/i386/seg_helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index 818f65f35f..114d4a0d24 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -1284,7 +1284,7 @@ void x86_cpu_do_interrupt(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - + qemu_mutex_lock_iothread(); #if defined(CONFIG_USER_ONLY) /* if user mode only, we simulate a fake exception which will be handled outside the cpu execution @@ -1308,6 +1308,7 @@ void x86_cpu_do_interrupt(CPUState *cs) env->old_exception = -1; } #endif + qemu_mutex_unlock_iothread(); } void do_interrupt_x86_hardirq(CPUX86State *env, int intno, int is_hw) @@ -1320,9 +1321,10 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; int intno; - + qemu_mutex_lock_iothread(); interrupt_request = x86_cpu_pending_interrupt(cs, interrupt_request); if (!interrupt_request) { + qemu_mutex_unlock_iothread(); return false; } @@ -1377,6 +1379,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } /* Ensure that no TB jump will be modified as the program flow was changed. */ + qemu_mutex_unlock_iothread(); return true; }