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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 228EBC433EF for ; Fri, 24 Sep 2021 17:26:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70C3560F11 for ; Fri, 24 Sep 2021 17:26:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 70C3560F11 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:36778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mToyJ-0005q7-Dp for qemu-devel@archiver.kernel.org; Fri, 24 Sep 2021 13:26:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTolI-0002zE-Fs for qemu-devel@nongnu.org; Fri, 24 Sep 2021 13:13:24 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:54457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTolG-0001KG-Nn for qemu-devel@nongnu.org; Fri, 24 Sep 2021 13:13:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-433-ENo2Fp9NO_qQ8kVL5nvJCQ-1; Fri, 24 Sep 2021 13:13:17 -0400 X-MC-Unique: ENo2Fp9NO_qQ8kVL5nvJCQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EC007801E72; Fri, 24 Sep 2021 17:13:15 +0000 (UTC) Received: from bahia.huguette (unknown [10.39.192.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4474618AD4; Fri, 24 Sep 2021 17:13:14 +0000 (UTC) Date: Fri, 24 Sep 2021 19:13:13 +0200 From: Greg Kurz To: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater Subject: Re: [RFC PATCH] spapr/xive: Allocate vCPU IPIs from local context Message-ID: <20210924191313.36c9c8e9@bahia.huguette> In-Reply-To: <6936294c-f236-2179-cd90-d45af74e7179@kaod.org> References: <20210922144120.1277504-1-clg@kaod.org> <20210923111249.33c41068@bahia.huguette> <71b9a1a8-7d76-ff7c-db47-7c8e9b4d87b5@kaod.org> <20210924154906.59da27f7@bahia.huguette> <6936294c-f236-2179-cd90-d45af74e7179@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: softfail client-ip=207.211.30.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 24 Sep 2021 16:58:00 +0200 C=C3=A9dric Le Goater wrote: > [ ... ] >=20 > >> The changes only impact KVM support since we are deferring the IRQ > >> initialization at the KVM level. What we have to be careful about is n= ot > >> accessing an ESB page of an interrupt that would not have been initili= azed > >> in the KVM device, else QEMU gets a sigbus. > >> > >=20 > > Ok, so this is just needed on a path that leads to xive_esb_rw() or > > kvmppc_xive_esb_trigger(), right ? > >=20 > > It seems that > >=20 > > h_int_esb() > > kvmppc_xive_esb_rw() > >=20 > > can get there with an lisn provided by the guest, and I don't see any > > such check on the way : h_int_esb() only checks xive_eas_is_valid(). >=20 > This call is for LSI interrupts (device only) and not vCPU IPIs. see hcal= l > h_int_get_source_info(). I agree a hcall fuzzer could reach it. >=20 Yes we tell the guest to use H_INT_ESB for LSIs only but I don't have the impression that it is forbidden for the guest to call H_INT_ESB for arbitrary interrupts. > An alternative solution would be to claim the vCPU IPIs on demand, like > we do for the MSIs, and not in spapr_irq_init(). It's a much bigger chang= e > tough, because the H_INT hcalls consider that the interrupt numbers have > been claimed. >=20 Maybe it would be simpler to call xive_source_is_initialized() instead of xive_eas_is_valid() in cases like this, e.g. hcall code since it is shared between emulation and KVM ? > C.