Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2998680imu; Mon, 19 Nov 2018 09:10:02 -0800 (PST) X-Google-Smtp-Source: AJdET5c6Fji6IHSaqbVWrmu9rcSJudkzWw8IGSdU+K1gXjLyImzom9w7CF1zWAGl7mQXq6X2PnS8 X-Received: by 2002:a62:d70b:: with SMTP id b11mr10623769pfh.87.1542647402917; Mon, 19 Nov 2018 09:10:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542647402; cv=none; d=google.com; s=arc-20160816; b=1E0tMplyD1tZKeg67qfXfRHLTXGowLVo55eISD0xizoxTuUjfWR46F5pB89ahJKQ6W IJQmb8PcRDEfeovNSeWk6OHycnIGaW9Hswl1L4FCBYDj4VjUbCcJ8HrXErR2/q2QBGJ2 FWI3ym4alidDaD8ku/klYq0eJqmEBm3xmONyE49FX2/AMDTemHQf3W/yFkH5YrqHFQBv HeheFEY4p1x7OgmjiccNFXIDtIFrHJJuxBhSAtbH+7Rwj0Ld3aw702RPTzs3VHkRgO/m 5ArPuoCMeMfpiL0Mue2QMpqlmvbVcBspGqlv32HpT71lWrw74ag8ArCZT0F8mY8rRyJw DyHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=y2OE9KTn9pG2FZsXZ5Q7dzdVN3ozaTIsX9wp6xG+ghE=; b=VogNsD4oOs8F0LTH3SY5LcR/hIXqCTF3iAgJ/bNXHi7tPPp/aMtQ2hAjgHQMhFOZrt 3Fo1XuSpUjCfwSrlou6ZiSSWEIur3S1A6d31Oty3FlZw08TfhANjLCGtnuvNjxLoMjJB 2pU7aHMP/88NU6JV9VO3msdXIzvGSdCeR5gkNuOB1skjUuaSr7YzOtlDPHKASyyvhOjk cNbutz/Ds4mNqs+ejQ0mEKSi54hxXBNcstfN7uh9Zhie0it1Z2+fWWNA9AYplXxdJgZ8 gLZf24Ryrgk9fvhcId9RJeAW6U6Esbi6QYKaWSt9AYEornK2UNCxKMenCk5vWO+LedML 5vjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18-v6si39723777plp.294.2018.11.19.09.09.47; Mon, 19 Nov 2018 09:10:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407288AbeKTDcf (ORCPT + 99 others); Mon, 19 Nov 2018 22:32:35 -0500 Received: from foss.arm.com ([217.140.101.70]:33352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406505AbeKTDce (ORCPT ); Mon, 19 Nov 2018 22:32:34 -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 364C215BF; Mon, 19 Nov 2018 09:08:16 -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 3CF413F5B7; Mon, 19 Nov 2018 09:08:14 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: marc.zyngier@arm.com, Christoffer.Dall@arm.com, linux-arm-kernel@lists.infradead.org, linux-rt-users@vger.kernel.org, tglx@linutronix.de, rostedt@goodmis.org, bigeasy@linutronix.de, Julien Thierry , Christoffer Dall Subject: [PATCH 3/4] KVM: arm/arm64: vgic: Make vgic_dist->lpi_list_lock a raw_spinlock Date: Mon, 19 Nov 2018 17:07:58 +0000 Message-Id: <1542647279-46609-4-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542647279-46609-1-git-send-email-julien.thierry@arm.com> References: <1542647279-46609-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vgic_dist->lpi_list_lock must always be taken with interrupts disabled as it is used in interrupt context. For configurations such as PREEMPT_RT_FULL, this means that it should be a raw_spinlock since RT spinlocks are interruptible. Signed-off-by: Julien Thierry Cc: Christoffer Dall Cc: Marc Zyngier --- include/kvm/arm_vgic.h | 2 +- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/arm/vgic/vgic-its.c | 8 ++++---- virt/kvm/arm/vgic/vgic.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index b542605..32954e1 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -256,7 +256,7 @@ struct vgic_dist { u64 propbaser; /* Protects the lpi_list and the count value below. */ - spinlock_t lpi_list_lock; + raw_spinlock_t lpi_list_lock; struct list_head lpi_list_head; int lpi_list_count; diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index 1128e97..330c1ad 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c @@ -64,7 +64,7 @@ void kvm_vgic_early_init(struct kvm *kvm) struct vgic_dist *dist = &kvm->arch.vgic; INIT_LIST_HEAD(&dist->lpi_list_head); - spin_lock_init(&dist->lpi_list_lock); + raw_spin_lock_init(&dist->lpi_list_lock); } /* CREATION */ diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 911ba61..ab3f477 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -73,7 +73,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid, irq->target_vcpu = vcpu; irq->group = 1; - spin_lock_irqsave(&dist->lpi_list_lock, flags); + raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); /* * There could be a race with another vgic_add_lpi(), so we need to @@ -101,7 +101,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid, dist->lpi_list_count++; out_unlock: - spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); /* * We "cache" the configuration table entries in our struct vgic_irq's. @@ -332,7 +332,7 @@ int vgic_copy_lpi_list(struct kvm *kvm, struct kvm_vcpu *vcpu, u32 **intid_ptr) if (!intids) return -ENOMEM; - spin_lock_irqsave(&dist->lpi_list_lock, flags); + raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { if (i == irq_count) break; @@ -341,7 +341,7 @@ int vgic_copy_lpi_list(struct kvm *kvm, struct kvm_vcpu *vcpu, u32 **intid_ptr) continue; intids[i++] = irq->intid; } - spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); *intid_ptr = intids; return i; diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index aab8dba..01bd18c 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -72,7 +72,7 @@ static struct vgic_irq *vgic_get_lpi(struct kvm *kvm, u32 intid) struct vgic_irq *irq = NULL; unsigned long flags; - spin_lock_irqsave(&dist->lpi_list_lock, flags); + raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { if (irq->intid != intid) @@ -88,7 +88,7 @@ static struct vgic_irq *vgic_get_lpi(struct kvm *kvm, u32 intid) irq = NULL; out_unlock: - spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); return irq; } @@ -138,15 +138,15 @@ void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq) if (irq->intid < VGIC_MIN_LPI) return; - spin_lock_irqsave(&dist->lpi_list_lock, flags); + raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); if (!kref_put(&irq->refcount, vgic_irq_release)) { - spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); return; }; list_del(&irq->lpi_list); dist->lpi_list_count--; - spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); kfree(irq); } -- 1.9.1