Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2243206yba; Mon, 6 May 2019 02:23:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoMciaJKbkU3xWsEfCBY8nCj3Yj5OZOTFplqitQr/dYLN/8RdDR59TQRkkKGMm2lEwHHHQ X-Received: by 2002:a63:1344:: with SMTP id 4mr3539187pgt.448.1557134605290; Mon, 06 May 2019 02:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557134605; cv=none; d=google.com; s=arc-20160816; b=qwAFix+gZTYj772RG/n7YWELnEbVMOJ5LgGFLnOS/eLicJXsd/AhnNeUJNHb2KuBKH QIyK00A/A5kmX+NuskApPYRjFiQjq7mR0+Z11+b5R8ThRCphKt6bAb0uRZyh+nC7/L2r EJz5CKktxqp7I2gDVh3fsEnayonMJpeRpBblqlfQBcIe7xMdnfbRoaQlk+BgNv8eLe6I tp6JpqmBCnUrwg3wEJRQtajwV/71p4pMnisMGtJVJ1AvyyBc/vHrG3MsI1U4819Y5+SE ObCz6367Gt6GQIhQfNDGBxc2rBcAeZFc3z0EXb2/H84dRU7LvCkOrFc2O+bAe2vKm61S zggA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date; bh=WbQOSnmkbDC4mK+pzVDMz5yjguPtbdTOyDU4SQgWaqM=; b=uaIulm9KsyzXTW2KCHuXBC55pGrnIQgYGH4bkDJ2D1IJNB268QusTCgw0qJqfEKXUS q2Po6j6Kho8Sa3Fkfo2EaAtJAPmcH//oOlocDJuKEGRLBi6pfqghsYIUsXYWwAHbXL3X pP/Ngnu3kxkmhFaGy/ybdkQme8woYpgmkAhB6j4MBpsQ/vubxhLoh1Qpe9d0WmVp0I1b /m0xyiM3TE7y1bkobVSStAkffrEg/RFho4v7+62VLk7tQ7Jk5qFG9FmHM9wLPEtA+gkc puSqZH8lUykQlEW6tezuiDcxuti9O/vty8QUscTb7e87xpRKXlQh2sn9NXoTmKx0Nrxq iUvQ== 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 19si2220379pgu.457.2019.05.06.02.23.09; Mon, 06 May 2019 02:23:25 -0700 (PDT) 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 S1726218AbfEFJVC (ORCPT + 99 others); Mon, 6 May 2019 05:21:02 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46916 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfEFJVC (ORCPT ); Mon, 6 May 2019 05:21:02 -0400 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 CA479A78; Mon, 6 May 2019 02:21:01 -0700 (PDT) Received: from big-swifty.misterjones.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 899323F5AF; Mon, 6 May 2019 02:21:00 -0700 (PDT) Date: Mon, 06 May 2019 10:21:10 +0100 Message-ID: <86k1f49bw9.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Heyi Guo Cc: , wanghaibin 00208455 , kvmarm Subject: Re: ARM/gic-v4: deadlock occurred In-Reply-To: References: <9efe0260-4a84-7489-ecdd-2e9561599320@huawei.com> <86lfzl9ofe.wl-marc.zyngier@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 05 May 2019 12:15:51 +0100, Heyi Guo wrote: > > BTW since its_irq_set_vcpu_affinity() is already in atomic context, > do we really need a separate lock its_dev->event_map.vlpi_lock? I > didn't find anywhere outside its_irq_set_vcpu_affinity() call chain > acquires this lock. The reason is that the vlpi_maps array covers the whole of the generating device, and not just a single interrupt. Relying on the irq_desc lock to protect the array wouldn't work, as you could still have concurrent accesses to the array (map, unmap and get all access the same data). So one way or another, we need some form of mutual exclusion at this level. I guess one of the design mistakes that we have in the current code is that there is no "device wide" operation, and that we rely on map/unmap to perform the allocations on demand in the low level code. What we could potentially do would be to move this allocation higher up in the stack, and track the first time an LPI is turned into a VLPI at that level. That's an invasive change though... Thanks, M. -- Jazz is not dead, it just smell funny.