From patchwork Mon Jul 17 14:27:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9845261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8076A60386 for ; Mon, 17 Jul 2017 14:27:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7418328509 for ; Mon, 17 Jul 2017 14:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68F2F2851E; Mon, 17 Jul 2017 14:27:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB23B28509 for ; Mon, 17 Jul 2017 14:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751518AbdGQO1o (ORCPT ); Mon, 17 Jul 2017 10:27:44 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36178 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbdGQO1g (ORCPT ); Mon, 17 Jul 2017 10:27:36 -0400 Received: by mail-wm0-f47.google.com with SMTP id t70so17260276wmt.1 for ; Mon, 17 Jul 2017 07:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mQ9H50U30Tjo9VRSZPZDfhhZ6oWQDIua8nK3D2KsB8U=; b=HWu0ClIyP/0LgnRq4MjLTTYBK2nAubcuWfdAo2ETnskBWkx6oc84qyXYg8FWDrzBSW Q5DUsECZ5DELgLq8qvuqJ45OXt55z6ZYAs3KKrraJNUJRVoAc2MkP6Xz7jDudtzx07gx xK/bN72yQmBBzUpbWqamgXmFDUt8jy0Tgdr50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mQ9H50U30Tjo9VRSZPZDfhhZ6oWQDIua8nK3D2KsB8U=; b=MhTNmyUv81cMrIzGE41stsOzeWwzdMM6ZZnoGA+/ZhZ5HtorGZ+eF/4viqkXQRULtr i0RL+YpRaJEBh8SyD48DXWPDG5tKxYIQl6BlUEdicw3q0T7D6/TPfeNx+kYzmSKdzFhN dLoolGjEzKuT3VdBoRxWKh0ClfGW7zftema/v0DsXm5LYr0XBCMQQ1jALENB+ehvTMKR DXLTupEJe9I26G38L+0k7WooGtwMSaveUPFdjd8UC1MV+TGZsIcryN3QiQZ22TIu6fyY lNq/jnwVemd+rBopKOucIK7YMI/sb9+RTlLyr1jT0pW/SJooWBIq2qDzAvZ7LR2/mAT7 TJkg== X-Gm-Message-State: AIVw111dZjZw4DFxSQ18+/ISU2ESBWGdtiNvBmq+PHqaWQ2XQooHPSEJ llJig0q9Q8gnziRF X-Received: by 10.80.169.193 with SMTP id n59mr17494032edc.88.1500301655717; Mon, 17 Jul 2017 07:27:35 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm9428952edd.6.2017.07.17.07.27.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 07:27:35 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall , Thomas Gleixner Subject: [RFC PATCH v2 11/19] genirq: Document vcpu_info usage for per-CPU interrupts Date: Mon, 17 Jul 2017 16:27:10 +0200 Message-Id: <20170717142718.13853-12-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170717142718.13853-1-cdall@linaro.org> References: <20170717142718.13853-1-cdall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is currently unclear how to set the VCPU affinity for an interrupt which is of the per-CPU kind, since the Linux irq_data structure describes the state for multiple interrupts when the interrupt is a per-CPU interrupt, one for each physical CPU on the system. Since each such interrupt can be associated with different VCPUs or none at all, associating a single VCPU state with such an interrupt does not capture the necessary semantics. The implementers of irq_set_affinity are the Intel and AMD IOMMUs, and the ARM GIC irqchip. The Intel and AMD callers do not appear to use per-CPU interrupts, and the ARM GIC implementation only checks the pointer against NULL vs. non-NULL. Therefore, simply update the function documentation to explain the expected use in the context of per-CPU interrupts, allowing future changes or additions to irqchip implementers to do the right thing. This allows us to set the VCPU affinity for the virtual timer interrupt in KVM/ARM, which is a per-CPU (PPI) interrupt. Cc: Thomas Gleixner Cc: Marc Zyngier Signed-off-by: Christoffer Dall --- kernel/irq/manage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 5624b2d..050b9f6 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -381,7 +381,8 @@ int irq_select_affinity_usr(unsigned int irq) /** * irq_set_vcpu_affinity - Set vcpu affinity for the interrupt * @irq: interrupt number to set affinity - * @vcpu_info: vCPU specific data + * @vcpu_info: vCPU specific data or pointer to a percpu array of vCPU + * specific data for per-CPU interrupts * * This function uses the vCPU specific data to set the vCPU * affinity for an irq. The vCPU specific data is passed from