From patchwork Thu Mar 7 08:36:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 10842391 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 0E3321823 for ; Thu, 7 Mar 2019 08:36:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F13A12E5BA for ; Thu, 7 Mar 2019 08:36:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E588D2E6B9; Thu, 7 Mar 2019 08:36:42 +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,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 8D2802E6C5 for ; Thu, 7 Mar 2019 08:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726364AbfCGIgl (ORCPT ); Thu, 7 Mar 2019 03:36:41 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42116 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbfCGIgh (ORCPT ); Thu, 7 Mar 2019 03:36:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 989581596; Thu, 7 Mar 2019 00:36:37 -0800 (PST) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 65F033F706; Thu, 7 Mar 2019 00:36:36 -0800 (PST) From: Julien Thierry To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, will.deacon@arm.com, Andre.Przywara@arm.com, Sami.Mujawar@arm.com, Julien Thierry Subject: [PATCH kvmtool 09/16] brlock: Use rwlock instead of pause Date: Thu, 7 Mar 2019 08:36:10 +0000 Message-Id: <1551947777-13044-10-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551947777-13044-1-git-send-email-julien.thierry@arm.com> References: <1551947777-13044-1-git-send-email-julien.thierry@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pausing all vcpus when reconfiguring something at run time is a big overhead. Use rwlock to allow vcpu not accessing ressources being reconfigured to continue running. Signed-off-by: Julien Thierry --- include/kvm/brlock.h | 11 ----------- include/kvm/kvm.h | 2 -- 2 files changed, 13 deletions(-) diff --git a/include/kvm/brlock.h b/include/kvm/brlock.h index 1862210..7d81056 100644 --- a/include/kvm/brlock.h +++ b/include/kvm/brlock.h @@ -17,8 +17,6 @@ #define barrier() __asm__ __volatile__("": : :"memory") #endif -#ifdef KVM_BRLOCK_DEBUG - #include "kvm/rwsem.h" #define br_read_lock(kvm) down_read(&(kvm)->brlock_sem); @@ -27,13 +25,4 @@ #define br_write_lock(kvm) down_write(&(kvm)->brlock_sem); #define br_write_unlock(kvm) up_write(&(kvm)->brlock_sem); -#else - -#define br_read_lock(kvm) barrier() -#define br_read_unlock(kvm) barrier() - -#define br_write_lock(kvm) kvm__pause(kvm) -#define br_write_unlock(kvm) kvm__continue(kvm) -#endif - #endif diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 7a73818..2f1679e 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -82,9 +82,7 @@ struct kvm { int vm_state; -#ifdef KVM_BRLOCK_DEBUG pthread_rwlock_t brlock_sem; -#endif }; void kvm__set_dir(const char *fmt, ...);