From patchwork Mon Sep 17 16:30:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10603011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D393617D5 for ; Mon, 17 Sep 2018 16:31:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C08B92A1D2 for ; Mon, 17 Sep 2018 16:31:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCDA42A200; Mon, 17 Sep 2018 16:31:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A462A1C9 for ; Mon, 17 Sep 2018 16:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728437AbeIQV7N (ORCPT ); Mon, 17 Sep 2018 17:59:13 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53405 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728016AbeIQV7N (ORCPT ); Mon, 17 Sep 2018 17:59:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0F8F221B7F; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=nlsoG9m8yGUSHTs1R/APkFMFm0M3YeBhPrB3nO 6/i7o=; b=z6ufFDuzBOoy0aqrHOrpcyBfkirCFRko9MBPbHLpsSX9ivxDSRF2yq fX3IgDbnQ7BtoZI5R+k1RoUuMYQiAisMZCD9AxPgLpZbsIygF0O03gRNVeZ48HKF SerSSx0HxiATtcHE799LcL5TWRY4+ACnJhf+DfXmTjE5zU4FGzrEU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=nlsoG9m8yGUSHTs1R /APkFMFm0M3YeBhPrB3nO6/i7o=; b=Iq17SxsEd59oh1sMRPfo3p8PQxxgxSO8t HthgrGRVQVMdcDgPyPSb0a2H+I5K/4wFrlK95yV0h1axRjLKM7frY+gMAqWZEicy oNzDl/hUmP0Cr9DRG0Nb8YBJnVD53JN0KDP/lVfIMtSv/v86lPJwmo0bNKW985R6 5f+knQD8ba/wpe2YnYUD2PyQGl5JT3KTRlbN5gGbECff2DOt2C+qrfynZ6vLcCU3 YslcZkOzEGG3pvyw2Yy1EO2z8/hOetPhs4tGBSPGoKxNxurwWgB3NHEdgXNqJm0p kJ1JvZHSAbNcfSTZTmGnKjJSR+R/PIjTlL+J51ShP+C+ZNvmPtUug== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 43331E414C; Mon, 17 Sep 2018 12:31:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Aleksandar Markovic , Alexander Graf , Anthony Green , Artyom Tarasenko , Aurelien Jarno , Christian Borntraeger , Chris Wulff , Cornelia Huck , David Gibson , David Hildenbrand , "Edgar E. Iglesias" , Eduardo Habkost , Guan Xuetao , James Hogan , kvm@vger.kernel.org, Laurent Vivier , Marcelo Tosatti , Marek Vasut , Mark Cave-Ayland , Michael Walle , Peter Crosthwaite , Peter Maydell , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Richard Henderson , Stafford Horne Subject: [PATCH 00/35] exec: drop BQL from interrupt handling Date: Mon, 17 Sep 2018 12:30:28 -0400 Message-Id: <20180917163103.6113-1-cota@braap.org> X-Mailer: git-send-email 2.17.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This series comes originally from a series of patches that Paolo sent to me a long time ago. I have kept most of his S-o-b tags, but I have done the forward port of the patches to the current QEMU code base, so please blame all possible bugs on me, not him. The goal of this series is to push the BQL out of interrupt handling wherever possible. Many targets do not need the BQL to handle interrupts, so for those targets we get rid of the BQL in interrupt handling. In TCG mode, this by itself does not yield measurable performance gains. However, it is a necessary first step before tackling BQL contention when managing CPU states (i.e. exiting the exec loop always involves taking the BQL, which does not scale). The patches: - Patch 0 accesses icount_decr.u16 consistently with atomics. This is important because we use it across threads to signal that an interrupt is pending. - 2-28: convert direct callers of cpu->interrupt_request to use atomic accesses or CPU helper functions that use atomics. I have broken these up into individual patches to ease review. Note that in some cases I have added many atomic_reads, most of which are probably unnecessary. However, I'd leave this up to the maintainers, since I do not want to break things by doing a single atomic_read(&cpu->interrupt_request) at the beginning of a function and then miss subsequent updates to cpu->interrupt_request. - 29-31: drop the BQL requirement when handling cpu->interrupt_request - 32-33: drop now unnecessary BQL acquisitions in i386 and ppc - 34-35: push down the BQL acquisition to cpu->do_interrupt and cpu->cpu_exec_interrupt. Here I am Cc'ing everyone so that we can make sure I am not missing any target that requires the BQL on either do_interrupt or cpu_exec_interrupt. This series is checkpatch-clean, and can be fetched from: https://github.com/cota/qemu/tree/cpu-lock Note that the series applies on top of patches that are already on the qemu-devel list and will hopefully soon be upstream. This series begins after commit 4ece0cbd74 ("cpus: access .qemu_icount_bias with atomic64") in that tree. Thanks, Emilio Tested-by: Mark Cave-Ayland