From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755316AbcEER60 (ORCPT ); Thu, 5 May 2016 13:58:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbcEER6Y (ORCPT ); Thu, 5 May 2016 13:58:24 -0400 Subject: [PATCH 0/2] irqbypass/kvm: Silence registration errors From: Alex Williamson To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, feng.wu@intel.com, linux-kernel@vger.kernel.org, eric.auger@linaro.org Date: Thu, 05 May 2016 11:58:23 -0600 Message-ID: <20160505174733.9576.61083.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently an AMD system using vfio-pci/kvm will issue a dev_info() for every MSI/X vector registered because kvm_x86_ops does not support a bypass mechanism except on Intel and the add_producer callback returns an errno for that. This is meaningless, unintended, and confuses users. We could simply have KVM's add_producer callback return 0 if there's no bypass mechanism, but then why are we registering as an IRQ bypass consumer in the first place? We also don't necessarily want to simply remove the dev_info/pr_info on registration failure because then we have no warning if something does actually go wrong. So instead, let's conditionalize IRQ bypass registration on whether we have any support for it, and to keep the de-registration path clean and fill an unintended gap, let's ignore deregistration of NULL tokens and prevent registration of the same. NULL isn't a good, unique cookie anyway. Tested on AMD and non-PI Intel. Thanks, Alex --- Alex Williamson (2): irqbypass: Disallow NULL token kvm: Conditionally register IRQ bypass consumer arch/x86/kvm/x86.c | 19 ++++++++----------- include/linux/irqbypass.h | 4 ++-- include/linux/kvm_host.h | 1 + virt/kvm/eventfd.c | 18 ++++++++++-------- virt/lib/irqbypass.c | 12 +++++++++++- 5 files changed, 32 insertions(+), 22 deletions(-)