From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF02CC2D0D1 for ; Mon, 24 Jun 2024 19:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JZU8S04DmW37EgvwXoQWCiG/q1Cf8pwLsOrAbOmmLjs=; b=DxDG6h7aQ4fCQfEPBwKp/GHFZ+ FhqkZzVCW7nO8Set8BoI1OyGnKMEjdRGQDUPzUcMXv7gIIlnGM3MaoV1zuiAK4Vbb6khQX2E5zZH2 HRrJRoUx51YUjNucCMGoABTivens7TbzG7mnAHYQZpoI/YGu123zBeNF23DCcsvl/rzq5znT4Ak1r hHEZjhwyjJMA5VkwJX6LZEHthAgOHIF4MEkQFu+Wh0hExk48m0KdsswpI0nBMRHusV5BJqU/l1MCL HQFvWtU4Eunb+ZNmWqZzU6W83jvmyoeK8p0ooC8595YqQHv6qJEAZE7FBZnMzejZg3qQHvgasHXQT aWFYWIsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLpk1-00000000U1l-03i3; Mon, 24 Jun 2024 19:52:41 +0000 Received: from out-183.mta0.migadu.com ([91.218.175.183]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLpjv-00000000U0f-0fUV for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2024 19:52:36 +0000 X-Envelope-To: shameerali.kolothum.thodi@huawei.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719258752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JZU8S04DmW37EgvwXoQWCiG/q1Cf8pwLsOrAbOmmLjs=; b=C7lDyln2xa5lWpdBfg8j566giFNeCe0vJGiqnCigrAWHSI8Ur5Uz+6t1ZEMjxIlUi9pQeW OFrzfv1VDagH0QLz6yeROMEqyPFBDxHcVxlog8Ezn2vPB0iDDe7mdyGTHJAW25ol8M2DfT najtYJsuz0Y9+HjheetgopFfOeWOpqc= X-Envelope-To: kvmarm@lists.linux.dev X-Envelope-To: iommu@lists.linux.dev X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linuxarm@huawei.com X-Envelope-To: kevin.tian@intel.com X-Envelope-To: jgg@ziepe.ca X-Envelope-To: alex.williamson@redhat.com X-Envelope-To: maz@kernel.org X-Envelope-To: will@kernel.org X-Envelope-To: robin.murphy@arm.com X-Envelope-To: jean-philippe@linaro.org X-Envelope-To: jonathan.cameron@huawei.com Date: Mon, 24 Jun 2024 12:52:27 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Shameerali Kolothum Thodi Cc: "kvmarm@lists.linux.dev" , "iommu@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , Linuxarm , "kevin.tian@intel.com" , "jgg@ziepe.ca" , "alex.williamson@redhat.com" , "maz@kernel.org" , "will@kernel.org" , "robin.murphy@arm.com" , "jean-philippe@linaro.org" , Jonathan Cameron Subject: Re: [RFC PATCH v2 2/7] KVM: arm64: Introduce support to pin VMIDs Message-ID: References: <20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com> <20240208151837.35068-3-shameerali.kolothum.thodi@huawei.com> <99b822b154504531b490055bc0f4006c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99b822b154504531b490055bc0f4006c@huawei.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_125235_366174_DDFE424D X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 24, 2024 at 07:34:42PM +0000, Shameerali Kolothum Thodi wrote: > > > + raw_spin_lock_irqsave(&cpu_vmid_lock, flags); > > > + > > > + vmid = atomic64_read(&kvm_vmid->id); > > > + > > > + if (refcount_inc_not_zero(&kvm_vmid->pinned)) > > > + goto out_unlock; > > > + > > > + if (nr_pinned_vmids >= max_pinned_vmids) { > > > + vmid = 0; > > > + goto out_unlock; > > > + } > > > > You need to decrement the refcount in this error path. > > Hmm..do we? We are here means refcount is zero, right? Durr, I need more caffeine. You're right. -- Thanks, Oliver