From patchwork Wed Aug 5 18:12:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247450 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp757870ilo; Wed, 5 Aug 2020 11:18:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz540fok7Vu8Rq12CiHspxJVQ5lbgr2M2XRBS2Iud6UY/Gnk0PVjhuKPWe/8ldpP+EZZM8R X-Received: by 2002:a25:505:: with SMTP id 5mr6570644ybf.98.1596651483341; Wed, 05 Aug 2020 11:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651483; cv=none; d=google.com; s=arc-20160816; b=Ud4ua8ArsCoCl+MCeLuf85P56e1eUC4OiK36G+ONSuZAqmoPaVIXsaNKZaWzOi+e9q 2lVCBWd/usZ3WXWl9edQilswVnMQEs1j8kUYgTFuFoyTHG81EHyGBbQpn1y66vTFvlhS XSMc+Jv3DKB8BEydYwbBaQwXzBtpAbcrlG/6n8rbwQxAK9usPaevO18HLSiRccc640lu y7yAY3ajEJF0RAZUld2/Hx234kpkGSzKPXngZEsgIvmLnODyODprPvopStjv+ojdqLS3 /8SffXowz1uCz3kvRADsCsxqBYwj8c8mce9v64ooVDKzUvQyK3u6g14oJmsRdSpbinql /X4A== 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=Cw3yBPmbCJhRgO2KPinIHhC/h5HD4KqFIy/v1BHn1wY=; b=Sv7izVaODeXYX2la670U9e0wWs14nFW5CLyiqQJ59XHZTmvAbHrJ6OsPxbKYzq46pe 09acWm2BvDWTnaPDFqduwMXMpR5gMxw6u2d2a2yzh8mefHeE39JULYMotd3RfEAePNAU cuWFHlZOjKwyKi0TlerC4gOAuYa7ZQ60tHJ7TeKaP6RdJIK91PCFyGK4jaZQt5+mrqo+ 4PD6UMSaJOf8kFuy+qPlQTkQJx4h1nmxX6B9WLGUKCuQYeHg5h0uFIj/rN/i4YdokeCX VziKO1L+EgOBqtoIE3XwA3mPzAvQAXGxUtj+Yn5GrmhiVqtr/5wNzLe3vz8bL1WBry3O pcOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Bhggd3ul; 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 v200si2313495ybe.91.2020.08.05.11.18.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:18:03 -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=Bhggd3ul; 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]:43128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3NzG-0003hC-PO for patch@linaro.org; Wed, 05 Aug 2020 14:18:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3NyQ-0003g1-PK for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:10 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:55414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3NyP-0006Qg-3A for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:10 -0400 Received: by mail-pj1-x1041.google.com with SMTP id 2so5004791pjx.5 for ; Wed, 05 Aug 2020 11:17: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; bh=Cw3yBPmbCJhRgO2KPinIHhC/h5HD4KqFIy/v1BHn1wY=; b=Bhggd3ulq5KNGlj9qpCKMy3jq1VNUUSfukireTCdkVoibCCIY95b4VB79aZSdtwkta IQphqe+Y8zJlBYWP8Ontj70VFnHgHVLEukWsgAuKbANEKPuqbW5Xem5jOq63FeGsImPt kwrE3vaqJfibhmU9on03gdaMugvoqLF8ndRAs0/cM26SsODxzlrEGKim/GyNwK0R0j1B Ts/yaV3Lk1BngITshCseGrUPK6qn3BWs7qNoWZk+BjIj2GMIGgUv/Bdl8b3B7N4s7C5l OZ43BmzdedN88BUQWPcyQZkp9gsgQbtfFcKfZrjXDqJYlqVOfvEtkjkb+TIqmoeAdSqM y5Aw== 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=Cw3yBPmbCJhRgO2KPinIHhC/h5HD4KqFIy/v1BHn1wY=; b=dNC+bfBlVPTPeslrjSYfM+ajoou9BS1UceSUQRWi55QebuLnArmuUBJMZQqSfX0OYE j4iktieSiWjLCwxI63wLrxQ7qQl86jGWErwMRN9HBakwfiJoEnenCyY4ufqakRcsAHtY euGe23wrGFAYMv1WgRz5NxjtqZ8BbbD2kMUCrEusf/6+hWJBLGG01W0EN2CEc7P0Z1aw uP56yUCGYggQ1JTTItm78wZXQjQ8vNHrJX+6x0UjbtKs3MuJjb9VnPa9P0bzrW96FW2x D2RpKWc/o0dEg8pjTzSl7OjVe7Jc5Skx88EYm3kLjvkvSlFTN1jxu/rTcYZNqT9AWmuV 5Z1g== X-Gm-Message-State: AOAM533l/aGQqOfmo6kJPm+LnYgDANlmA69qmT9B+nz6/+OTvYrqUN7v 2A1vQv3ZiEhwtSF0tbJ/Kfn16jvWaSY= X-Received: by 2002:a17:902:834a:: with SMTP id z10mr4382242pln.5.1596651427371; Wed, 05 Aug 2020 11:17:07 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:06 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 01/21] accel/tcg: Change interrupt/exception handling to remove implied BQL Date: Wed, 5 Aug 2020 14:12:43 -0400 Message-Id: <20200805181303.7822-2-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::1041; envelope-from=robert.foley@linaro.org; helo=mail-pj1-x1041.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, 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 change removes the implied BQL from the cpu_handle_interrupt, and cpu_handle_exception paths. This BQL acquire is being pushed down into the per arch implementation. Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 80d0e649b2..8e2bfd97a1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -517,9 +517,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) #else if (replay_exception()) { CPUClass *cc = CPU_GET_CLASS(cpu); - qemu_mutex_lock_iothread(); cc->do_interrupt(cpu); - qemu_mutex_unlock_iothread(); cpu->exception_index = -1; if (unlikely(cpu->singlestep_enabled)) { @@ -558,7 +556,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (unlikely(cpu_interrupt_request(cpu))) { int interrupt_request; - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); interrupt_request = cpu_interrupt_request(cpu); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ @@ -567,7 +565,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (interrupt_request & CPU_INTERRUPT_DEBUG) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); return true; } if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) { @@ -577,13 +575,15 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); return true; } #if defined(TARGET_I386) else if (interrupt_request & CPU_INTERRUPT_INIT) { X86CPU *x86_cpu = X86_CPU(cpu); CPUArchState *env = &x86_cpu->env; + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); replay_interrupt(); cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0, 0); do_cpu_init(x86_cpu); @@ -595,7 +595,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, else if (interrupt_request & CPU_INTERRUPT_RESET) { replay_interrupt(); cpu_reset(cpu); - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); return true; } #endif @@ -604,7 +604,9 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, True when it is, and we should restart on a new TB, and via longjmp via cpu_loop_exit. */ else { + cpu_mutex_unlock(cpu); if (cc->cpu_exec_interrupt(cpu, interrupt_request)) { + cpu_mutex_lock(cpu); replay_interrupt(); /* * After processing the interrupt, ensure an EXCP_DEBUG is @@ -614,6 +616,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, cpu->exception_index = (cpu->singlestep_enabled ? EXCP_DEBUG : -1); *last_tb = NULL; + } else { + cpu_mutex_lock(cpu); } /* The target hook may have updated the 'cpu->interrupt_request'; * reload the 'interrupt_request' value */ @@ -627,7 +631,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* If we exit via cpu_loop_exit/longjmp it is reset in cpu_exec */ - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); } /* Finally, check if we need to exit to the main loop. */ @@ -691,7 +695,6 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, } #endif } - /* main execution loop */ int cpu_exec(CPUState *cpu) From patchwork Wed Aug 5 18:12:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247451 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp758048ilo; Wed, 5 Aug 2020 11:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIVSalUy8fB4RECUAGKYLVeOtYIjVtGJhSGoNGpVgHxJ6Y5Puo9hWQf5zYLaJx3/ES6Zm2 X-Received: by 2002:a25:c60b:: with SMTP id k11mr6376541ybf.482.1596651498638; Wed, 05 Aug 2020 11:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651498; cv=none; d=google.com; s=arc-20160816; b=dBjCaAJD+6gbwxSUQ802769cUFI2idxgrcEqXhI/Xx/q8PYxluqu7QLgUHyeHTUi6Z pEo2qnEp5V4mSdX8UODCekgD264RA+FZ8qeJQc+3eAMSL9oQiHYSCiwZyYh4EUlVPtdp puPwEH/wPyXYpOmSUvVnFAQplDjceOWRNwoPGGWeD+Z9EKR2pNp0K2QwdHLYnV0aOaxl Krgc3dtcXKicn/TxWU/OSa0ZJEgXFqMVoA7hbDi+2OKrJgBOeFtxL2D8Hbdkwu9wZiyl b5mpCsFWSe+UvVay2Czj6sFsZrCzz/YA+byRTrQXnSWu+9h4V+sXPI4o/GfG8LF4/rW6 F6GA== 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=4mUrzxN38KgTWVnwLLnwWRuKmcxV8e0+CR7Czj1dxnk=; b=klm48IU185FeDaORJZtnrCm74TaRxZvL8lHm4PUCs8EqpfD4qsPMqmt8y2CFgo76aI +DXsewy1Mh0gHdI2pzC2VcYdQGDRxd70XAa8LZwfg0Ixcq7AXP+z/D9/dpgbJ/xxo/GB rIrtCdBq3j+XFHKgOxiTrO17zYB9yQ/BLRef33etmkoWg+Z1fFkaLvPIQWoVjnHFu710 wgT+HWoKCdbyQmRodNwnFQo5vAlG81PAChIHBCQmqReVCOhIxYymSa48OqFsH7wC8Lpg dRxop13+aCTRfk91dncg3pVA5obdL4Ous2fR5yHthcKwollvjBoxARYntqUsImUKACA7 KyDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="h/RqssUP"; 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 s11si2393423ybi.305.2020.08.05.11.18.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:18:18 -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="h/RqssUP"; 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]:43424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3NzW-0003oo-5V for patch@linaro.org; Wed, 05 Aug 2020 14:18:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3NyU-0003ln-Ov for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:14 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:34929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3NyR-0006Rz-RP for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:14 -0400 Received: by mail-pg1-x531.google.com with SMTP id o5so6956454pgb.2 for ; Wed, 05 Aug 2020 11:17: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; bh=4mUrzxN38KgTWVnwLLnwWRuKmcxV8e0+CR7Czj1dxnk=; b=h/RqssUPjaOf96oNkU3g32Vos9LqhECbWbowgWHUFifSflEfsOn/kL93ShZCbnRynI FegZL/HBc1U88j37iHp+whCF6yPEuSytg9vaor99axMywu+MeXWi1ObiYFZ0YGeZkd79 nOGihwnRZ7qP2tvlpripBITtBEnVQQNrtQGkOv3+3XxGILeEourfAS68aVvxZHtxaV43 oVrO2P/A0g5T0tz5IAQM+1hlrMPBOjIWeOfkGCkJLQknVOAP8oJ+IlwX60LNS+N2L3c3 kk4XQNCkZ1qpKRcW0LKd4iW6TIs579ChYJFaTKTiV5M3+jzJmu2bqibBQ7b8EwjGRDtf uIWg== 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=4mUrzxN38KgTWVnwLLnwWRuKmcxV8e0+CR7Czj1dxnk=; b=NoIAWFCYabDTZTDm8yGpDLdljwcy3jxpoClq0xuKeBJs/nagAt6lzPp80A9R9oXzg5 RHTQkVwgcRRr/OouJVKqJajy6yWTB5+ZQDWPTVnyRSAi2X0Nlo+ZnQlTfczRfummrtWy x42M3zQ1UeusCMccFSsNdAY/JwOVQm7xptowRlxusyApZCjocy0+oKstIXgxB1Irpc/V kLpMogJdTywZJ4C0D8yvM+lFoGa9EQ9dVquPievwAKvcXzqmIafoH3sxQqKJFenEAwNh CcOt5HGn/FEr337Y8KMvIxvRo2SRFohVctdDsxD+gmOEHkfL/KcdfhNMGWjf1YIZH9I5 zhYg== X-Gm-Message-State: AOAM532NmDemvKgDsvTPUg2fjpmownP1ZV2Q6h5wLQPv5lbtt1IPleC2 1DipqCFxyWs/9Wzb9S6TVOwmfj8Qgsc= X-Received: by 2002:a63:f108:: with SMTP id f8mr3994297pgi.96.1596651429548; Wed, 05 Aug 2020 11:17:09 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:08 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 02/21] target/alpha: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:44 -0400 Message-Id: <20200805181303.7822-3-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::531; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x531.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, 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/alpha/helper.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/alpha/helper.c b/target/alpha/helper.c index 55d7274d94..18169ae1c5 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -299,8 +299,12 @@ void alpha_cpu_do_interrupt(CPUState *cs) { AlphaCPU *cpu = ALPHA_CPU(cs); CPUAlphaState *env = &cpu->env; - int i = cs->exception_index; - + int i; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } + i = cs->exception_index; if (qemu_loglevel_mask(CPU_LOG_INT)) { static int count; const char *name = ""; @@ -405,6 +409,9 @@ void alpha_cpu_do_interrupt(CPUState *cs) /* Switch to PALmode. */ env->flags |= ENV_FLAG_PAL_MODE; #endif /* !USER_ONLY */ + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request) @@ -412,9 +419,11 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request) AlphaCPU *cpu = ALPHA_CPU(cs); CPUAlphaState *env = &cpu->env; int idx = -1; + qemu_mutex_lock_iothread(); /* We never take interrupts while in PALmode. */ if (env->flags & ENV_FLAG_PAL_MODE) { + qemu_mutex_unlock_iothread(); return false; } @@ -446,8 +455,10 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request) cs->exception_index = idx; env->error_code = 0; alpha_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247453 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp758909ilo; Wed, 5 Aug 2020 11:19:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx66xXyHnZ/0SIJxltvdGXOJKWlN+A2r1xJClEePXjZm6ULL68KFXwf5vK055AiQfZh7Ckt X-Received: by 2002:a25:3407:: with SMTP id b7mr6521923yba.81.1596651566383; Wed, 05 Aug 2020 11:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651566; cv=none; d=google.com; s=arc-20160816; b=uWqNso9fSE5AMCViN15AGCk1d5ZOMN59c7e5WbJ7A4TXSev6PUYTQVo/XOCU5e4g3Y xxFKDCebVEhp0xb3V5OhfSCXOZ897xRFecljxILOYrUhl8tI01bmRblBERiGk1RSQod1 zz5sc0JzVvv8Y8kkKMgeUDnksEhbhQaEE94+itr/gyYaUoBpDqcorSVkkcP5k0yEUXOB 5uubGxOTUJKCQb+P3EBiFm9KlSH0k+oMbifEFyr9gUSvlvah09EktwQQDaDfWjSrKzje CvgxNTZwKTdFFaOfOk9qDBermvYzIPIByNjJR5Ugd+OI0YFzWKpMMcHbB6PxQCL4dnCo 5I7g== 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=sqXifhGhW3rwKZgyTrB18rperPby0ZelegDudFYBpjk=; b=YBJ6MkBXA6eRfr7NrQVxk2BA6KBbJQ01NDG5hjQLLLS4MffDFLyPrM6BrLPaXZFLbX nJy7j82SUIrGf21cVJWj0Pc8gYW4PbrrvK4XNeNya6I35gDWV04h/Uj/t8rZ2irofSPY FIRKLwL/7RCSy/WLpQhTN5y41G18xD6gee1xcyszY/Ild0l8EBeehZcsn0t37p4N5J5K vpjM31OWy9DXxnVYKD77p7jm1gud6xQXTeswzCrzafsD36G18YjwpCCH40s2PdroceYo JasmhuDKi2CMXTN4wTd7D7K+jcR7fcK/40AdDDQ8DInz47w93H6Gbyt9atWUHcqKWrcp FcBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E6OLKc6N; 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 x2si3181518ybt.235.2020.08.05.11.19.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:19:26 -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=E6OLKc6N; 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]:50120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O0b-0006cc-Qi for patch@linaro.org; Wed, 05 Aug 2020 14:19:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3NyV-0003nU-RY for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:15 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:37183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3NyT-0006SL-Mr for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:15 -0400 Received: by mail-pj1-x1032.google.com with SMTP id mw10so1077769pjb.2 for ; Wed, 05 Aug 2020 11:17: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; bh=sqXifhGhW3rwKZgyTrB18rperPby0ZelegDudFYBpjk=; b=E6OLKc6NLdUktyGjvvVvhPNt5dAd9K5VQRSXtUcMKl+kVkBqql3YZXUFHfGm9CwV49 0BxYt4B/IiLbsZrGOPugnRpO1hjDejeDdnrSqt5ffAnk3LYzDAsCjMI0kqzSeaB4rV1q V67KJyzCvZrxhGdhS/HkAK8xm2GF4NPxaambIFdpjLPltmbU/0WuYQCjWBB5Zsro2YXv j5KKlZ/hQMU4OPIdjCp1fUixfigBWLyfUiS5xwlWJQEYjojhnoYDBn7rmG+BxDvtzu3i wjCD5KujPRw9tULzug78tBoyX79u5g2bBKFj9TiFlXHpb2FLTCN+Fo3Uuj3JxKPZ3jPE 4tFA== 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=sqXifhGhW3rwKZgyTrB18rperPby0ZelegDudFYBpjk=; b=Vj9ReKVA8FpuEo41qtAv2FkAzQy/PcLogSgzAsN7T+i4cG5t8ATRnwWL1+Z49Llz20 PMBdK5VynYO3bbz/T7oZxC8ajxEEgGgHYxCQ1CzgGiOlNk9jC/0tTwr2vn0g3QcQ4nV2 OWDD6gHz3fNWRtYxOU6GbdX5LeoNOnD01oCyXZQPJOO5swVNrOIgwMyGeof+GehK0UC0 itbIERswEWOy0OQB1SXd7CCb0L5lwOCHDkPVUXsAZQmuVV2ZdmJMZQ2MAJUDSvI6DU11 R2Sn4LDx95fswpHj7XSmtNIcdg1ja6/9f79Pcdt+gxaE2fR0RsbrOvwbDiMEUHxjvKSt x3mg== X-Gm-Message-State: AOAM530Ocrq2zjwpuL+Kb45RWJWJs55OfVJNrNouLK2q2JRWsTbn/iSD khVQqoySwHPuxN+WMMqfOAisu+6WxY8= X-Received: by 2002:a17:90b:46d3:: with SMTP id jx19mr4582194pjb.158.1596651431914; Wed, 05 Aug 2020 11:17:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:11 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 03/21] target/arm: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:45 -0400 Message-Id: <20200805181303.7822-4-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::1032; envelope-from=robert.foley@linaro.org; helo=mail-pj1-x1032.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: Peter Maydell , robert.foley@linaro.org, cota@braap.org, "open list:ARM TCG CPUs" , peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/arm/cpu.c | 13 ++++++++++--- target/arm/helper.c | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 401832ea95..b8544f0f0a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -528,12 +528,17 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { CPUClass *cc = CPU_GET_CLASS(cs); CPUARMState *env = cs->env_ptr; - uint32_t cur_el = arm_current_el(env); - bool secure = arm_is_secure(env); - uint64_t hcr_el2 = arm_hcr_el2_eff(env); + uint32_t cur_el; + bool secure; + uint64_t hcr_el2; uint32_t target_el; uint32_t excp_idx; + qemu_mutex_lock_iothread(); + cur_el = arm_current_el(env); + secure = arm_is_secure(env); + hcr_el2 = arm_hcr_el2_eff(env); + /* The prioritization of interrupts is IMPLEMENTATION DEFINED. */ if (interrupt_request & CPU_INTERRUPT_FIQ) { @@ -568,12 +573,14 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) goto found; } } + qemu_mutex_unlock_iothread(); return false; found: cs->exception_index = excp_idx; env->exception.target_el = target_el; cc->do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } diff --git a/target/arm/helper.c b/target/arm/helper.c index c5ea2c25ea..3a22d40598 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9759,7 +9759,13 @@ void arm_cpu_do_interrupt(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; - unsigned int new_el = env->exception.target_el; + unsigned int new_el; + + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } + new_el = env->exception.target_el; assert(!arm_feature(env, ARM_FEATURE_M)); @@ -9776,6 +9782,9 @@ void arm_cpu_do_interrupt(CPUState *cs) if (arm_is_psci_call(cpu, cs->exception_index)) { arm_handle_psci_call(cpu); qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n"); + if (bql) { + qemu_mutex_unlock_iothread(); + } return; } @@ -9787,6 +9796,9 @@ void arm_cpu_do_interrupt(CPUState *cs) #ifdef CONFIG_TCG if (cs->exception_index == EXCP_SEMIHOST) { handle_semihosting(cs); + if (bql) { + qemu_mutex_unlock_iothread(); + } return; } #endif @@ -9808,6 +9820,9 @@ void arm_cpu_do_interrupt(CPUState *cs) if (!kvm_enabled()) { cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); } + if (bql) { + qemu_mutex_unlock_iothread(); + } } #endif /* !CONFIG_USER_ONLY */ From patchwork Wed Aug 5 18:12:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247452 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp758228ilo; Wed, 5 Aug 2020 11:18:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7QwhfvDjvjaYiNCOBzd0CcY1ElNMOl5rNMr/LsFWFD/7AZhVgm6QlNAsuwwpyKdUmh3Tr X-Received: by 2002:a25:73d1:: with SMTP id o200mr6897483ybc.316.1596651513695; Wed, 05 Aug 2020 11:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651513; cv=none; d=google.com; s=arc-20160816; b=eUw942ABCm/LvNTHjlilSwIN67600VRNDwGP73LoTXs7xoiTU+pVJJ3gZnTFUfpdXB /xxAx1ixGJ0MU4trhPWmOPU0NP9T/kEG10erp4Dea1deF9OxUSdJnLpSpLw7M2kV5gjF vqG9B2KUt5kedYW9bQfAZbz5yBopcTjiq3ecx2m3bRB/lC0KjKuYOB0F0s4Cmpy+SAH0 efZtzlY0EAF4giX1EwhDPg8WB2L86/2nPpVjyymOJU6DpZdAqlM5yKESnbxYVKrRwM2l xGzIxNJoAGVO1p1eI12IX3gt9oMYH7xizJEdamA8Kpv36ClvtkCt+F1boiqGE0xJKSf6 iMig== 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=4uh7S5GyruOrvvkqIbxUUTQpHZU58D4UbwkDmUFW2EA=; b=w2VlzQXWYixHvWhysjCK2jII5HEpmvb+teH6Z4ufIoHaF2boZ+qinm999TDTCpp8jG 1FPKd9qZ+EsixxuX2Sk2X9gH6irkBfFgrshexSnKOk+/L7dc87E4j7U28yK1Wg5eg5U3 qXgBw+E3iqBYDdnvisrZ508f3fvuAqzzeBGp3qR9ZafdLNkB+a9sNYazSIRAY6sMcLvG Vmw0Iaj6+WpPqPHwbYR8U/suyTSIYR5KOspbFI1bbhTdKpgbLceFhdYIu72w7uvQ+jVd 7e3lZqAtqErJ0a45Oa9yCyIM6sat2sjtzB4G7W6gfifR6cNNVeOwf3SVBIIGWXdNNRUD viEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZnxLxPvT; 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 s6si2493799ybk.233.2020.08.05.11.18.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:18:33 -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=ZnxLxPvT; 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]:44686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3Nzl-0004M5-5w for patch@linaro.org; Wed, 05 Aug 2020 14:18:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3NyY-0003ru-36 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:18 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:45068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3NyW-0006Sj-4f for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:17 -0400 Received: by mail-pg1-x52e.google.com with SMTP id x6so9766927pgx.12 for ; Wed, 05 Aug 2020 11:17:15 -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=4uh7S5GyruOrvvkqIbxUUTQpHZU58D4UbwkDmUFW2EA=; b=ZnxLxPvTb1uw8jQEnCyTstBMiwJm1/3Hl5RcLjNylUbP9/6AOq2w5dNVAGoC8x+e43 AIlfcnpoi2Cv+edm2msmYD/sD8fKh1CstKZj1C/1ZxNTHuKRQyQ1AG9AMW+jHI8tLjOJ p6Iz7Dx19IeWyqCKa279WT21uor8x4+qK1j/2TkXiHwTFyM/foCngQTVm/CgOdAsbnK+ Hb/7j6fJRNtC/poUI1E8loeEGyMmjNjnAhmdXQ1bRCpieaa22khzfeZdViZKszShZDZp aut/LmiurlyLJaAMk/jwbT4nxZehEtJbl+lpHgFw61LjMG7UtqJsARtS1C2ptPxjXRb1 xhEQ== 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=4uh7S5GyruOrvvkqIbxUUTQpHZU58D4UbwkDmUFW2EA=; b=gi1lkYLtIkr/mpnXruoRTO9fHniQWVgKtZM/zTxB7pieoAfEa1bUfNnLhfTfSo5sHt 2D62/C6uT27WivudjJQAeGzA6nnHy9enddFfwuZXve8p/8oh3l9q3k1UYBts0WNbe+YW SfUOfaYrIhiCngvzLpAJNrTherx0M7JKE9B5A+FkDXN5XXDY3kmbjyoYSdmx1LbY00ur X92gjC0EI/RzqCKno/Vx6bMxJdQTs6v2gnks+eyEeC0xkXeJ5Nr+j9QJsCpDk2CddhnC PdWsN03eheYGEJ/dDhDYOvv2aq8dLm+mTz8XEhA9XDmaWcwpihpS52incn+MCLJDvEHm h0DA== X-Gm-Message-State: AOAM531HpeGfWsZXZRolAFpikdaGs0Yb4rsoFFaGHq8A2/oNhbnesw5i /A8QhAPX6Jqqcj8oHuu0qTYnrPAtLVY= X-Received: by 2002:aa7:8c19:: with SMTP id c25mr4597482pfd.17.1596651434328; Wed, 05 Aug 2020 11:17:14 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:13 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 04/21] target/avr: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:46 -0400 Message-Id: <20200805181303.7822-5-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::52e; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x52e.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: Sarah Harris , robert.foley@linaro.org, cota@braap.org, Michael Rolnik , peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/avr/helper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 Signed-off-by: Robert Foley <robert.foley@linaro.org>
diff --git a/target/avr/helper.c b/target/avr/helper.c index d96d14372b..f0d625c195 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -30,6 +30,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) CPUClass *cc = CPU_GET_CLASS(cs); AVRCPU *cpu = AVR_CPU(cs); CPUAVRState *env = &cpu->env; + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_RESET) { if (cpu_interrupts_enabled(env)) { @@ -53,6 +54,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) ret = true; } } + qemu_mutex_unlock_iothread(); return ret; } @@ -61,10 +63,15 @@ void avr_cpu_do_interrupt(CPUState *cs) AVRCPU *cpu = AVR_CPU(cs); CPUAVRState *env = &cpu->env; - uint32_t ret = env->pc_w; + uint32_t ret; int vector = 0; int size = avr_feature(env, AVR_FEATURE_JMP_CALL) ? 2 : 1; int base = 0; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } + ret = env->pc_w; if (cs->exception_index == EXCP_RESET) { vector = 0; @@ -87,6 +94,9 @@ void avr_cpu_do_interrupt(CPUState *cs) env->sregI = 0; /* clear Global Interrupt Flag */ cs->exception_index = -1; + if (bql) { + qemu_mutex_unlock_iothread(); + } } int avr_cpu_memory_rw_debug(CPUState *cs, vaddr addr, uint8_t *buf, From patchwork Wed Aug 5 18:12:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247460 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp760846ilo; Wed, 5 Aug 2020 11:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeD+LTVL90z0JFMbaHN+en3MAfNuGr6JJMqgW5FYUIIEEigLhLFzyA4KM4GxFfao0N8go5 X-Received: by 2002:a25:8089:: with SMTP id n9mr6695176ybk.44.1596651729158; Wed, 05 Aug 2020 11:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651729; cv=none; d=google.com; s=arc-20160816; b=lRuYNisp6l6hEdQHhTtTWPcB4Tuko5HtM0q40bF2kt75AZ9tVV/FSAcbDwUUd98P/q WNzSm9Pe3VMwMuSlpZK86rN1j8UjjOLQfQbwprn6rZf4vXVS9JuFi2PMQHnyDqrLtM9r m+pA0paIEeaDqVUpdmAKyKejApGVqZVt/+/Jl428adztWCNK91PL69nB3Ugs8C4hILr7 UCbB+aJxdabTgffHae7Bjbhc3t25945sFKLyGm3QhPpZnwh2jApwD02jS+cxmcj7dpze vG1Ma5icDgsZq4eQ4yYqRQhZqlcLYQfEfsJLDh//LmmuJT/ji3cwZRXRBilnL0rtsVXQ qUHg== 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=MJQQ/dt5YPVkuurfAkJuoHtRneXdeiakI4OjTjMGNhA=; b=S6Q3O9+IJQ4BqcqK320PMgkgJ9SpqdP6koHziBu48oTTb1z7/7qZKO3ViqoNakcwYg PhSaKtN74iTGUPpUiL92GlmCsT9De5+2ktHrHEPdJoq3fDRtJLyMT7lFZ53E6ycAJQrG QVDcWLE1CtdWxzx02EgdGzXZrd5PverQmhC9A3gGryVtaIq8y8ILw1YxdTz0CuIRCtru b4PeGpIU3omTP6x4YzC5teMtJjcCeODxvX4WxkdHfzFxFhe0mQwFadfyCFjJhuJpOcUc Ce4opBnri42bhCD151o3aLT9Sm0TIB/GRVrZY6rhkpqdrlmWgCHNIXDZ5L5tV7UqeLaa hZ5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ecXrb467; 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 a16si2405060ybk.145.2020.08.05.11.22.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:22: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=ecXrb467; 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]:33408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O3E-0002su-LD for patch@linaro.org; Wed, 05 Aug 2020 14:22:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nya-0003zE-Er for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:20 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:44815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3NyY-0006Sw-GA for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:20 -0400 Received: by mail-pf1-x436.google.com with SMTP id r11so15310039pfl.11 for ; Wed, 05 Aug 2020 11:17: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; bh=MJQQ/dt5YPVkuurfAkJuoHtRneXdeiakI4OjTjMGNhA=; b=ecXrb467asYl7YNp/vXs2aS0/5T8I2Ufg8BsI7f0Iu/Wml6ucV0bCY1gRFZryfvNXC fHFnJJZLoEumsYXCUB4GVPM6AWYKybYAf0QMT3BBs3l/BzKaiCPepUGMCghM1kaCeLHG LW5TPgjtunBMCgwE1CT0Jxk7XttdbIYYbcpDUBow+oNQv/cjCW62+hkGH4gXsHnIFQ7U mno2fSJ1KqlM8w079kPyFNzMnKXIk5QMLTLl5mrzPZ5xSoLuuMD4Tkij3L/2EKgC/a0O G8i8ijbCCBtodppYNmPQOp9ae768KAo507AzP9SSItMF3ckURhzj0hz520bka3ND5Y3k oaWw== 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=MJQQ/dt5YPVkuurfAkJuoHtRneXdeiakI4OjTjMGNhA=; b=TF6QDyqN3Wb5dgqz+KREPzUIV08zjTavJRZUNC1LmIEHBWKDGwXfg5Ngi9JhAat3kk OKjJ2UC4JhZyHKKoVdTDzSnHj0byKzUZvVt+bziHUAZw+53L+OHjYlacfnCLTXKOlGDp YRTrGFpEiBxc3Ykbaxv2X2o4Fh6Lg81VYwxInv3Al2J+vG6yu2+m64gVR2ja0jJ2Gl/L LhDQV0KEHCJCxSGftyAPXxjFMp9R2gVDARnOVQSOsPgLfC9+Jjl/ebO9VIjZh0HHyFD1 txgnbBjJjfHLK9BXR/lyBls1WoON9Xd6fR1iR/zQNy5cz6srh7G4xXUahWTaAfyE2fiY WmLg== X-Gm-Message-State: AOAM532lQF8yPHkL2++hNPb/WP6GyqHsV0bQUYIEDtU0aSe5WUBr3wh0 E0ilfgLaUezuWXDUFyuISMxENZ963/s= X-Received: by 2002:aa7:9a4c:: with SMTP id x12mr4624405pfj.307.1596651436669; Wed, 05 Aug 2020 11:17:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:15 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 05/21] target/cris: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:47 -0400 Message-Id: <20200805181303.7822-6-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::436; envelope-from=robert.foley@linaro.org; helo=mail-pf1-x436.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, peter.puhov@linaro.org, cota@braap.org, pbonzini@redhat.com, "Edgar E. Iglesias" , alex.bennee@linaro.org 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/cris/helper.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.17.1 diff --git a/target/cris/helper.c b/target/cris/helper.c index 67946d9246..22aecde0f5 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -45,8 +45,10 @@ void cris_cpu_do_interrupt(CPUState *cs) CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; + qemu_mutex_lock_iothread(); cs->exception_index = -1; env->pregs[PR_ERP] = env->pc; + qemu_mutex_unlock_iothread(); } void crisv10_cpu_do_interrupt(CPUState *cs) @@ -128,6 +130,10 @@ void crisv10_cpu_do_interrupt(CPUState *cs) CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; int ex_vec = -1; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, @@ -183,6 +189,9 @@ void crisv10_cpu_do_interrupt(CPUState *cs) env->pregs[PR_CCS], env->pregs[PR_PID], env->pregs[PR_ERP]); + if (bql) { + qemu_mutex_unlock_iothread(); + } } void cris_cpu_do_interrupt(CPUState *cs) @@ -190,6 +199,10 @@ void cris_cpu_do_interrupt(CPUState *cs) CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; int ex_vec = -1; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, @@ -265,6 +278,9 @@ void cris_cpu_do_interrupt(CPUState *cs) env->pregs[PR_CCS], env->pregs[PR_PID], env->pregs[PR_ERP]); + if (bql) { + qemu_mutex_unlock_iothread(); + } } hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) @@ -294,6 +310,7 @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request) CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; bool ret = false; + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD && (env->pregs[PR_CCS] & I_FLAG) @@ -315,6 +332,7 @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request) ret = true; } } + qemu_mutex_unlock_iothread(); return ret; } From patchwork Wed Aug 5 18:12:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247455 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp759298ilo; Wed, 5 Aug 2020 11:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJPJNqHHI2PY3lNhv+8P6MmTcK8n7pm59wMs0unNFsKSqsDO1x2Rt4n+uhG5dRec8D5z2J X-Received: by 2002:a25:d4d2:: with SMTP id m201mr6767621ybf.245.1596651597481; Wed, 05 Aug 2020 11:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651597; cv=none; d=google.com; s=arc-20160816; b=uB0/iGW4wRdRDGO42G/TOxG5Qs1HMbsqK0Iuks7STGq6RYjXBFf7SpJ2gzHUU+tBV4 9Rxw89iiaMapnjjrKu9a/QajhkXKpjgW3CPbfPMueonE4umI6NmuqtfqXxIJg6US2jEK 4x4TqHIF7iHJQdb9PnWsndAX8FPzpQub6qEJmPnBG7UUSvTAo9XkfVzAngJmrOjrQ1f6 uf+duwW7OgzQNOmoEmaKrYrb3xF/lj348iZLlM/q/8lpcX3lyG+Mn8XdrRuwrrkQkaUO +R9zPtlBLxFRxNW2Tld2vkPSa+sXlbaKODh8Dv15vtGAr62U/JtrVJBgN2IDGbWoPqJk tImQ== 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=aWTfVEr9viFrQ6JCbNZOP6prnRfgRwiZmrjVsEZMWCQ=; b=tv6GJ/5R9aRxqu5V5WJHIJimxj6ADVeb9LeYsK2+eRu8uXrXxdxaLK1KRi5eub81FX +5kK8lbVf4a0a0eLuHinjRQy/As6XUjEArdEEcFwI13pelSSowh4/hNMdzJyJt0cF8lA vKxl7gbpgARuomt3JRfoSvI62DpOHUYhw7DI/Bns5cOv9svYp7pZm4gd68qfR9FKwDjn vLcQ7jBk/oCIaKJqGUZ1EEPT0gZabT1ovZvapCxrFz6+HoZby48lzpK/h6l0VpRj0DuB FMGYcyPjHVgWGxnRg8PIhJ96Hj/MtY+tcw6Ddg3mJTZJz22j7wB1iXXdcpO4mahzM6zb /2Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cIZjaXa9; 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 68si2519715ybc.380.2020.08.05.11.19.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:19: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=cIZjaXa9; 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]:51900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O16-0007JR-Um for patch@linaro.org; Wed, 05 Aug 2020 14:19:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyc-00045M-U8 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:22 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:45788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nya-0006T5-Qg for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:22 -0400 Received: by mail-pf1-x434.google.com with SMTP id f193so12811385pfa.12 for ; Wed, 05 Aug 2020 11:17: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; bh=aWTfVEr9viFrQ6JCbNZOP6prnRfgRwiZmrjVsEZMWCQ=; b=cIZjaXa9hCmfhlDZimPZ7RTB0p8QjdV+aDkQ3YeAXdeQA1ABzzYQLs0zaTRszYaR8m /wtrkc1vQCGe3N/Paa5axVhKP4MCoAKnZgltYzS/cFw986qNp91/lHYc0bO6QgRauwEh grjmKawATF0BOtBwvIwNK6TtyuO4w/QNfMiqLvj0Szky98MJRKC5wIaO3k9SsXTx4cyo 9qIfIlvitWZXDazwY0jHL6lXBygihw5WxhimwIPDiipJIyF2hK9KIWnlNsTp/hFlmB2p Jn9sNFHcgTK7WtkDMdKyjKFdsEMXdFl8V3/jxksA/ta/Ugf2ubdCngi3B1ymhGZLm6Wh KPig== 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=aWTfVEr9viFrQ6JCbNZOP6prnRfgRwiZmrjVsEZMWCQ=; b=NLfUdGk1O23U5TYbi46E59P69Mj2fHmNOJ+nsduTwnrSyxV8ogmWmfdTogXWIo0aLr yeu9JkVX7pUpB5uGV0dgxldxuWZqLoG7XkLOk20bkLUzqI1pG65SwiBNxvHYO4iHefwL VxuJ2MbNDzn+Nd34u2bvEUMDG52KsWZaMNnyIl8nMm5Ap/pCdLIJaKb3BPBYtm6UUQtS zDc0D/xEte6DDrT256mcaPMVovmoUXMiutHZoSImA/DjwnvIqYuQGKkIvzkT77HnRJOB liuSwEG3MWSPGXGKAkA4qIPG7IjFQBD6kYKEIthaCbYi37+FG8BD6KS8+1bJNym/ZrRq RohQ== X-Gm-Message-State: AOAM532TF1CJ80j9NqkKx5w0kbVtrqod/NrOxloxaEm000jMiL1gdbDR P8hVgkdBg/F4hnhesDCH79YGHO0Tfjw= X-Received: by 2002:a63:d446:: with SMTP id i6mr3893370pgj.438.1596651439003; Wed, 05 Aug 2020 11:17:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:18 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 06/21] target/hppa: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:48 -0400 Message-Id: <20200805181303.7822-7-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::434; envelope-from=robert.foley@linaro.org; helo=mail-pf1-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_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, 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/hppa/int_helper.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index 462747baf8..eda40bc5d9 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -94,12 +94,20 @@ void hppa_cpu_do_interrupt(CPUState *cs) { HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; - int i = cs->exception_index; - target_ureg iaoq_f = env->iaoq_f; - target_ureg iaoq_b = env->iaoq_b; - uint64_t iasq_f = env->iasq_f; - uint64_t iasq_b = env->iasq_b; - + int i; + target_ureg iaoq_f; + target_ureg iaoq_b; + uint64_t iasq_f; + uint64_t iasq_b; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } + i = cs->exception_index; + iaoq_f = env->iaoq_f; + iaoq_b = env->iaoq_b; + iasq_f = env->iasq_f; + iasq_b = env->iasq_b; #ifndef CONFIG_USER_ONLY target_ureg old_psw; @@ -244,6 +252,9 @@ void hppa_cpu_do_interrupt(CPUState *cs) env->cr[CR_IOR])); } cs->exception_index = -1; + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) @@ -251,6 +262,7 @@ bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) #ifndef CONFIG_USER_ONLY HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; + qemu_mutex_lock_iothread(); /* If interrupts are requested and enabled, raise them. */ if ((env->psw & PSW_I) && (interrupt_request & CPU_INTERRUPT_HARD)) { @@ -258,6 +270,7 @@ bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) hppa_cpu_do_interrupt(cs); return true; } + qemu_mutex_unlock_iothread(); #endif return false; } 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; } From patchwork Wed Aug 5 18:12:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247467 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp763580ilo; Wed, 5 Aug 2020 11:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6it3ThqJYmH4mcOxHnVlcxRnbRWIA3az1ee7pXVSAXttYUDtQoT9NFIB5Y2zMSe9hIvO4 X-Received: by 2002:a25:2d5c:: with SMTP id s28mr7024102ybe.23.1596651970121; Wed, 05 Aug 2020 11:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651970; cv=none; d=google.com; s=arc-20160816; b=ML6nw8ZwCxzcOPIiP/c+FrUcDZEl9u5dNRv2qCH3YgutM5/StEJUSxkWOgb7cwuk7S 7Ud13sqemSa/Hs5q1unPoyZhD1eQ165FvPVmko2GAo3Sjh081ROWhwC39bn0oFU2QC/h E/87YCUPFmjR1PPb05aXgMIfNLjVAH7SR/NBjxMI6AZ+Q6BRB/roIyKXUHJeq99QISj4 FleSeo55OBZxl44PSyeJnwJUCoL7afZ5Qo7mPM1pmT43xpRVxSMUL3MwYFdHACbVjIs4 VtZoKTwft7ZefhGYwfKXUM7c9S9a/h8CzDx8QcCCiiFBmHxI2mt+2B+IW56xaZimJIRB eJiw== 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=sPSOE7FlbJqSNOCq29FKQeTA9v1eH7Mn/6Yq8WOQ91Q=; b=Stxr/xlgbOsjltN7wX2W49s126/OvqB5bpU7BzLsaA1Oy5AKOOQp4hRDWoBGxe7xRC xbAmok3syUxiMwBqB/sHog2eedh52wOKITZL8hZsCY4a9WHXhPYC20E4fLU4pybFJQ/p qBMCqj5H0W/cliqjLka9c0oar500XNFsZ/FY5al51AWxyXehK+eVlr/38G7WSJkK9QJv pYWQuVdU+ByBWYhzN7UeElMntetZqTF4DAl7Z1RQMcCcrTz2DMagbLSzptnkeWwIofOo zCqvTTsV7bKej58UbEIUrtZxI6v152+R9SmTWgABDDl0l2d29wnnuXTdYOIFNqSUth9S MJxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kXpbP+C2; 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 j70si2466304ybg.320.2020.08.05.11.26.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:26:10 -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=kXpbP+C2; 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]:50340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O77-0001SB-Jc for patch@linaro.org; Wed, 05 Aug 2020 14:26:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyh-0004F7-39 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:27 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:35710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyf-0006TU-2K for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:26 -0400 Received: by mail-pl1-x644.google.com with SMTP id r4so15134267pls.2 for ; Wed, 05 Aug 2020 11:17:24 -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=sPSOE7FlbJqSNOCq29FKQeTA9v1eH7Mn/6Yq8WOQ91Q=; b=kXpbP+C2n9auaXiYPp+Eepc+/rRmw8U+C30wKtE2ujwOqJQ42A5YToUA29b835eoOm NlCqlIgtLVJ9DkqYSuGUaUlQfKH8pCwTkvKrRX2CvNXpH26YOsMSDtzvJ4f+rdthJkeQ w91ZUKT0reTrfrDWByWFl/Fmgu+xGROindsnV1xOI1B/aIWeXGwU5L/kMGEyd7lv/jCl TAyRCW99BtjAWsMnEoavx3aoHZfPvBttjDEc34wa5nR+cbpB4Drxv+2uJjGVhc64cXNr Q0v587VqLJj8Zk5Lo203XbczOIUpjEruNmb97Nwxb+jeHXjvhBfg/YA1XKwXiLMMtJ7D Lf9w== 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=sPSOE7FlbJqSNOCq29FKQeTA9v1eH7Mn/6Yq8WOQ91Q=; b=sg0DwxdiQLWqyR1LF5A4MNttmeXVP/tlcNHNsQJI1MrXxjTcM0sAQoKY22Ze9qgSUz xOPD3PuY1xrkEWHz1p5ciw/C66repThQ5miwXjRpbvK6gRYdSZmHyWUhIazsj7TBJFnA yTuTJ2elZfwu5Rb8iw9FQsvsixc7kwFU5APCKATiVbKMsBSiVOoeCRoKxRHS4562me3G 97A+mVTV2dqOle/k8VuWqeNnzLGtG3+GKbjVyfaY30aIKTmSLsmev0KF9yjnoPNetPbg lwkJuP6s8g/RlLJOCH1HRpebXnmG5nHpH5hWWBijacfsfE3Krq5306ET9jPzl9ksBAgy qQFQ== X-Gm-Message-State: AOAM533ox/ymzTXZQdwsYzvjfTYDFx1VHpqLsPKgXdVNhbrEdsn+0iC0 HD64c7c+zEPuQLMwuqpn8klhVy52xA4= X-Received: by 2002:a17:902:a607:: with SMTP id u7mr4360104plq.45.1596651443512; Wed, 05 Aug 2020 11:17:23 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:22 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 08/21] target/lm32: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:50 -0400 Message-Id: <20200805181303.7822-9-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, Michael Walle , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/lm32/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/target/lm32/helper.c b/target/lm32/helper.c index 1130fc8884..4439b06ecc 100644 --- a/target/lm32/helper.c +++ b/target/lm32/helper.c @@ -152,6 +152,10 @@ void lm32_cpu_do_interrupt(CPUState *cs) { LM32CPU *cpu = LM32_CPU(cs); CPULM32State *env = &cpu->env; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } qemu_log_mask(CPU_LOG_INT, "exception at pc=%x type=%x\n", env->pc, cs->exception_index); @@ -196,18 +200,24 @@ void lm32_cpu_do_interrupt(CPUState *cs) cs->exception_index); break; } + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool lm32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { LM32CPU *cpu = LM32_CPU(cs); CPULM32State *env = &cpu->env; + qemu_mutex_lock_iothread(); if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) { cs->exception_index = EXCP_IRQ; lm32_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247458 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp760701ilo; Wed, 5 Aug 2020 11:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy799k/uHBYxiuCo0hB/Dwf9Nw6b9fijrT6lDQ4W40VL995as7/Qz5kxrnimfOHTy0qg8QW X-Received: by 2002:a25:ba41:: with SMTP id z1mr7473226ybj.33.1596651713828; Wed, 05 Aug 2020 11:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651713; cv=none; d=google.com; s=arc-20160816; b=Dia5Cnb6o59koUFIXDrCOGk/8st3p4vXofokzGAcDP6dne2/16iMdK5fGr3rcC4fQE +gaZDyXHp7S/3CLFjDEz0Dg6sv0sRq8bVWOobllHcjP7PQee5k7URDF711qPXwUeSRjx HcNsxBW08JwivAGfeLIPnSGvnQb8gzsgKp9n7Qht3Ujy+gd4iPvniVyZtwaKQXtqh+Pm rhwCFMmo2MxMUP4AFS7Dh2yQz75zTnAjAB7sKE7bOP5LXSDsY0AWqSuFzA5LSKf+BT6P Gps1a1dp3EeNeuB1QiGw2QeYLUBdbOkoDhbqVaj7G5+vthFohIcfx6j4CZKnibpPwMVr fZPw== 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=sAMCBrWOlvhWHRQfoPG7nat7D/DsWHPnezgCzgjj800=; b=pxWAZP5R1R+no+3xVMcaWRVIpB1x4oFEbGFbUiK4LD47WbWMFEFiGTi8Zw8lJK2Z8Z 4TtXfQtlD7/0sRepkDNMkj2hjzOTVeEHYnysCSD9HYf2JvB5anjD9ouTaTv5DZLSI3o9 J/GZ113JATYwaRQk4mlLRoKhIxbHtXqO4pjPTYg80+q3Yfo1enbF7PzhaFS9ZhwpAjKx bltAOwBnPS2q7aHoXGDEJ/yr8N9frOMoKh4K5NPuYRYdXIbMeeJSM744Gc/PDgw1U5Ix AZQ1T7Z/k0WapCTkyFnYbvzLDf6Egdp9XNmduW68wSjgCnbX3Z7X3Cc0FLcvHlj0Bxpf /Pzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pgFeFCV2; 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 190si2694260ybf.2.2020.08.05.11.21.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:21:53 -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=pgFeFCV2; 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]:60250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O2z-0002Kk-9Y for patch@linaro.org; Wed, 05 Aug 2020 14:21:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyj-0004KP-Fn for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:29 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:33108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyh-0006Tj-JI for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:29 -0400 Received: by mail-pl1-x642.google.com with SMTP id g19so13194188plq.0 for ; Wed, 05 Aug 2020 11:17:27 -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=sAMCBrWOlvhWHRQfoPG7nat7D/DsWHPnezgCzgjj800=; b=pgFeFCV28gv4EmomjDuouj08WrzlGGVyl4HrPVq1A3OBVWQzCKx+H0SQ2lKMKrK4qB iYDKiZEQZyN+dAjIVCioY7q3XGkOccA7zxrTa6Ja65AOxlrmsc5OL/tjdRMEp9v3GVT0 WuSLnKaAEzF08yAqcEH4H9lnkDmoEOznYUMkkpbvBphq/d+/Rs1s55MVY8dea7f7GgoB Fmr9G3RH4BoP9n2JxESNitGRDzFpmBz1kktdOYn+r/Q6X1ycGAnwoMrKmXJdPvGhx+FD /SqQeV2GwaYLI6bDeG6luXUT56l7fT4xHIv0eTPhUr8WPaW4+iY2brd7k0A1RGXQ+6ee ViGA== 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=sAMCBrWOlvhWHRQfoPG7nat7D/DsWHPnezgCzgjj800=; b=mQBpVQu6GB491I14rxRgY7M0kYi3IlbnNGy8s7/Fom/lHfB7Et9+Rl48/sQLvrgMIj YSYEF5yt1xSxG2bgt3B+DsmUyqkmuVwShuu0XIBLHiBDSLItV3z36dxOboUoh9xydBQl ZMq8/IsXcO+UtSsu6CQ7cZpRIiqerEqRVBZHjojv+BnzxKcYM2+qv1hr+ZUm74sM/Ho0 JtkTgENo/EvzZBMkHFGHEveUJL4l/30red/hnkYrbO+PcUcGCU62hctrfdmaCIHOsUVr YTXJj8paEC+vDHiYgnImUcnkgRVdOaHB4GiWdC29ZnQIxLwv8FhaIbbTDql1uyX9jzu3 JRvg== X-Gm-Message-State: AOAM532wOidjrJM3tV1erUAHb6dovTY9kyRLn3QYiqoSB9ZIP/24caol QTtZwVarLpy//viGcBESynvdUoj00s8= X-Received: by 2002:a17:902:7d84:: with SMTP id a4mr4286651plm.44.1596651445773; Wed, 05 Aug 2020 11:17:25 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:25 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 09/21] target/m68k: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:51 -0400 Message-Id: <20200805181303.7822-10-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::642; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x642.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, Laurent Vivier , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/m68k/op_helper.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 4a032a150e..0c3333476a 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -448,7 +448,9 @@ void m68k_cpu_do_interrupt(CPUState *cs) M68kCPU *cpu = M68K_CPU(cs); CPUM68KState *env = &cpu->env; + qemu_mutex_lock_iothread(); do_interrupt_all(env, 0); + qemu_mutex_unlock_iothread(); } static inline void do_interrupt_m68k_hardirq(CPUM68KState *env) @@ -508,6 +510,7 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { M68kCPU *cpu = M68K_CPU(cs); CPUM68KState *env = &cpu->env; + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { @@ -519,8 +522,10 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request) */ cs->exception_index = env->pending_vector; do_interrupt_m68k_hardirq(env); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247454 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp759261ilo; Wed, 5 Aug 2020 11:19:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEPJtkkluWf9QfvJSbeR8BT0J7Qg2Tnnzbx8Bctfaijy/AeQEmFz9pvpDVUBzldsLTN6yK X-Received: by 2002:a5b:992:: with SMTP id c18mr6836229ybq.59.1596651594159; Wed, 05 Aug 2020 11:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651594; cv=none; d=google.com; s=arc-20160816; b=wRNgdjZ+viHLmpta2xlittM8b1GN/WY4lntxSg5O/PtOXoVnuQo6P+XnDggwHT+w+3 pxDKQrZn8yt35Jys7em3Qm3bOdo28cl5yaiMemqN/0sv7e6mXsIO/86kb1ihA/lV+hIc 0KgnlF2vORDBf5SYi7bi/LPylBc+pQXY2S7W3gCJGrUUYZc6JeGaJ8VPbBPwg/nRLWVe A/QSqJ9Teef6Rowl1kwYv5V2bEjNYP/3Eu91/rD5klwIr1uV8pdXy0cnxGH5tMnvXJIk kiZM4T1MU78EpQgzXCj9UuMP9oTRJ280HVsHEws5UUm5ZQr9aXaMWumre7pJsqFO6Ur4 41IQ== 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=AeDpfxqkdAEXeD0Us9Svn7h86jElbTJX/muq5WTwNbc=; b=RTPReOnbTeEzpvbRAHomxXm0JcmCd/8jj26PQFLr+4m8JrMbLJjNWfHbFTa539ajlh 7ihJg82fnkJtM0xmAMjbwgFyR0PVHH00bqGdTtOruqQSeBnyN3NhkDYF4Rj6AZF0RJwy R4aJgKsPdYoxAHwD9sQfl7HJXDdFLlPfTbjLFqK5A3dEoX4fA34jD7sw4YetUGUAPOK0 jsu4yL0k+x9hNjhCD/h1li5jdpoubdzWxZAsw0Qr5srr9jZQ6xwC8c3NDYVjAOMnQe8U JRg7t/nteLyqx+LWpUN0ZA3btQYk3ti6iqq0aRpmgY1XgyPfEfGQ4tgpwlVNNBJHrFIG kBog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="sowj/PvI"; 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 n72si2568771ybf.240.2020.08.05.11.19.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:19:54 -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="sowj/PvI"; 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]:51452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O13-00078q-FX for patch@linaro.org; Wed, 05 Aug 2020 14:19:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nym-0004PB-Ep for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:32 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:39054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyj-0006Tx-Qh for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:32 -0400 Received: by mail-pj1-x1036.google.com with SMTP id f9so4779659pju.4 for ; Wed, 05 Aug 2020 11:17:29 -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=AeDpfxqkdAEXeD0Us9Svn7h86jElbTJX/muq5WTwNbc=; b=sowj/PvItMmu8NBwvfGGeqmrW1OX1jqRjIyWgAzoKIwV8FNfxYd9wnclVR70+vRkRS Jon4BlDzbt/dVJrbMcTyBJM/GxzmidudqoS8DBKBj2D9S6LhTPZGFCUogaJ4DZH5xhFf aj4lbeqK3fz6cN5ycfFqTveISpgW1AldVb/uiWyO09TA3TP2HKOsCApmdKKEtHLSKXW8 iVBqwbgp2ZbD5hFrxwyvq/n2/uqhrcT7xtsyE4mgXX2bZSa4sbpUuJVyP/61w7oKwKlU INCQMjkh5+/HLoqEGQRtlRnpaOdRcdFLWrIKzzlihL5KoJ0hJaGH1+9IBlJtObXZNI/7 S0IA== 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=AeDpfxqkdAEXeD0Us9Svn7h86jElbTJX/muq5WTwNbc=; b=gqeNYMF7zIpzZ2AiRRyywkjpWUzzF4+2wVOIN2wQN7n994QHOFMSb9aOrIx6QZswmW owxKqd6KIjr/TaVyDgp9Uu27yAESwRTrqpvEM8ONmfJFuVg90gmr0GTQDsTW/w6SiZux 7ZhIo+yb1PbAQgyr59sntIVcob1FjRYWTOJx78jiBv+Re9knTEK4mfyEcQGHH8dBCyDc iiOqfbzmQtrrPBXzo6GWOHPsv9/Nn/WHocLrdP/ymFaoJE1QFiPYMaYloUYp5p1nRMg8 ceEEm7OMTc/Fs1qN3dXo084BAKJC4827fhyFuu01u7jVfSEUnAysJwL86Gc2+ul1Uub5 0/OQ== X-Gm-Message-State: AOAM5312AF1EGsRX0ZRCHjtIj5wQEbNswvVfMYT1SgdVGyV2bn0MeCim OltNB0xPTOJCXKJ6ZBWahtfbgCPrztY= X-Received: by 2002:a17:902:40a:: with SMTP id 10mr4238883ple.180.1596651448072; Wed, 05 Aug 2020 11:17:28 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:27 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 10/21] target/microblaze: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:52 -0400 Message-Id: <20200805181303.7822-11-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::1036; envelope-from=robert.foley@linaro.org; helo=mail-pj1-x1036.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, peter.puhov@linaro.org, cota@braap.org, pbonzini@redhat.com, "Edgar E. Iglesias" , alex.bennee@linaro.org 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/microblaze/helper.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.17.1 diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index ab2ceeb055..ae8ff2bea4 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -32,10 +32,17 @@ void mb_cpu_do_interrupt(CPUState *cs) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } cs->exception_index = -1; env->res_addr = RES_ADDR_NONE; env->regs[14] = env->sregs[SR_PC]; + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, @@ -113,6 +120,10 @@ void mb_cpu_do_interrupt(CPUState *cs) MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; uint32_t t; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } /* IMM flag cannot propagate across a branch and into the dslot. */ assert(!((env->iflags & D_FLAG) && (env->iflags & IMM_FLAG))); @@ -123,6 +134,9 @@ void mb_cpu_do_interrupt(CPUState *cs) case EXCP_HW_EXCP: if (!(env->pvr.regs[0] & PVR0_USE_EXC_MASK)) { qemu_log_mask(LOG_GUEST_ERROR, "Exception raised on system without exceptions!\n"); + if (bql) { + qemu_mutex_unlock_iothread(); + } return; } @@ -262,6 +276,9 @@ void mb_cpu_do_interrupt(CPUState *cs) cs->exception_index); break; } + if (bql) { + qemu_mutex_unlock_iothread(); + } } hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) @@ -291,6 +308,7 @@ bool mb_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; + qemu_mutex_lock_iothread(); if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sregs[SR_MSR] & MSR_IE) @@ -298,7 +316,9 @@ bool mb_cpu_exec_interrupt(CPUState *cs, int interrupt_request) && !(env->iflags & (D_FLAG | IMM_FLAG))) { cs->exception_index = EXCP_IRQ; mb_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247457 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp760121ilo; Wed, 5 Aug 2020 11:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj3duTllduihOD74wMkTXoAS/9XDWuZjTuSAZyM1aqvGyf9Kh02vDSoCjXOBovcsDQvvpV X-Received: by 2002:a25:32c8:: with SMTP id y191mr6902837yby.273.1596651670788; Wed, 05 Aug 2020 11:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651670; cv=none; d=google.com; s=arc-20160816; b=Q+86No+8oqjSrqXvVk25B8fASztVS2ekqjNINkZfGubpQixM2DPkCqckezTtMMjPzq BE6ENIL8BIzYsQ4yQhW9MzmQ/3OE3ZB1BhBZCiJdmSIEDbxWxq9/xYXeYYjwsLcfWu6T zPQoLcMiuyuvbosryqt6RgqTy4YjM2FSDrk//lUvRYWGU+poE/+6D6iwDGp0vYDlDkfr WqEqxrXKB9FWvpFRnDISbna+5k8/0kqURv0kADM9EZGsz5HMGqOX73njta4Dx1oonliQ 6+Cdm70cEYgJLv6um/R3fes2BUBUD0HzbmgAl+D9Mx1pgId1g9wREY79TL2SVhTgackG aHLw== 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=TQf+kUTKaJ/snZqXoVWLiq9osz3e4ZNpxcetm6dWt8I=; b=anH37laQuiN7j8NdO9BsTlyaHc+mHoTUDIoESIfGAYWv6SN+YVmjxVQ7Z7u8z6Kh/J SKJb1tAhNI2knRM1GHziLxHfx9WGwuy+10p7SeXDdSd4WeO3Y4mKHLNY1QJw7E7sse3Q IqoEQ3FDKmZr1G8CGOlkftkdQ3Dh9nplWQp08XA1WsuOvVGxsgJIhTLG+AxtsDI0TN/y J1b7kxdul3xtpL6yX34oYX1UfBmiXfUGc3DQBFfBpo/nfEvhXakgylZ5WB7zoAPWHndh YkAguYbCdUwV1b51pm9pHiMVQVH3S4IJ0rFfU4hZDHtlfzgQ2TEQkU33p711WFjDZinQ i/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xTjpRxu7; 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 a12si2249667ybk.64.2020.08.05.11.21.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:21:10 -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=xTjpRxu7; 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]:59904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O2I-0002Bx-75 for patch@linaro.org; Wed, 05 Aug 2020 14:21:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyo-0004Qw-9S for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:34 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:51543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nym-0006U5-91 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:33 -0400 Received: by mail-pj1-x102d.google.com with SMTP id c6so5024195pje.1 for ; Wed, 05 Aug 2020 11:17:31 -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=TQf+kUTKaJ/snZqXoVWLiq9osz3e4ZNpxcetm6dWt8I=; b=xTjpRxu7HKdV2Bz9nOANpvgfUs9av4+RyFPXe/KiNgkf7fgIrqz9/1F52zNNifoO5f 82J3UKbwrNjZUAa3+jG7R6TK2xl1OPijHaBNqyZGNb+oBoZQMR+rSVNYhGasTOkAmB6h UZcx2UZJWcXND+tXFwFmlkOjU4VfohT24F+Vs4MmWuZFq34ldRn/JSjO+zAvcKl83rCm u99vaeu/IrDe2qTMOyIGKnneHTo25v/7F2af1L/V15i5RVW4hjMyHosssy4LNpPFuvcx 0lbHALvPRUHLpSotwcs5eDXV3pPmC8mYunvhI1d+RUIFmxP8eZQJ91cSreFrZ7xiJPJ4 fX1A== 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=TQf+kUTKaJ/snZqXoVWLiq9osz3e4ZNpxcetm6dWt8I=; b=MWosaawdH3GfZ84Ma3jf4+IBirjZ0itduZq8qx6J+FMP30mim8PAQv6D93MgvBLubd zoQtnY6KVW85Ip1gAlR82Kf6SWQA6YQQtqvsR26gU3emEON5Xw/VOsQspgtkLNK88Pjr oF4A6NkNx28FpXLliWbhHJJt849VkFcXD9yqV7d5ynouJGE9hE0NYSs4CXo9F6c736oU pF5VFx8ZT6+ZyidauIeqkIKZfpP+fh+xVBwXiJ1zMaYFM9W4NPS1yva7J3eqv20dUl9w VLWSFInS+xOCpIU2XKR/KcMfHLVKKQp0nMkF3vYUgH/JzU4B40tU+cwPjuc9EQ5FzPTR FotA== X-Gm-Message-State: AOAM531Zn7+QxSpB63DTYrG+KUI5Yew2ivskWzMEGM78HgE/EPgrA6KF AwiLs+RuMiuGwQ8v9ld6KOB3ovb8uXQ= X-Received: by 2002:a17:90a:3488:: with SMTP id p8mr4695488pjb.211.1596651450623; Wed, 05 Aug 2020 11:17:30 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:29 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 11/21] target/mips: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:53 -0400 Message-Id: <20200805181303.7822-12-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::102d; envelope-from=robert.foley@linaro.org; helo=mail-pj1-x102d.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: Aleksandar Rikalo , robert.foley@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, Aurelien Jarno 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/mips/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/target/mips/helper.c b/target/mips/helper.c index afd78b1990..6595d18702 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -1085,6 +1085,10 @@ static inline void set_badinstr_registers(CPUMIPSState *env) void mips_cpu_do_interrupt(CPUState *cs) { + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } #if !defined(CONFIG_USER_ONLY) MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; @@ -1396,10 +1400,14 @@ void mips_cpu_do_interrupt(CPUState *cs) } #endif cs->exception_index = EXCP_NONE; + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool mips_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD) { MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; @@ -1410,9 +1418,11 @@ bool mips_cpu_exec_interrupt(CPUState *cs, int interrupt_request) cs->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; mips_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247456 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp759451ilo; Wed, 5 Aug 2020 11:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLGpUnjZm6jmX0TiJ/8qU27G/bQI4sOyYegKMKkH1gMqpcMe8rQFo2VUMheNDy/0Vl5C1/ X-Received: by 2002:a25:23c6:: with SMTP id j189mr6424258ybj.362.1596651610889; Wed, 05 Aug 2020 11:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651610; cv=none; d=google.com; s=arc-20160816; b=wqoCgXbCu1TqjeoKcn+YUNwNGDOWZ2QA+IPCPHwBX4bPDF41hElkoihQzkQITNrDIb zWXYV+Zc5tFJQcYBOdj/NufiYTWC8R6FpDjIS1LtbfBIDmsBDHWVn9kOLW8nHkXqbSDe myO5E07PbruBRPX3o3clCV6HKSyBmK4a+mFgew5Ryar8N7ZT8mmpoFLOVpbGNu4cr4zZ tU95lbHs5UK0O3VRCnyWL6hd8q4ITRcpGOeCwWlIsPeyu6WiN8VzuAmX09N4yT6inQ3N NNThykNYa5esu/T7k0LKnm5X8udJsZd4A4jpisIEj6kfo+98rmdYQRLdOEDv+sT4mb8l r4+Q== 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=cutmHWKlIHi21iMgNNh40sQAOAMRR/Z5ERVDwteMD+o=; b=RNfWmbZ6gZl+fsG74mf2TKiKzM7hFdkL5M2B0TfywLsZMxcjQtOJvn06S6vyBIH8al 91fsF/SGdIipJxju33CoHpAzC97A7oj/xK2oYIR4xgII8T1ua3OrRFNtCrLg/Bm+SY2g mlG/XB4cglDi4qGuvy+0wl2GAH1xvt426OFyTBuEl2UYvUVgDnDWypMSWCv707KHJb64 d4y14pJhjIMwK2Z4mvD195+8kRkThSkQsK78TwHsWeaJnhODueh4myC0CEFiRiKFxKoG IHoWmauzZzqR/vUydv0QELlk91nNAHhuPv1C8OUGD9UESf1idOIRBSLy09ys8Zk4NWmr J3lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="v+BBqbP/"; 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 c187si2781501yba.355.2020.08.05.11.20.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:20:10 -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="v+BBqbP/"; 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]:53186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O1K-0007po-D0 for patch@linaro.org; Wed, 05 Aug 2020 14:20:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyr-0004Xl-7W for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:37 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:38336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyo-0006UG-Pf for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:36 -0400 Received: by mail-pl1-x634.google.com with SMTP id t11so5929693plr.5 for ; Wed, 05 Aug 2020 11:17:34 -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=cutmHWKlIHi21iMgNNh40sQAOAMRR/Z5ERVDwteMD+o=; b=v+BBqbP/zW2O/aI07r/sbKM8b2Sp0TgB9piY0V+HeJHhVB+wiSGb/WRhBgFldUSd/a EzSPZ4gGRNoa932xDw9+piLUL06pF531fpIDQjcwibiCf5kitz+az5+qGlEfENoeXSRA XycLxXEOiipVissdBxlfDy42+Hpp6yNuC9dvhImwAlsv6yyEzSmZrz4g/Tt8E8LJx764 Nub09SWSChP2uf2RGNEIyQawZOTWr3rTymr/E1Fc0vqvimGwDgS82qN5M+8w4Ln5Ezcv 1hXKLnRB/SNOlFuew7+kYwClUkuHds//regjqEzuH6Yucl3voHWOb8nnWp/usgdOsyaQ VSOA== 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=cutmHWKlIHi21iMgNNh40sQAOAMRR/Z5ERVDwteMD+o=; b=tOQVIXrgjgKqxXVL9UR7Z48x3H/AnYo8Ix486K8QuWCPrL3TuQKlYFiEOwXOVfzuXM NzYTdfWfUuKBFVcebvc5LgkTDWWvplEMHSRr9QrlP1uBnP3D/Xiwej13G97uPMOCdpAM lT13L1BTHmCtfrIh7jDRNwDGUQPglGuooWMttUSpA4nUxyRJ0KVZHZaOaH4uqv2bNwgq /z8wYxBoGoqG7kx5SmdZTLv7KXtnmr0Qwby8EOzfyC7FUVwSRT0A2+vVAzkYsu9RvehS R9R90YWK9pawwhzC4f/4kJdOxijz78OWhIn7VRJH70SnZ52wMD6aMhoJQC87m1hIva8f 2PmQ== X-Gm-Message-State: AOAM531msnf26qpcZDa4kO7QwZnq9gnqiPP/tlXHUPPb98odf6BTGuGD QcqUnjMnLAPFEWF1XZJ+3TVa4YjMq4s= X-Received: by 2002:a17:90b:19d2:: with SMTP id nm18mr4588554pjb.124.1596651453081; Wed, 05 Aug 2020 11:17:33 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:32 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 12/21] target/nios2: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:54 -0400 Message-Id: <20200805181303.7822-13-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::634; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x634.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: Marek Vasut , robert.foley@linaro.org, Chris Wulff , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/nios2/cpu.c | 3 +++ target/nios2/helper.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index fe5fd9adfd..fd05406eac 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -102,13 +102,16 @@ static bool nios2_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { Nios2CPU *cpu = NIOS2_CPU(cs); CPUNios2State *env = &cpu->env; + qemu_mutex_lock_iothread(); if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->regs[CR_STATUS] & CR_STATUS_PIE)) { cs->exception_index = EXCP_IRQ; nios2_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } diff --git a/target/nios2/helper.c b/target/nios2/helper.c index 57c97bde3c..46d53551d4 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -52,7 +52,10 @@ void nios2_cpu_do_interrupt(CPUState *cs) { Nios2CPU *cpu = NIOS2_CPU(cs); CPUNios2State *env = &cpu->env; - + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } switch (cs->exception_index) { case EXCP_IRQ: assert(env->regs[CR_STATUS] & CR_STATUS_PIE); @@ -198,6 +201,9 @@ void nios2_cpu_do_interrupt(CPUState *cs) cs->exception_index); break; } + if (bql) { + qemu_mutex_unlock_iothread(); + } } hwaddr nios2_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) From patchwork Wed Aug 5 18:12:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247462 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp761997ilo; Wed, 5 Aug 2020 11:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIFdynzCSqhd+fCaTYOydhY/TsaOdxX86tpjH3ZK4MwYUWM5ORp3bmoBKWbSiaWpSlO00W X-Received: by 2002:a25:6b0f:: with SMTP id g15mr6232867ybc.119.1596651825265; Wed, 05 Aug 2020 11:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651825; cv=none; d=google.com; s=arc-20160816; b=0L+tsJl6Q19LdwsrnzGcOYXNnKFLJ0trn7tioERfDzMGftEkLwc0jNcRdLhNFnxChv Oaxy3iOWyMAd4L5JbEX2maNkJub6gC5MrG/yFitj6jey0b4q8EzUOi5y4CQlizJxS9Sr lkvAbLM/xcwEqA7ueLndzeGgDJaeH6Dgyc6gPLn555ywypsJvwFq78N69lAy4pnl0NSP OKXvkviEej5UtTvQPfaY5xjYcfwL2Zw+eYS8jY3cV0ZoDWKDHYtYRACDHC9l5SjQTw8W ylYwKBoq4ovxYwVGf6W/DBQZjb8qgaJ/1AxX4gvyVW7tNBVNbP2lNozHTXkpfATbQRtK yktw== 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=JEsnnFYRnVZaq0i2DwuNSLaqhNKEKeJEaJl1TkjXWDY=; b=LQMrh6g7ObiPold15HtHHl5nuMUNyU7NBGxCoBgUe1aOHf+Z2wTO7uXwWm2+UJIdgk WJPKu+KI0lamK8VIxg3AQIAwknf1AyIycWm51SEs+4tdHbEzXXNq09f576cHfACleRZ9 a2S7pnyDrYHtgJjcts5kGTlO8IMYe2qj8LR9EkUz/yOW79b0WwcT83lqlO/PCln1GkA6 IlffdHZ3P1GVr0dBfVY2C0W0IDtDIhYnmysF0snBnKCPvjG6l4M5gozhymh47hABUDU5 3ioq4zJlxNcK7st+svFZub63OVKnoNpBrY9fSa3w76MVqGvtZ2XZ37VPUtTSfA86m5OZ 3Aow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PZrgCSmK; 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 a2si2555837ybo.134.2020.08.05.11.23.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:23: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=PZrgCSmK; 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]:40166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O4m-0005dQ-NJ for patch@linaro.org; Wed, 05 Aug 2020 14:23:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyu-0004bc-Dy for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:41 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:33810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyq-0006UW-W0 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:39 -0400 Received: by mail-pg1-x532.google.com with SMTP id t6so24960072pgq.1 for ; Wed, 05 Aug 2020 11:17:36 -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=JEsnnFYRnVZaq0i2DwuNSLaqhNKEKeJEaJl1TkjXWDY=; b=PZrgCSmKb1oY1ZGeU/YExUk6KMJyebctyIkNwjN8iZl+GCeVQzj9zMnUA5xHiGm44R oui3/hc1hBukPsrDR2dKR4vOmAOq3rpMj1SyMSzH3ct6FJ8l6MqkUmygnWof8kI9k6FT 6wyxw/5G60uhr5zk4t5833ZbTvYPclMttmEcwDhNvHamf/QKHRgiIJqf3lrPtKGyTByT 0CQy5Nf+Xdm/MsbGmpnJLgV4BKBgimM9lgKLlWIXf32OCzIHzxsIfmbBcKTjc8483Igt 9rYH5KodW3ZHTfqgbc6wVmUUMmo7yrk/sgTZDw4OxvbeeojikP3ZKvphGx7ztAGWH8Yw l9lQ== 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=JEsnnFYRnVZaq0i2DwuNSLaqhNKEKeJEaJl1TkjXWDY=; b=tYmkpx7ZHhVJIY9omTY63KuiCLvR4reS2xyMbYwccCgiCDmYzsuWv69fWPYHBnqDS/ t52uL41N6TnYxtdkSqzrSrlhmvf+wIiKpXmUhLD1tj/CczhL4DWdPKX9dm4W+WeEWyf0 BhJxesenvK4D0fAeTCuH+ItrqDVEWLuawJ6AMs7Fjs/dQK2jK5bDzA9WnOZjiXQ07LJz EWDqPI6JGYwqr6w6kFTghXZ/VSOH7OhcBGSGvC/aQcTR2slas9458LvyJy2yzQUTgEF+ tMzFs2c/yJD2sMZS0ShE+H1Xam9pM4UMX3ii8N6H1Z3vYOA4yghOkmIkFDvNQQrra/R7 8QFg== X-Gm-Message-State: AOAM532Eq0PXyP6mBX4OdBVN2ZkQVkvwM9Bjl2RJ2hSX6sX1xsZeRe/K a8XKIhjR7nnDF49hwTwqLpHT7Vm/LYE= X-Received: by 2002:a63:5012:: with SMTP id e18mr4028460pgb.169.1596651455325; Wed, 05 Aug 2020 11:17:35 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:34 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 13/21] target/openrisc: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:55 -0400 Message-Id: <20200805181303.7822-14-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::532; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x532.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, cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, Stafford Horne , alex.bennee@linaro.org 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/openrisc/interrupt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index 3eab771dcd..361f242954 100644 --- a/target/openrisc/interrupt.c +++ b/target/openrisc/interrupt.c @@ -28,6 +28,10 @@ void openrisc_cpu_do_interrupt(CPUState *cs) { + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu = OPENRISC_CPU(cs); CPUOpenRISCState *env = &cpu->env; @@ -99,6 +103,9 @@ void openrisc_cpu_do_interrupt(CPUState *cs) #endif cs->exception_index = -1; + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool openrisc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) @@ -106,6 +113,7 @@ bool openrisc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) OpenRISCCPU *cpu = OPENRISC_CPU(cs); CPUOpenRISCState *env = &cpu->env; int idx = -1; + qemu_mutex_lock_iothread(); if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sr & SR_IEE)) { idx = EXCP_INT; @@ -116,7 +124,9 @@ bool openrisc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (idx >= 0) { cs->exception_index = idx; openrisc_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247465 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp763410ilo; Wed, 5 Aug 2020 11:25:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn/mBNVcGr6YYCwkKJosUd09jYt0sJXebGkyvap7geGpyPWBQnEmCLVgWgaBTDt3pGdeJn X-Received: by 2002:a25:e016:: with SMTP id x22mr7203850ybg.9.1596651955769; Wed, 05 Aug 2020 11:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651955; cv=none; d=google.com; s=arc-20160816; b=qsV6cZnxK2KEsmV61oce/o8BYJb5rkO9idhWjo8RC8OQV8sce0zMcvj97JafyZ153o /g3CM5XVuvZCW31JeZYqQ5Z44gspSkXcePoN9vYjZGsUaCkqRMHSuihYxnm6dvF4uCtv NrkiKqcByJqi9QACWHjwOeJgvd5m8/CjOuLlVKRVlHNmBaL0MDHT6iuZ4jPOJdEuXlTy X8YXa/xBNTOvfiCS1tvQmpDNsKAc11/tlyPrEVVH7y+ha8T1Mgmr9NC+oWZs1q4c4EA+ cJOeUoSFV2YioVlUJyn7bLtw3uGbr2eQ89KuWihA3KRcjy90mp9sDxQbq9mAH7KAxTVP qy/g== 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=cGAJoan4B9O593ZoXcT9RzOP5KLkia4jZDLI7E+9tcU=; b=08frgUGEVT1E+yEOVjPkdNW10JYluwTeRmWRmJnk12CIZIlfkLDXF5Xqacu+7DZIGv cpIOVdyPfpaxX2G7yJ9uvszlrk/xuPntlH0nkljJHVEyHH8pirDbzva1IcZwfhZi8hGf VFMacDPV9yvC0lXa7mGmnP/u3GESw9rNh4q1pSojb73eL/JgvmG0gNbVwXhfUSVJvJ5v PE28jejcnst7D/CIXnTZu9agGfkvRE4Ek5K9KEjUpIWFEwZFgxmpVQil0w7mctRB2vmR uRXQOaggKmB8319jaBM8ejy58ohAYNC9tuyvC7JRRpaXH8Z32kttDl35zOxp18sHsI20 D9lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Tds7I/U9"; 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 a2si2560580ybo.134.2020.08.05.11.25.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:25:55 -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="Tds7I/U9"; 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]:48644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O6t-0000ga-9u for patch@linaro.org; Wed, 05 Aug 2020 14:25:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyv-0004cZ-Md for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:42 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:42201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyt-0006Us-OH for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:41 -0400 Received: by mail-pg1-x52e.google.com with SMTP id j21so6223070pgi.9 for ; Wed, 05 Aug 2020 11:17:38 -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=cGAJoan4B9O593ZoXcT9RzOP5KLkia4jZDLI7E+9tcU=; b=Tds7I/U9g+SuWu3CENUS8yD1R6zMlB5mTn7dhl0J0a5fepdDTWILnXeyycKssYyR2r gS045Vy0TsdF0SLOnqf51zEBNnC/x0tPThj0r7n46eo0/4F+qsOANI5opv8ulp7TjDmW tBAJ8LEqnfuKVpkzk+BxmNDGJMkY640ScQuFp50gZqK1OaHl7tpCkOd+HonCIg20gglx /LOJKlwm0Dv3ukxOlh6KKBWUISpTxqQ4+OGDw5B4CdBFqr6o+F88rQTXs38z9SqKWAWc uAoWwbVhk89ILt5RKpBBbpt1qWoOYvfQgTx5Jk0hlPL3inrbVCRhnNimA7V3VqBEjQnj +RRQ== 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=cGAJoan4B9O593ZoXcT9RzOP5KLkia4jZDLI7E+9tcU=; b=RqUiGnCV4wcJuuC8Xz+XLLvsYJexU573pj8pGah9XB9AADT86CVtnrZmgpg54cmPy/ s3f/qZNGxHkw0fZyJYxBfbPpphjSvbPw16S4BfBxsOYEHWdJ9A0q8moWIhfDnYDWunVL 3dRzm1UgxCX6eY+rTEywBI8VrKmF7zp8ONOLTj8G2zOkOHa295vVQoRUAj79aJqpQMpm b3VkC6LmY9F3ZQgNSC1YsTGqKr44vjOzpoJ3iyTdslAqCeK3tjdMtMXLEZsiPWw+1Agm SBIzKBfPiQ5K0B9Utihy2zTZzv4V18BKZBycjvztMarcy3xF0rkg8MXhLfxQvrTs463m FGZQ== X-Gm-Message-State: AOAM532A2EINgLyh+NwkalLbXmxdFYXMenEERr6osAKJu5MKaUwvC+Ay yCkALre1P0/fxf/ccHaZTtRc47kzW34= X-Received: by 2002:a62:1901:: with SMTP id 1mr1143829pfz.160.1596651457654; Wed, 05 Aug 2020 11:17:37 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:36 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 14/21] target/ppc: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:56 -0400 Message-Id: <20200805181303.7822-15-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::52e; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x52e.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, cota@braap.org, "open list:PowerPC TCG CPUs" , peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, David Gibson 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/ppc/excp_helper.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index bf9e1e27e9..4530230d65 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -870,7 +870,9 @@ void ppc_cpu_do_interrupt(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + qemu_mutex_lock_iothread(); powerpc_excp(cpu, env->excp_model, cs->exception_index); + qemu_mutex_unlock_iothread(); } static void ppc_hw_interrupt(CPUPPCState *env) @@ -1056,14 +1058,17 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } From patchwork Wed Aug 5 18:12:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247459 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp760839ilo; Wed, 5 Aug 2020 11:22:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHsO4vmhWU32MRHyPoHtBWqPtYpiFxaCezLm7jq4UxAKzfaiIcDSpehiOcFJPlieIfL8Sg X-Received: by 2002:a25:2f83:: with SMTP id v125mr7348951ybv.202.1596651728818; Wed, 05 Aug 2020 11:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651728; cv=none; d=google.com; s=arc-20160816; b=AoW2HtZxV2vdLiYnXf+c3YkIZ45XLdRL+zdgr/cLEDYOIfmUG6JDvpURyw+BWcTisO jIUUEJ0obJ+PrqdeEkW1X7ZefFuFamveuMfa9gPW0l+3LWOiY7bh3Auc5CzB8TBkyEek XDZwDbPlvFYvIqx5LRSq0OqyTHKmcUFR4P3AV97KqzFyZFW0gV0iNGd/5MbWRLWhpkmX ED0xCk1+Ys/ooy10yBuRKCw4032alZk6514zmQgjXcxZhhtTE1FIo/iCJEoqDFKGscA3 Jl/tw0IYJE9UaIqJDKbpaA5VDaxOwpQteeQc94dEByomlj+WVUygjGBBTEUY1Z8CTfW7 c1gg== 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=YM01JZCOBFTkObfq+41JWuhzyHiJWJ7EohnvO1vdIJU=; b=F0A31SbOgXBsiCTzMzHVuyWkKUSkYgNGyZsQ9Dhx5Yyr/xYuyf3sLWLqfqTPykfyBz Gzaqg10CVUJn4Za7+qpG1jt+Vx5c4qNjaBfo8Q/7ZRysiUwiD2ppVQBBQtzV54uys58s XStAcsaEBNYQV7/O34HwJd8PsmCKntMDzV9oMo7tf9iujB/+ZHpHSzEOjk2IM2TK6XDy +HYZkUQbXNOLXbxABU6rDY6WAfOYPlDLesJN3lKoJZ5w5Yj8NYcb0aY4OPkQOoLL2zfV ny3m74GMY93RkBJeRZihgopNY/+49TuDlP7OP55lFl4yFhCxzN+LivacQJI7EZuXv1rs l0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="E/xsOwj1"; 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 o128si2865576ybg.8.2020.08.05.11.22.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:22:08 -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="E/xsOwj1"; 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]:33360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O3E-0002rq-9F for patch@linaro.org; Wed, 05 Aug 2020 14:22:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nyx-0004eW-Nx for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:44 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:45852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyw-0006VE-0u for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:43 -0400 Received: by mail-pg1-x541.google.com with SMTP id x6so9768012pgx.12 for ; Wed, 05 Aug 2020 11:17:41 -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=YM01JZCOBFTkObfq+41JWuhzyHiJWJ7EohnvO1vdIJU=; b=E/xsOwj1out5jTDw1B6uHewMdZZssRhI0qYSGvOkDZ8q6nMosifaO3SUYGRsaBrefG lCS6oar456DouWXOhlB8jJwebXTQJBkXUBBT3yMi31IV4n5ivkGztic6TDWfqGKUTl5J dAlDI4wDLoElA1Q13fhWkuZPLGirHNQtYZtr5WQyIXDJFAs/T0fzVaQZ5E1tBjz1E//v cLbSnZVD5h+HDdfIPibvT7lx4V5TC18YZc3vgwxZLDCp+E9ZEHLOre+dDUhrjxPxDDyD ETTYsY8MPdmf7V0Kgh2qNVG73U/Heu4NEuXS+HXK0q5RG4oD5BFGQqJXDJAI9Me8IAoI vuiw== 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=YM01JZCOBFTkObfq+41JWuhzyHiJWJ7EohnvO1vdIJU=; b=HKCqMhJRNBgOe9v91gCcMTZTwsUkMgraDPYZx4tYopsyh+OD+wIeNPC4T7PrlGLAZZ TBRG5fMM5Y1gClBpEGEdpwoC6BtSXvJdh5sVHZpVSasevyOqJmvCNdFM2Ru3MzaGFOsq JIY/1rfFjw9ZZfYEnRZIWVx7MIC/vuTJHueRPTdTJ/VkQGCYsGLKdpBRuoEDSIal+BiJ UfeQkMEus57YyUUixqhxfHeM0VMvDZuFkhN8FU2btXCg7qg7BMGeMRE6T9i/sxBsv7x9 cOzyqX0AM4IVZ2tjManWEykUtbGmfKHtn2+IepWR4dnJggS757SbJ4n7yeAAl9v2XyoL wszg== X-Gm-Message-State: AOAM531DIrA7tfrRFkVeoduLeayNzm71KNXNXagOACH0Z34qIbeSaiQH UFNofoRrbGu/AOu/ihdQx7kUVHA7Nvk= X-Received: by 2002:a62:647:: with SMTP id 68mr4820009pfg.45.1596651460295; Wed, 05 Aug 2020 11:17:40 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 15/21] target/riscv: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:57 -0400 Message-Id: <20200805181303.7822-16-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::541; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x541.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=unavailable 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: Alistair Francis , "open list:RISC-V TCG CPUs" , robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , cota@braap.org, Palmer Dabbelt , peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/riscv/cpu_helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 75d2ae3434..5050802e95 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -80,14 +80,17 @@ bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { #if !defined(CONFIG_USER_ONLY) if (interrupt_request & CPU_INTERRUPT_HARD) { + qemu_mutex_lock_iothread(); RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; int interruptno = riscv_cpu_local_irq_pending(env); if (interruptno >= 0) { cs->exception_index = RISCV_EXCP_INT_FLAG | interruptno; riscv_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); } #endif return false; @@ -822,6 +825,10 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, */ void riscv_cpu_do_interrupt(CPUState *cs) { + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } #if !defined(CONFIG_USER_ONLY) RISCVCPU *cpu = RISCV_CPU(cs); @@ -982,4 +989,7 @@ void riscv_cpu_do_interrupt(CPUState *cs) #endif cs->exception_index = EXCP_NONE; /* mark handled to qemu */ + if (bql) { + qemu_mutex_unlock_iothread(); + } } From patchwork Wed Aug 5 18:12:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247469 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp764960ilo; Wed, 5 Aug 2020 11:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjyALwb9qlEoEa63soZCF95Mhu9QNTXDzKqxVT8d2iMTpS5+BXjA+VUGyshZjdlKP9BvJU X-Received: by 2002:a5b:b91:: with SMTP id l17mr6612335ybq.276.1596652098083; Wed, 05 Aug 2020 11:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596652098; cv=none; d=google.com; s=arc-20160816; b=oLsiqKIURI/pfwNjDvFCisIxEAAWNE7uWTAib1/LhRYp6HfIjpAqQ4mkxGmmMFSiG7 UCgU8PgUlNQT7IHz5bRPq2q0kG6g0/okSHiuoE3BHwbnC8Csvt51NQnT6cw8q4UdaFpB /dipgJ0gkH6jM+IoE+Zl+mYBmZjFKzkonkFmE+QMKSipPtYUk4yTQE9wQaBc4g4okVKf biv6GwIkgmttfSI4rZ0m2smi4dgYCJavVKNNeOesmeqatWlkQgkyD2RY7PlDxuOR8SJP msrRmEedtiY5IgA8YYJzkMPe0zPUjSv/RIVLkcOgPJ8sT50vbb1Iu47AQM+fwfK8bCEi omQg== 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=JzRY4u611ZdJJJ8DEPsiNDmT76OIm6iIPSor9aPp4Js=; b=fR0Cb1DsyKaKVZk2z0qBBf8Vc9iq+8basD8CG4FvLbd15hK/0m0lC1H3Uxi2ZTeuy7 7IykAbjrZnEITVISHS/vvoNkb/wJmzgcsSonrSJeluiRsRtYhOXsPq4y3RipSShzfLmM GleRQZaOYBWGh6jnzobS1xJ2fXEhd1UZR2W5Ojy2c1RslPvSc17ebaVzbHQN9RoOEaji 1NGV5T5umlheQ6TaGbriQKvSlMT1dP7Sonh7OSoUK8Q134VQmZy6+3+e97OiFDANe9G9 VZVXAMNQgv26a8G4Dh4Ias4lmGFbrfJmOQ2qnNkJcjcuEvHKyTtilJo8bbnm+PR5earN XoFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jw+hFPvo; 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 w15si2476160ybk.89.2020.08.05.11.28.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:28:18 -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=Jw+hFPvo; 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]:56924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O9B-0004Cx-J3 for patch@linaro.org; Wed, 05 Aug 2020 14:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nz2-0004hY-4u for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:48 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:33227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nyy-0006VW-IX for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:47 -0400 Received: by mail-pf1-x42c.google.com with SMTP id u20so1266839pfn.0 for ; Wed, 05 Aug 2020 11:17:43 -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=JzRY4u611ZdJJJ8DEPsiNDmT76OIm6iIPSor9aPp4Js=; b=Jw+hFPvo12d3SzroLf6sE8yRIdWsovt/PtjWwfq///ibh32KL/jD2mtDE/rxSh1ogT SyooaIom4hPIWQOo6gg2z7xP1SpuyMmWTsJxrc+CTK50OOG6cGha3uFswAlSR4cP3+uQ nSJp+30fuqRJgnij/j54TCYnshNHDjmwswEEYl9+y4HuY2171QHH6sI+XTQYVXswswM2 BMIv9lw61gcPkLqKWxyncXWumq+KcJyD46gKFnY1QViGouHuEthZPHBrmlMkLHe6J6aE xblHOaOzILnVytoOYF1B05xJYN1lY3xNuZyOxvHROVAoQegFk2MGCGbDmMPzHwwSZzu3 VnzQ== 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=JzRY4u611ZdJJJ8DEPsiNDmT76OIm6iIPSor9aPp4Js=; b=WNCaP8PRP0rkH+f5cQQbZVlOgYdfF1t7fdAUKqurOM3V9cFc547Rvnzgkzw8A+tZEw WChY+Yr+Rc4py+PS0EnUEYRLGw5Cx3WzHd/9KB9MJGUyi7Qhk15mSp2J2wuhAHt0Gkb9 lPbQqXh/c9LOVmdgyhlFxYFBNg7Y7qsgN8+rdenPSvCWfnPVaXUKLfTVceCF3yYHzbQX qUMN2lbRE0tJaRZ3QSG4vdXlijrI7hrH19VaetCBDQs1J2f1wflwYt3CqVKusrT9IjPk qUZuJY07xy6K34xkChQIEtj4qqPlcFRBbieAG+uAYtUCEmbooNJ0+4iqxZ+huDdpTHrz yLnQ== X-Gm-Message-State: AOAM530jxP5bpPVY377bkwv0/sqV4spd9dwoI25Qm7QtQUJmzyYNblb1 7gtom9mIkC3mHWIhQO2FHW7T6vc4Qa8= X-Received: by 2002:a63:1a44:: with SMTP id a4mr4130118pgm.281.1596651462691; Wed, 05 Aug 2020 11:17:42 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:41 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 16/21] target/rx: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:12:58 -0400 Message-Id: <20200805181303.7822-17-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::42c; envelope-from=robert.foley@linaro.org; helo=mail-pf1-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_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, Yoshinori Sato , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/rx/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/target/rx/helper.c b/target/rx/helper.c index a6a337a311..a456b727ed 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -48,6 +48,10 @@ void rx_cpu_do_interrupt(CPUState *cs) CPURXState *env = &cpu->env; int do_irq = cs->interrupt_request & INT_FLAGS; uint32_t save_psw; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } env->in_sleep = 0; @@ -117,6 +121,9 @@ void rx_cpu_do_interrupt(CPUState *cs) (vec & 0xff), expname); } env->regs[0] = env->isp; + if (bql) { + qemu_mutex_unlock_iothread(); + } } bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_request) @@ -124,6 +131,7 @@ bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_request) RXCPU *cpu = RXCPU(cs); CPURXState *env = &cpu->env; int accept = 0; + qemu_mutex_lock_iothread(); /* hardware interrupt (Normal) */ if ((interrupt_request & CPU_INTERRUPT_HARD) && env->psw_i && (env->psw_ipl < env->req_ipl)) { @@ -138,8 +146,10 @@ bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } if (accept) { rx_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); return false; } 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; } From patchwork Wed Aug 5 18:13:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247464 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp762231ilo; Wed, 5 Aug 2020 11:24:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBQB9h5guHqFo9Zjt/hqGZ4z75VxeOa/6/Usm/98mt5q0pBHCBiXOFGZCmwqjN6kc0Oh51 X-Received: by 2002:a5b:78e:: with SMTP id b14mr6784216ybq.408.1596651848081; Wed, 05 Aug 2020 11:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651848; cv=none; d=google.com; s=arc-20160816; b=CUxhw6jD7it2i00IoOHXEF+Rx3UhpCZvBSVfPRyF5AdD3iDWXkYIpg7Rr+gySoCGgK +CE9zRkhgpFknzYtgHuziJFLowumZz/3kwlkodqr9osNoAEi7OC/R2pQU8hPsSzLiCYc ZGQE35XVnIGUPFpMS4VEIdi6p4f2WZ1t81yWQgjYYgLaFD5pN5+nR9FLP/UnIs6ywmSM LwxHz5NA/vwPA+Ewl69DshsX19rnqtFyvSo1bNKal/s1ZsJKUh6Bz7pdmH4aMC7h9tvI SsO0CnP5+5WeCAXVSv+upOiEvPglYE4wkEC26/oVTt76yiCQIx99n4zlPShR0WHQicsv A+Ew== 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=eY79OI2NziyEJvuRHl1nh9tYXBtyJDeusaPNFa05tj8=; b=VBmCTl72+JVU7sBXHhZP/tesKFVDfysnK1iwtxQnK1fFSyHiDh7JYIKpj6Z69i1XPc w2qvGpvcOA5lSBXipIt3hKaMTwQLq1MBw9Z2aHr6VO5B2gbeFO6L5olIErr2oI71fpQD HnpYA1/S8vlR1gpn8mZId9f6a4GHPO5qkD+d6ssvY3VU9/o8PBT2uhum9170ch4B61CD BTrFWvSAi5brbc5Wczrml/rOSvTjf3Yck9WFT5L8S/zLpfLn9sqlmRZUcKa30m+5uiZ8 FOwUY+6WsBljDNUgX3BMOkGwz+MjQT2KXHJZoTddt+kRw6qdbkmKgVXpmD5/2K7rYHlC yMBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wej9GzQV; 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 x2si2309618ybs.364.2020.08.05.11.24.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:24:08 -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=wej9GzQV; 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]:42036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O59-0006MW-GD for patch@linaro.org; Wed, 05 Aug 2020 14:24:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nz7-0004oi-Jb for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:53 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:41044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nz3-0006WX-DL for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:53 -0400 Received: by mail-pl1-x642.google.com with SMTP id f10so830593plj.8 for ; Wed, 05 Aug 2020 11:17:48 -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=eY79OI2NziyEJvuRHl1nh9tYXBtyJDeusaPNFa05tj8=; b=wej9GzQVC8LKvXsuCL2CxODp85b71XEKPDifhMVNT67NbQ+2Z9k5hnv+WVaFSv32mq thIhWIGJ0vgsECpMSD6yp/gBy/pMdnj+wdvdOGoS0hKk9vA5Az3HgnJtkqRUNC2XYJSl lm27BcNFgFC+9/K5H89eEmTY+uTTbvTJm/RMEFp14uv6sstlHBN70ueZsQv+HTrUvnsC T6TO27dbHpibU5Uv7pFgUZ4BYDu9danOngbv1KU9na4gJwMMaVW2MphempSv7dZooCKL KbZe0s8GFjzEkE6Ta0/gQxb4nn3UaWkievFiEKaukStJTNUnokcQPiD69wQK/XRCLotN 91oQ== 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=eY79OI2NziyEJvuRHl1nh9tYXBtyJDeusaPNFa05tj8=; b=Jpc247q5vsIBaLVDroICMDE2Dn7d7KJ30N347CttRWAYLZm7NLg8LuUBf+bxx096Bp XXznSaDmeLq2qWrI/Vt29EllqXv9aGrneqDgn6pop7fkxOZii51SfUJsSMYzQYGsC6W6 jkUVhWxESO39JIttESKp78y1aMlBuFUb3psD0PNbEq1aisBK9/zMwSaM2hxXm4WKGi0e UthRdbbv4ZDuEfGCrpOVJzAetdmG0mLCqKURIF5aUtqfflsUR7WgmTJa2bpAtjw+gT0x ykEVxrw1ff0QZuatkbEBIv70eOdHpzGF/EIYKflGMNUYsqukLADZN+yWb4mraCwMdaZ7 SHbQ== X-Gm-Message-State: AOAM531oyh9euUQ/urECIGQVCI6nRFoeviktDXL//oo4ahsSyTCyMzoE VPWOw/2CJyEp8tigSiuLQfNJU7Kqiyw= X-Received: by 2002:a17:90b:285:: with SMTP id az5mr4509628pjb.118.1596651467681; Wed, 05 Aug 2020 11:17:47 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:46 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 18/21] target/sh4: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:13:00 -0400 Message-Id: <20200805181303.7822-19-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::642; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x642.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, Yoshinori Sato , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/sh4/helper.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 1e32365c75..c4d5b9a374 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -62,8 +62,11 @@ void superh_cpu_do_interrupt(CPUState *cs) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; - int do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; - int do_exp, irq_vector = cs->exception_index; + int do_irq; + int do_exp, irq_vector; + qemu_mutex_lock_iothread(); + do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; + irq_vector = cs->exception_index; /* prioritize exceptions over interrupts */ @@ -79,9 +82,11 @@ void superh_cpu_do_interrupt(CPUState *cs) should be loaded with the kernel entry point. qemu_system_reset_request takes care of that. */ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + qemu_mutex_unlock_iothread(); return; } if (do_irq && !env->in_sleep) { + qemu_mutex_unlock_iothread(); return; /* masked */ } } @@ -91,6 +96,7 @@ void superh_cpu_do_interrupt(CPUState *cs) irq_vector = sh_intc_get_pending_vector(env->intc_handle, (env->sr >> 4) & 0xf); if (irq_vector == -1) { + qemu_mutex_unlock_iothread(); return; /* masked */ } } @@ -180,14 +186,17 @@ void superh_cpu_do_interrupt(CPUState *cs) env->pc = env->vbr + 0x100; break; } + qemu_mutex_unlock_iothread(); return; } if (do_irq) { env->intevt = irq_vector; env->pc = env->vbr + 0x600; + qemu_mutex_unlock_iothread(); return; } + qemu_mutex_unlock_iothread(); } static void update_itlb_use(CPUSH4State * env, int itlbnb) From patchwork Wed Aug 5 18:13:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247461 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp761444ilo; Wed, 5 Aug 2020 11:23:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhuzuiaxC2hLtHtVT2xKSGc14+/A9K3EC2XUAUhH067FwHNC/wQrz9VYTvpJn772oIIKME X-Received: by 2002:a25:868b:: with SMTP id z11mr6650573ybk.108.1596651782069; Wed, 05 Aug 2020 11:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651782; cv=none; d=google.com; s=arc-20160816; b=a882fsgmyWxia311eJ+gVaCfsNiMb+CJ1S7edODDX/Pp7wr6u5mTFRlpXQdGRoEdiP sH5DNPRBmMH9kBpyaa2mkiC+54Wk79z/eO+5OkJa2FNgTKxiG9pwapvUOFIYQ2oI9Sia FE/k7Bur0jEY/nJ82o/XIIuKerUroBf8jX7PQezhLwhBhZSjEsZhA/nEuKZD+/MdNL/K Q+yVC8dDI0xSkb+ndcXsNJDQL5WW9fcZLb7jxxppERm+f27QDFJjLelmk8CFwVG8btRL WE3+K6D64607nIBKzRMhg9+FPCeY9ICkn87YUFXogTlFZ5M8RAUCEH/KlhYjTfNNI7O+ Z63A== 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=8sH61aMZL0itQ+WBV8wzY8AM/bADwemnnaBh5BIpH6g=; b=kdYaiHw5Yb2UF0vDNc2f3O9LYnTlCKg2Ms2ap3f1YhKPRd0gx6Cwcdudew+B9KJE5u w15ZEgUFL3J5KIvPYPtI2YmvZg7U3MHikwjPnx+KMpBGpWF39lzIgmz/rvXTrUEACKqL rwjEUVCpSblNm7BF0VSkw75v/vrnQGfVOUq9Hx9ctRrGUBP+raAcFfnzfJzuPip56CrC TnFF9+STdFAP+NWRxYJxl0O6fBP7tBv2hWeK7fMwHXxNVKJpvnaWloETUdbUN1Lkhd7A uQKraZiKgpYBwQuQcn5lfqqkxwyg82eE8pStMyqcUxD3OiBO3KbumFAydFQrUXrwKWcj 8Ixg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fCz3LSoj; 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 s64si2920825ybf.217.2020.08.05.11.23.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:23:02 -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=fCz3LSoj; 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]:40446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O45-0005kC-FL for patch@linaro.org; Wed, 05 Aug 2020 14:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nz8-0004rG-Gn for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:54 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:39350) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nz6-0006Wk-Fc for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:54 -0400 Received: by mail-pf1-x429.google.com with SMTP id z188so15373864pfc.6 for ; Wed, 05 Aug 2020 11:17:51 -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=8sH61aMZL0itQ+WBV8wzY8AM/bADwemnnaBh5BIpH6g=; b=fCz3LSojL/mhv5v3nckhBGWRUG7cyv9P8hKllNSQNhq8f9Xv6dxbBwSEWCKsgs4kPJ vY8LnZA2mEUhRIsytLFG+XaPY1P+1sGKasspAqdbIgH1MCP2slmtPiZTv28xTr8k9Q0W JFBNABFtTbIaveWNu20Tki6ptKy32MySBRw9QKR/xhbT3ZZPno/rGbH7R138sUfKUd4+ wTYx2qWNAjGoy15zIOsf0j5MtOXw59FpU0SePvcpPR0wm4PZygbg9eKNXLC9dg0NXKHq 0IX5A8qXPLLwEVXmxbMy/HLeCm5Uum6dMc/VYS36mlAbvzL2yZqZLfBb3qpF+y0yxPCI bKSA== 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=8sH61aMZL0itQ+WBV8wzY8AM/bADwemnnaBh5BIpH6g=; b=Vfr2sY6hsz69kH+BMdOMA0Jt36xVw0vRpFCayjyHMmC+kZRiGattdOuCIIAZ/9hiJQ 15o8iUjvdVd95sCwW+Ftii7tsjRLzpu4c0sgu853bKjM1dkBJQD6EZKbRhdEfz7OKpyK Ms/MmshAZgIes4N6slxUut2U258EWMqlrpcJwdPSldhCZl6az7/2feovF/P/xn02Necw Fgv05Zl/v49owqOkfPzfL+0yDpp6qYS0+g4WuWMfgxUCS+tgQfVP+AoResrXvTMdNcAQ Ol9nA3Hn9X6c0g+kigd/8hqxlaPbQrn7/ExtasT9g7ZV6BP7p7HJjMjjgHSS3EGUgSBn lLzw== X-Gm-Message-State: AOAM530KRmwCQeAAs98OQX07YRdRDZJiausuycAGpPjPYTV9UrNSQFrd Jb62/8Q8/AP+EvrmgVUweHVRh0LQXAk= X-Received: by 2002:a63:4281:: with SMTP id p123mr3853501pga.94.1596651469963; Wed, 05 Aug 2020 11:17:49 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:49 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 19/21] target/sparc: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:13:01 -0400 Message-Id: <20200805181303.7822-20-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::429; envelope-from=robert.foley@linaro.org; helo=mail-pf1-x429.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, Mark Cave-Ayland , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, Artyom Tarasenko 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/sparc/cpu.c | 3 +++ target/sparc/int32_helper.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 20c7c0c434..13b5a038e8 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -79,6 +79,7 @@ static void sparc_cpu_reset(DeviceState *dev) static bool sparc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD) { SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; @@ -90,10 +91,12 @@ static bool sparc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (type != TT_EXTINT || cpu_pil_allowed(env, pil)) { cs->exception_index = env->interrupt_index; sparc_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } } } + qemu_mutex_unlock_iothread(); return false; } diff --git a/target/sparc/int32_helper.c b/target/sparc/int32_helper.c index 9a71e1abd8..3940e945ed 100644 --- a/target/sparc/int32_helper.c +++ b/target/sparc/int32_helper.c @@ -69,7 +69,12 @@ void sparc_cpu_do_interrupt(CPUState *cs) { SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - int cwp, intno = cs->exception_index; + int cwp, intno; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } + intno = cs->exception_index; /* Compute PSR before exposing state. */ if (env->cc_op != CC_OP_FLAGS) { @@ -115,6 +120,9 @@ void sparc_cpu_do_interrupt(CPUState *cs) "Error state", cs->exception_index, excp_name_str(cs->exception_index)); } + if (bql) { + qemu_mutex_unlock_iothread(); + } return; } #endif @@ -136,6 +144,9 @@ void sparc_cpu_do_interrupt(CPUState *cs) env->qemu_irq_ack(env, env->irq_manager, intno); } #endif + if (bql) { + qemu_mutex_unlock_iothread(); + } } #if !defined(CONFIG_USER_ONLY) From patchwork Wed Aug 5 18:13:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247466 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp763428ilo; Wed, 5 Aug 2020 11:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx63rmlP3ma9fADK8qeTvJZGbuski8UCy/wNlQSen262MZpqkjkjIlZdX0N54/QGgj9k6vk X-Received: by 2002:a25:5545:: with SMTP id j66mr7062287ybb.232.1596651957803; Wed, 05 Aug 2020 11:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651957; cv=none; d=google.com; s=arc-20160816; b=cIa1x93glfkJeBs+VU6AxMT9N4D5xu9PS6YgHo25D7+CxDJ2MQBtc2xofkH+VDhy4T AbaRHIf1cMmwruPWQPN+GUr4DGm6PgdPCTEKjQKbjc199EafA6CZasNED6gDTKCKkx6h vHDpN4X5L5JbetlX3qsXzvfEVAISwPtJ3jESkQI8SsuQyXuz2veb2d8g5bYBY2NdowrR 2KgKHwLIjyeazKZKw5O8g9jz5pdZbtUFrFiyBgV3XhnYwz8oOeQcaAB/j65PcVGUJOTP /rYz3NPofx1rzVM/m2p7uyo9/rsb+KitlCHjKxrMtWOEgY15ZcxiTfeblwdQ+HFveERE 87Tg== 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=BjiLVDDEqoIBJt1y3HRzPMRPdgMoMf8GueSFlFqkhhc=; b=efr/JWvOGri52p1+UtG2U9bFLGzVCs9dE0CXS84BouaqdHbnmIO2XLYyYY80zK8lOv 53BZN3OmP4t2il+sKcQqZeuC4g872bQlCTX1zzXtuenSZkVXQD5CT35BSTiqzLlJ5spH nQB261D3WNsz+KkzGnwT9JJnpMzF07YLkDhmR0KgANDcO4r5/MB50n34EwBfAO5yHE2e uet19yA812KoCu9fqaxd/hfjfqofyHuncbKnq/wDa7QSeOiG7vXTe81lHYeO7d/BibJb 3RLFhPY95Y12tp4/OhaHb+ffGIk1ypfWbHbgDdXNpgGaJqcIk6E2uAs44A3O4uxeNnMA X8vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MBm7lEit; 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 s142si2526403ybc.291.2020.08.05.11.25.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:25: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=MBm7lEit; 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]:48876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3O6v-0000mL-8a for patch@linaro.org; Wed, 05 Aug 2020 14:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Nz9-0004tr-H0 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:55 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:37759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nz7-0006Wv-M6 for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:55 -0400 Received: by mail-pj1-x1041.google.com with SMTP id mw10so1079426pjb.2 for ; Wed, 05 Aug 2020 11:17:53 -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=BjiLVDDEqoIBJt1y3HRzPMRPdgMoMf8GueSFlFqkhhc=; b=MBm7lEitcGCY7AbHi6skbhjWbJ/rDY+d8AUujZEUhFJ8g19yEdbJIoVDsPDn6k6fEz 5oE5FQGhaA3JmmjbA3LNwzd6R3PCZcho9Lfb20LqUmUWp7f9lkOofRe96DwyU2SwkxfP GlcNfoVRXZCamvXErM63U6dD3Fsl+PV+cC5qOKoYp7UuNFbmmSSPlYUpXaVtxHnnYmGt eU7aK7VUeJvV+4LYVekRDiGmP6t03D75lEnnTDPYGQUbMarPhNfOeVeJL+pkHgJFSFko WWAjrJeQ/fol9wpFzihe09Rn9OOW1N1YVgSxbMJAqPLPldqkjbjt+P9EjLFQCnk2+0U3 XO9A== 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=BjiLVDDEqoIBJt1y3HRzPMRPdgMoMf8GueSFlFqkhhc=; b=KA3a/xFvPfiznAf2Sl3BgbKUgyEDxnng0fN08o1Ta9Fc5lWWFmTWomR+bhyojy3Za8 MjS5dOfuRJwZM+aUfOI5ByqgxclGNxOo6uLmgUR/mCOJkYoanb6p4XTNoLrwa+SpDQjm CTCijVqurgK/xEDGFK351u6fBSsqcL/DNRdE0Es4j7FAbMeSTMvCrU/A0qlWF8KokrWq kd/O3iYwHzALwpsKrbxbN60mhYE44OFBgi6Gl2RY0gDjURbvlyCSx5w3j1df1w0sMcgw 33PQND2YvHTGfc0sfwcq/yZ8KCaRHBOUUroEiDp6v/d02Ft/RVpa9JMGxzQNBPYvpXIx FzXA== X-Gm-Message-State: AOAM5301nTUPfw9num3q1qB/4Cp4Any9POHuTU2oHDmuwpTyNFDWiyBT MWzfiQM6RnzPUBepuHxk6pvUkqbumDo= X-Received: by 2002:a17:90b:1287:: with SMTP id fw7mr4323117pjb.218.1596651472139; Wed, 05 Aug 2020 11:17:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:51 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 20/21] target/unicore32: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:13:02 -0400 Message-Id: <20200805181303.7822-21-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::1041; envelope-from=robert.foley@linaro.org; helo=mail-pj1-x1041.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, cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, Guan Xuetao , alex.bennee@linaro.org 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/unicore32/helper.c | 3 +++ target/unicore32/softmmu.c | 7 +++++++ 2 files changed, 10 insertions(+) -- 2.17.1 diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c index 54c26871fe..d79284d224 100644 --- a/target/unicore32/helper.c +++ b/target/unicore32/helper.c @@ -169,6 +169,7 @@ void helper_cp1_putc(target_ulong regval) bool uc32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { + qemu_mutex_lock_iothread(); if (interrupt_request & CPU_INTERRUPT_HARD) { UniCore32CPU *cpu = UNICORE32_CPU(cs); CPUUniCore32State *env = &cpu->env; @@ -176,8 +177,10 @@ bool uc32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (!(env->uncached_asr & ASR_I)) { cs->exception_index = UC32_EXCP_INTR; uc32_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } } + qemu_mutex_unlock_iothread(); return false; } diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index 9660bd2a27..ca9b92aad0 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -81,6 +81,10 @@ void uc32_cpu_do_interrupt(CPUState *cs) CPUUniCore32State *env = &cpu->env; uint32_t addr; int new_mode; + bool bql = !qemu_mutex_iothread_locked(); + if (bql) { + qemu_mutex_lock_iothread(); + } switch (cs->exception_index) { case UC32_EXCP_PRIV: @@ -118,6 +122,9 @@ void uc32_cpu_do_interrupt(CPUState *cs) env->regs[30] = env->regs[31]; env->regs[31] = addr; cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); + if (bql) { + qemu_mutex_unlock_iothread(); + } } static int get_phys_addr_ucv2(CPUUniCore32State *env, uint32_t address, From patchwork Wed Aug 5 18:13:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 247470 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp765776ilo; Wed, 5 Aug 2020 11:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVvzLIQjmVgSG0aoBR9yWfeO45gpa+miQ+T1YpyYxfGfg6/ln0kErGVTxibTYYllQ0d2qN X-Received: by 2002:a25:be86:: with SMTP id i6mr6712177ybk.258.1596652166230; Wed, 05 Aug 2020 11:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596652166; cv=none; d=google.com; s=arc-20160816; b=XKXp2CubX7AUe5oQ8KZ6+HkdRQDIQrBxoTq/IeLfTou9amCGSNZYPHoYJLnZB9yLsy CsJf2BV36OIcF/yEdIUmKsFkdHHl5f3x3tBkzs7L3G9HtIcCJtubFYZ98W6p8itV4men VMJBFZR/QWw5IM+1ceA+9+/lh+T6tpQ9qHmIAeuAamR6QUqICEu4d8eXKNECe6mU8mxr YX1m9AtruE7Em9wxnANyHyzgRKzXTvsvoE8Dgav/PYYxs+btBd2O7WjiQcrBP08iwU+B zXTRn92AKFg7VVU9jTDHkNLGBmgXvS3VIXT0GNj43z5D2F3IT+GxOV6oHtZpNW+zzv5w rHCA== 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=f4dp87j0JbOgZeF9Q5qKD4L3G1MqZ8pb/SPlrQlUp44=; b=AnVD/Thutyr48bBpnM0ud0weiGWj/6/P55oEyGZvDqO/D7k5y0doICyrnHpYBfvPIC T5HZfHFvqoXiPC8s92GcSw/cns0E664yAQLTJaaBeZvz7eLmLVwSTjQDWPY4vUBNtD+2 YFfpm6KFpbpvJubnYMrZtMy0WcX+Rj/YTIy2pVQnVbXrCnsvJvsBrAOsRVxmXirckPOv NaEgNPbd+PcdwER29j8gPh4gnX/oX9OFM0P/H2s1/Cb9tt7GPNUxqAhJNxeSCKJwuU6c oUZEmABjDqx2RWfiHajiW12LABoYrXUKnlpOkqMrGCPsBnXlbWLbMzVM/fixbeGca2h6 tG7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ppsj5mQY; 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 k1si2500263ybh.165.2020.08.05.11.29.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2020 11:29:26 -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=ppsj5mQY; 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]:60078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3OAH-0005Xn-P4 for patch@linaro.org; Wed, 05 Aug 2020 14:29:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3NzB-0004zb-RM for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:57 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Nz9-0006XG-Ub for qemu-devel@nongnu.org; Wed, 05 Aug 2020 14:17:57 -0400 Received: by mail-pl1-x641.google.com with SMTP id f10so830885plj.8 for ; Wed, 05 Aug 2020 11:17:55 -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=f4dp87j0JbOgZeF9Q5qKD4L3G1MqZ8pb/SPlrQlUp44=; b=ppsj5mQYzg/Kr8tUEwM3tmcuTjfMRCrWF4RrbFmBPoemT/+eavST4FAzusKdk2UUAI bIfBxQRoMLAgPliH+m1CrXTBld+ILPMjtZkOkw3LwwDHYdWPGlPvRsqMg3yBy/Y/5B5v 6foe2wskP6azX/c+GclfKEOTZ+QDlKCxgHhSJ9ZryXg6nX0zUo6m66BjGAYWQcbcVYnj VlhTt0K8b/nnkg+FCSsVNIwfkVqNMfiE4kLTlQY0qEK3euuNZz+fIIvylURCsF9ItYDf /zt/sqEC3+Sq8CzrYnJlGW626qVn5JhjZWiQB6SXvbQotfp0GWo5jFQON1pDjvD2A2q/ 7L6A== 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=f4dp87j0JbOgZeF9Q5qKD4L3G1MqZ8pb/SPlrQlUp44=; b=GiZ2LE3AZ+6uLliPTgb4RA7sXN3cHWe2O08c6BMrv+REOzMk5Nq6ul+/jH9LcZ+iMN uRLHdh6c0zXvuxcE5LaZgzlad91A1LfBh2HrlwlmUk0aii57DOhLJe/A2dGaoIZeUW02 0xpQuxGB5UoNl9yooXwzcdvzFxxKI+ETDVKm8c9QQbVN4rs6Kx0Zrz2tVV0Lu3/xQEiV lLVVoXFxMjzPCT0NNU68wxUfvckrXFFwSK0/7dVLtamdkJ22C+k5At1Oqt0agjyDsLlz pdMhTU7YpqTznaTeiIZqUz0RuV1t7tQ1xhHuRYtehFDJBVgGQr9ru0TIC0LTre1GQqYm nsJw== X-Gm-Message-State: AOAM531RfA2MloInkold5lBcSRnA5IvYvtGYY3H7bN6FOfqFgxTcfa1I +wd2e5WXz8/+TbzolrvAqEVwwpNV8x8= X-Received: by 2002:a17:90b:14d1:: with SMTP id jz17mr33704pjb.98.1596651474313; Wed, 05 Aug 2020 11:17:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:17:53 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v1 21/21] target/xtensa: add BQL to do_interrupt and cpu_exec_interrupt Date: Wed, 5 Aug 2020 14:13:03 -0400 Message-Id: <20200805181303.7822-22-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::641; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x641.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, Max Filippov , cota@braap.org, peter.puhov@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org 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/xtensa/exc_helper.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c index 01d1e56feb..fd33a56847 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -200,6 +200,7 @@ void xtensa_cpu_do_interrupt(CPUState *cs) XtensaCPU *cpu = XTENSA_CPU(cs); CPUXtensaState *env = &cpu->env; + qemu_mutex_lock_iothread(); if (cs->exception_index == EXC_IRQ) { qemu_log_mask(CPU_LOG_INT, "%s(EXC_IRQ) level = %d, cintlevel = %d, " @@ -252,6 +253,7 @@ void xtensa_cpu_do_interrupt(CPUState *cs) break; } check_interrupts(env); + qemu_mutex_unlock_iothread(); } #else void xtensa_cpu_do_interrupt(CPUState *cs)