Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27891266rwd; Tue, 4 Jul 2023 09:16:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHR4gLAhA1NA3bGfEai/9Nmx1CNIMf9lksns9Tq/nqOSNTi8Bj0tdFI2UDHBwOEn/5l+Kri X-Received: by 2002:a05:6a20:938a:b0:12e:4ccb:32a1 with SMTP id x10-20020a056a20938a00b0012e4ccb32a1mr5988435pzh.26.1688487373113; Tue, 04 Jul 2023 09:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688487373; cv=none; d=google.com; s=arc-20160816; b=R+uk/TcvvKYnoPXHB1moBjYuibWs3YHXRoeR7vKxkjC/ZROnBitbii8n/MiE4sn2Sj JiiglVvbj6b3voKVjtx5X8ltl/2f9xX6zS/0VkMrZzMhpKlJwshz0qLks/B07nUUvnMe muEsJayhNsRycoyWLHY1DyFPA/EoNxUsYwjmz/y0xuzZDXjJegtFZ0aAs2aiwrpWatYJ XKLZ5zgVHmZpDKYOPkdCez/65RyoN0WtoD1xR3QOTuMSp7IKzOyAA9mt9Zg01VwdF2Tf 9ozYgIBRme9Fk+fbL+3lmK0qBNrAa9tUHVBOTyt+PCibIdO++VmkYpRY9nMupw6RuCI5 sPWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=gID927ykjA8GZfCHNcglKT0lbAi58GB77aUKrRL+lLk=; fh=MyPuuR6dKkzmXwVoXyVihF102H9tRr2/UeWuKT07tjA=; b=ifrzBSCf+cDCF8GeYDojdFfPst3p2hIrY6vvGL3/Zc5cMWzk27MsJq9lHoa9xomlDH wdPTshWzpCjBU/SSY9zSg4QV5ezkZYbqW8N+Xz0h29ek1wHerDETk41dDKh4a8uI5KsB OBJzhwqAZSezvn2nUr9deIkypawFRU+jOb/YIhD3q+FlLj92TRHbuhVdjYAElZh7qw+N fGbZ1apSqnIP7RXKQpx0YtANOu9cRVYDsn8oulrNrYdPhEkguPM4+yFobBa3hvykpE51 uddrwywfC6P5adrtXUhu7/a1XwyGgSwXOXGePWZBfgZ+ggx6BMq8WFZQBoj+Kx/H7F49 miCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170902da8300b001b8944aa0d8si5702264plx.463.2023.07.04.09.15.58; Tue, 04 Jul 2023 09:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbjGDPmp (ORCPT + 99 others); Tue, 4 Jul 2023 11:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjGDPmo (ORCPT ); Tue, 4 Jul 2023 11:42:44 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA59E7E for ; Tue, 4 Jul 2023 08:42:42 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QwRnl1rrLzLndS; Tue, 4 Jul 2023 23:40:27 +0800 (CST) Received: from [10.174.185.179] (10.174.185.179) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 4 Jul 2023 23:42:38 +0800 Subject: Re: [PATCH] irqchip/gic-v4.1: Properly lock VPEs when doing a directLPI invalidation To: Marc Zyngier CC: , Thomas Gleixner , Kunkun Jiang , References: <20230617073242.3199746-1-maz@kernel.org> <86wmzgx1va.wl-maz@kernel.org> From: Zenghui Yu Message-ID: Date: Tue, 4 Jul 2023 23:42:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <86wmzgx1va.wl-maz@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.179] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 2023/7/4 2:54, Marc Zyngier wrote: > On Thu, 29 Jun 2023 15:52:24 +0100, > Zenghui Yu wrote: >> >> Hi Marc, >> >> Nit: I think the Subject header can be changed to 'irqchip/gic-v4' as >> the bug it fixes only affects GICv4 HW. v4.1 is unaffected. > > I'm not so sure. > > v4.0 didn't allow direct invalidation of VPE doorbells (we had to use > the fake device hack), except for the HiSi special that implemented > DirectLPI despite the presence of multiple ITSs. It was a violation of > the architecture, but it really saved the day by making invalidations > cheap enough. [ I should've mentioned that I had reproduced the bug and tested your patch on my 920, which is, yeah, a HiSi implementation of GICv4.0 with DirectLPI supported. But ] > > Only with v4.1 did we get architectural support for doorbell > invalidation via a register instead of a command for a fake device. > > So as far as the architecture is concerned, this should only affect > v4.1. As a side effect, it also affect HiSi's v4.0 implementations. ... iiuc the bug we're fixing is that we perform a register based invalidation for doorbells (via its_vpe_[un]mask_irq/its_vpe_send_inv), acquire and release the per-RD lock with a *race* against a concurrent its_map_vm(), which would modify the vpe->col_idx behind our backs and affect the lock we're looking for. its_vpe_[un]mask_irq() are callbacks for the v4.0 irqchip, i.e., its_vpe_irq_chip. With v4.1, we switch to use its_vpe_4_1_irq_chip and invalidate doorbells by sending the new INVDB command (and shouldn't be affected by this bug). Thanks, Zenghui