Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp236653pxb; Mon, 13 Sep 2021 17:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT1Und6/DcXv90Ol2dHEM75rkA90N2wNgSsuYVSTpwQ9klOXz5d7Nnf9wEPdTj0yYYks1a X-Received: by 2002:aa7:cd96:: with SMTP id x22mr16233364edv.46.1631581189729; Mon, 13 Sep 2021 17:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631581189; cv=none; d=google.com; s=arc-20160816; b=Q9CBNYAFTHR58B5XJgkkvCmyqPtzd/JGgsQIs9sGbnms72NZcheqK+bR1tmrf85ZNf AgCuquy3OvNtq0QSrBPjE4CKa4kHGVmGdQ02IUfSjr0vmShrWiwLop8L+UeBg+2CfIJw 8sLPOgz6MV0tpWhHCAAwSrxpM8CJePEVq7a9pkmNnmIsuRqDsiycN04hH/0nH893Neot B7PW9Y60LpsV8qRsCZD1t/zr8J0+f7dzT4YfIKdTnRxCy9JWP8bl+/0D7MiIK6YInCax Z01tDUBaaxL01zQcQZVw75AZ6Fi8mb/EsNG2JmbqWqkrenjhXa4Smz/mXKwtBhepiwUm O4LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=SNljKPD0Xskmz5pElU9tRhA+/eVrlrzmSfYWjyc0pwQ=; b=KMr4MPgDcqMWn0cF+TQzokeXiRzHEL21JSn+Cg1Os9f54GoD+Ir2m6fjRiPP1TULij DVjH7WsWnbGpxtCOYy4QlSD0FScTV7S8DltDnm0H4+VhxrinFMJRGF/JAsJAhOSlGxLI wrfWwSt+RUe35xByjL1dh9Orqtc0sZsiRx8xYpCihKGOqsrpeYSctfHi5GI3vjrhUPEi 30UczqqNiMJ5gEjEMRAoB/MJy+nBIEd/oOpdp0y7jv0HVl0l9MW0Meht+0ot0AIlchEF AGLukF26jdClplW94S3+ZklJzpwZvJg7BhzZgYWY2ihFg3aD8uuEcnR4Tnqj5x/ZLUjn d6Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Lz1rdiVR; dkim=neutral (no key) header.i=@linutronix.de header.b=SufMvqF2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si5583199edr.256.2021.09.13.17.59.25; Mon, 13 Sep 2021 17:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Lz1rdiVR; dkim=neutral (no key) header.i=@linutronix.de header.b=SufMvqF2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242066AbhIMTju (ORCPT + 99 others); Mon, 13 Sep 2021 15:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240113AbhIMTjt (ORCPT ); Mon, 13 Sep 2021 15:39:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA87DC061574 for ; Mon, 13 Sep 2021 12:38:33 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1631561911; 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=SNljKPD0Xskmz5pElU9tRhA+/eVrlrzmSfYWjyc0pwQ=; b=Lz1rdiVRdsnnIyZTt9O+PdsZkBcUkriRCVvIxzoSwUtP9AB2zCB7wQXlSkaVmzyDa+efCP 97t3aMTfIUSBC7VBmRsp4QJTwzZVlb0mCyhPmsoW9b/WQUdg1PafWop8XM0W5RbaHPm59a cy6vFLF1A3DOpN3OXWY0MEwA0oJVy4cqR7mD11os6qQzwVoqdCjvr4aemI+WH2lcUEY3+N tHFOoPn1z5s/aiN8Kho5XLlhNETZu5DQsR/V2EnkkoXBNcgN/SLkHgD5WhFCg44Kk9Vku1 3DDT6heVg1SqMuCAHsAARCZHzaVObvXVGn1Kob2PNC5diFkuXd7PTA9L+O3Nyw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1631561911; 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=SNljKPD0Xskmz5pElU9tRhA+/eVrlrzmSfYWjyc0pwQ=; b=SufMvqF2KSz3fVI4AXwUx2qxp8cvjJJKuP2MMttHEgnS9lz4/mi1ozW/1Ac0UnCZ0bFSGS oDsaHyPxIjRIFLBw== To: Jason Wang , "Michael S. Tsirkin" Cc: virtualization , linux-kernel , "Hetzelt, Felicitas" , "kaplan, david" , Konrad Rzeszutek Wilk , pbonzini , Andi Kleen , Dan Williams , "Kuppuswamy, Sathyanarayanan" , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Bjorn Helgaas , Richard Henderson , Thomas Bogendoerfer , James E J Bottomley , Helge Deller , "David S . Miller" , Arnd Bergmann , Jonathan Corbet , Peter H Anvin , Dave Hansen , Tony Luck , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , X86 ML Subject: Re: [PATCH 6/9] virtio_pci: harden MSI-X interrupts In-Reply-To: References: <20210913055353.35219-1-jasowang@redhat.com> <20210913055353.35219-7-jasowang@redhat.com> <20210913015711-mutt-send-email-mst@kernel.org> <20210913022257-mutt-send-email-mst@kernel.org> <20210913023626-mutt-send-email-mst@kernel.org> <20210913024153-mutt-send-email-mst@kernel.org> Date: Mon, 13 Sep 2021 21:38:30 +0200 Message-ID: <87bl4wfeq1.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13 2021 at 15:07, Jason Wang wrote: > On Mon, Sep 13, 2021 at 2:50 PM Michael S. Tsirkin wrote: >> > But doen't "irq is disabled" basically mean "we told the hypervisor >> > to disable the irq"? What extractly prevents hypervisor from >> > sending the irq even if guest thinks it disabled it? >> >> More generally, can't we for example blow away the >> indir_desc array that we use to keep the ctx pointers? >> Won't that be enough? > > I'm not sure how it is related to the indirect descriptor but an > example is that all the current driver will assume: > > 1) the interrupt won't be raised before virtio_device_ready() > 2) the interrupt won't be raised after reset() If that assumption exists, then you better keep the interrupt line disabled until virtio_device_ready() has completed and disable it again before reset() is invoked. That's a question of general robustness and not really a question of trusted hypervisors and encrypted guests. >> > > > > > > +void vp_disable_vectors(struct virtio_device *vdev) >> > > > > > > { >> > > > > > > struct virtio_pci_device *vp_dev = to_vp_device(vdev); >> > > > > > > int i; >> > > > > > > @@ -34,7 +34,20 @@ void vp_synchronize_vectors(struct virtio_device *vdev) >> > > > > > > synchronize_irq(vp_dev->pci_dev->irq); Don't you want the same change for non-MSI interrupts? Thanks, tglx