From patchwork Thu May 18 10:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 13246431 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 121C3C7EE22 for ; Thu, 18 May 2023 10:43: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Uc8FSbvXSjAAxzp9uVvEOfPmA/xvqidpCMCAQcSsWyo=; b=pVPtVqhEI64ipJ q/E7CSfgAE9IJkuIXWDb1hhf+uOLX1PjlhBGWgdEHwr8HTBmhkRQF0LnPGTuvVmdlitsmQgs+okV0 M349TKHbHCPBVCCkZv/qiUEIbNacZfqUPLibwY4x5EU+mlqV0RDGcOwWD4vBmaMeZA6N50lXSKcra A7lN6HYMcuDDjIYcXnE+PqxKN6rQM3MK28TMHzHUEj6oDX6kRrFBwwuBa5F/cpZnHJwH8BAstwwXm qIK5IbRp7Ghi9a11WfhDFKxLCzlWfjQLA0LF/b/XhppL+3l6Ia6NLVP8Tu8LrM+tGSFyXbZN2s9I6 lCHpBJSQR0I7NhMnpqvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzb6S-00CbdA-21; Thu, 18 May 2023 10:43:24 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzb6Q-00Cbay-0A for linux-arm-kernel@lists.infradead.org; Thu, 18 May 2023 10:43:23 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f4249b7badso18669985e9.3 for ; Thu, 18 May 2023 03:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684406598; x=1686998598; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=a1A5zp19nox+z20d77L7kQ6GgRjn3J68bOPJdNDopDU=; b=C4Z+2kW0NH3TFvYfMcDnh0ui4OpD+d+98cpobngsB7pxYPY0QgTK2LZhRDtkuJnFls 4muu/nbMWJLapcXfEegbMiBju0WqH5acOUbtjU7i6oy0PpbyOSjbydqPuFRweCg+iwGO v/3VrffkBI6d3M78kYdP6auO9rcF65UK5c7c3ew+Oi6tjGvhTDBfP7gTf5ml2zvyT2v9 iEjFfyVD4GogSHZQLAxcEY9psllzznjsLKvjPCkq+f5nusLBTqTKVp/iLLvk3EUOA24k uDAHbiJWiHtG1YSffr0vNSc0bBHMVnkbnHtv8qznd0x1zbmMtQWvWHmT5aFo+uf59OVx 0plA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684406598; x=1686998598; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a1A5zp19nox+z20d77L7kQ6GgRjn3J68bOPJdNDopDU=; b=AJ3mcJ1TmraBbX0s96ss7q5nHo/cppMdPtN4bzvhcpH2fjjHrUTAmhecOJ+MMHW8BX c+Cl8yNqmr2TLpd3wJeCiwkknHAAiYppou4gMMmZutz221yQkEaDfxfU9FeqltFBRZQw AtNASr0q88jaI2KutlAHPghesY4ZRdqDn0SORDcILiJqVpggzG/aPyCYQoOICf5yF+JA +zSLqPWRbl5ZU2j6oJd1HTO506eU6R3HnEOg/aCBAWAgYjxZwBSlHB1EaGH4wnvhLn5Q wX5wvalioY53WL/bH8SZzLWxeluIV0SWGP1ls9U3NJKlFx9SadOBvypeID3Erl2CSM18 diSA== X-Gm-Message-State: AC+VfDzt18WLD061fG29/YMumpd9QjoBBEdu05sQdbNGDtGekENfBstv Zk0CEtg0izqk7A23rM66Z7RZCw== X-Google-Smtp-Source: ACHHUZ6pgQfC0TLqqQ1Hb+nrANs/LlC0ALkrv2lfrEpi5S7694C2yfzPXC5EkWVcGaYZoTsqRjoM2Q== X-Received: by 2002:a05:600c:249:b0:3f5:f83:4d84 with SMTP id 9-20020a05600c024900b003f50f834d84mr1128550wmj.31.1684406598315; Thu, 18 May 2023 03:43:18 -0700 (PDT) Received: from localhost.localdomain (5750a5b3.skybroadband.com. [87.80.165.179]) by smtp.gmail.com with ESMTPSA id f6-20020a1c6a06000000b003f427cba193sm4880523wmc.41.2023.05.18.03.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 03:43:17 -0700 (PDT) From: Jean-Philippe Brucker To: oliver.upton@linux.dev, maz@kernel.org Cc: james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Jean-Philippe Brucker Subject: [PATCH 0/4] KVM: arm64: vgic: Locking fixes Date: Thu, 18 May 2023 11:09:14 +0100 Message-Id: <20230518100914.2837292-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_034322_119593_1221EEAF X-CRM114-Status: GOOD ( 10.18 ) 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 Another fun locking puzzle, between the new config_lock and srcu. Patch 1 attempts to fix it, and the other patches fix simpler issues. I got these lockdep reports while running KVM QEMU on a TCG QEMU, but it can also be triggered by running the vgic_irq kselftest on TCG QEMU. Now, with the fix and lockdep enabled, vgic_irq hangs but I believe it's an unrelated weirdness: if I introduce a separate lockdep warning for some made up locks, then the test passes again. So I'm sending this out now for discussion, and will investigate that one later. I run the host with: qemu-system-aarch64 -M virt,virtualization=true,gic-version=3 -m 2G -smp 8 -cpu max -append 'console=hvc0 root=/dev/vda rw' -kernel Image -nodefaults -chardev stdio,mux=on,id=virtiocon0,signal=off -device virtio-serial-device -device virtconsole,chardev=virtiocon0 -mon chardev=virtiocon0,mode=readline -device virtio-blk-device,drive=hd0 -drive format=raw,if=none,file=virt_root.bin,id=hd0 -nographic Jean-Philippe Brucker (4): KVM: arm64: vgic: Fix a circular locking issue KVM: arm64: vgic: Wrap vgic_its_create() with config_lock KVM: arm64: vgic: Fix locking comment KVM: arm64: vgic: Fix a comment arch/arm64/kvm/vgic/vgic-init.c | 27 +++++++++++++++++------ arch/arm64/kvm/vgic/vgic-its.c | 14 ++++++++---- arch/arm64/kvm/vgic/vgic-kvm-device.c | 10 +++++++-- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 31 ++++++++++++++++++--------- arch/arm64/kvm/vgic/vgic-mmio.c | 8 ++----- arch/arm64/kvm/vgic/vgic-v2.c | 6 ------ arch/arm64/kvm/vgic/vgic-v3.c | 7 ------ arch/arm64/kvm/vgic/vgic-v4.c | 3 ++- 8 files changed, 64 insertions(+), 42 deletions(-) Reviewed-by: Oliver Upton