From patchwork Wed Aug 5 18:12:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247468 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp764646ilo; Wed, 5 Aug 2020 11:27:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN+TMeruj77zctInQZ1xZpCA4xLqySwcdxCN4dNBK+/pxxHclSYKQGwB3f9ZZYfrnQuMhv X-Received: by 2002:a25:40c8:: with SMTP id n191mr6535351yba.436.1596652070659; Wed, 05 Aug 2020 11:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596652070; cv=none; d=google.com; s=arc-20160816; b=SEjXn1SpU21p9XtHAgEFUzJCuKNEXjuOMfguQWmhhgGuCnRlvFEaPbjinxpoK9w0Xb Xo02i8Q87ORms2EExBaIjx6SC0RvWBhhq6YKW7CqAtHLLwjd3phpWrfb9UxO1wNdW50Q IFmEhjDbTd8VQ7VtuVKluzp/ZLuxZ65FOtlNqPWjWTQfU4Um1WqdmXSzZD8esqsTtdC3 kljwqPvksxhS9aQ9Ku2unG0o3CqR6HyXbwC7VMjOYE4zpVntR5qzCycW2xC/ptNDvb5f 32TvKesyEYQ+Kk2svqcIWzyO2NlaITYRczmu1JEMru6Bx5Yn0XfwxcWAzkakvw7O0/L7 pCTg== 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=WMl3AIWSt1TrS8ub7e6y3EFYj5c+15bBo75uZcYRAVU=; b=k0tXNx8wtmbnGlurs7kst60jPlUBrlRUPwTYFIKz+i3+IbOc0JXIafUoUmoR2hRuHo z/yps4DvOidxDTGQOyHN8g/H2s9EGJZ9sjq7HRd/nA6yRlSavv+YPDCCyf4QTmxuf/R8 Q9n5y4IyZoU2QDAd74Dk9Mo55r3O9Dlp+JXp/8bkUECmhR0bnInZy5lT1ZzbtX6RE/Vv sjq4A9pH0gNHY9/awbxzUrtndnuRZ5+UgnYFvd1BjK2hD0odOW4Rh65y/kkSn3wo+CSR V8AhaUlLaqu7DJQWKUINrMZ5qnBtGty83JynQbEScZWGxA0I5ygy+z1yN5z/DEx5nA6y 61ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sfLqYx+C; 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 y15si2413076yby.495.2020.08.05.11.27.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:27:50 -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=sfLqYx+C; 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]:55756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O8k-0003hX-6C for patch@linaro.org; Wed, 05 Aug 2020 14:27:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nz4-0004k6-2A for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:50 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:46390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nz1-0006W2-3h for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:49 -0400 Received: by mail-pf1-x442.google.com with SMTP id 74so14954298pfx.13 for ; Wed, 05 Aug 2020 11:17:46 -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=WMl3AIWSt1TrS8ub7e6y3EFYj5c+15bBo75uZcYRAVU=; b=sfLqYx+CkXOIMiam4y4J2nto/nWPmU5jv63NiJXbtzGqxWnx4fB+7shF6g9Rz13k8M fYfP76nihiooh7VefqazSomDmyeVijTSJZvlctSiEGBZp03HWfU8CKghim03v6KYlqMc fPjGzi9LIFGSFuZMXCMsNSu4KwTgwv7VIcmA3ymkqIe4n38leNb07q7YkyCyuzYayE0l WmIdT7ELxsFjXnulpdDSv+EmD9VSsJ6yk9MVcdmFCcjmedIbQKUF0jfPJdmz0vyiQQoU BUSY+y16Z4l6ZbaC16/9yqGZlnJ0UemWrj5q/Y+JFfNitXsijE50lrylaby3U6FiJL0n KuXA== 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=WMl3AIWSt1TrS8ub7e6y3EFYj5c+15bBo75uZcYRAVU=; b=ho+Uwly4co1L1sIa4rIFY183RfJJxkXLwWmK9qNz9K13wAHSd09oLeVcCDcYVCUeSN a/L3ie8sYnEvjRFRzpmBqqyFbuEoa9PJ2waLN5KE/Sfty3t17LGa5q66sJssWTQAvdIN NcrPCldY4/Buu6GdNq3FFef4yPItv6Bp0z7xzpC2Wm3wfRxIk9XPluEEnMfuTS/I7rvx +JI0mKBI0w/aiC5HTsMMkHtVsulWImKu8qwjcdr2tfqFGqhR0DCYYNNTZxf3yL+Xm0QK sCWZlKeRw3Kv0bhMJw+ikQu3l7ocFeo9THIi+cwbkXJ9LmKwSSelPFnA5f0vWrFE2yYL wDhw== X-Gm-Message-State: AOAM5339pjQllsQb/7MgdUSzf/VWumVu6qsHvPqaG/EryhiSe6Cat2Cz yvqES760o1ADlyMa0uYU5NBX2I1oBjg= X-Received: by 2002:a63:338c:: with SMTP id z134mr3990719pgz.245.1596651465440; Wed, 05 Aug 2020 11:17:45 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:44 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 17/21] target/s390x: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:59 -0400 Message-Id: <20200805181303.7822-18-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::442; envelope-from=robert.foley@linaro.org; helo=mail-pf1-x442.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: Thomas Huth , robert.foley@linaro.org, David Hildenbrand , Cornelia Huck , "open list:S390 TCG CPUs" , 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/s390x/excp_helper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index dde7afc2f0..b215b4a4a7 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -470,7 +470,10 @@ void s390_cpu_do_interrupt(CPUState *cs) S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; bool stopped = false; - + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } qemu_log_mask(CPU_LOG_INT, "%s: %d at psw=%" PRIx64 ":%" PRIx64 "\n", __func__, cs->exception_index, env->psw.mask, env->psw.addr); @@ -541,10 +544,14 @@ try_deliver: /* unhalt if we had a WAIT PSW somehwere in our injection chain */ s390_cpu_unhalt(cpu); } + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; @@ -552,10 +559,12 @@ bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (env->ex_value) { /* Execution of the target insn is indivisible from the parent EXECUTE insn. */ + qemu_mutex_unlock_iothread(); return false; } if (s390_cpu_has_int(cpu)) { s390_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } if (env->psw.mask & PSW_MASK_WAIT) { @@ -564,6 +573,7 @@ bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); } } + qemu_mutex_unlock_iothread(); return false; }