Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp290604pxu; Wed, 25 Nov 2020 03:20:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3IVyJv8Ai2kU6Oo7/IVzbqfJRSbP8LiEUwrmXAgSU+DxqhU5svwOMLlZggyqBwkzYrezD X-Received: by 2002:a17:906:ccc5:: with SMTP id ot5mr2727939ejb.248.1606303209170; Wed, 25 Nov 2020 03:20:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606303209; cv=none; d=google.com; s=arc-20160816; b=n2rY+jDyJKpnRzIX9pPAoEx9qdlh3dSoYutcp0x4MOMptgGPUdJ0F+gB1yC8hDEJhY P/mOslwAIyEog9Qs+NM4vgfTvhYnkudgcS38ZZur8A2qHb5QvfwPt7qfGuDIg4Rq+wxc Ncx18yNdDxXUPIXJGbMHgMudJ2tmZN3BeoVfd3tj8dn7Imk3fRnp/kYL02TdTWB/Zsm6 9i8Sm4INwIIsnX0ougjuwF71pv/HErRnlyZcqW9wWBzndKs38FLM41U3d4P59E88hd8U MzjkDLfK58dWNiE+dEUXYF8QZNoaXXFO2Yp+nSCx8mJCfntD8hlGrLJ7l/rFammMZVeJ o+pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=d6tPyIFWwC9FLM9lbcLTabTSHj2Cdv4CTmQuu8Xctvw=; b=FmEy1qpNXZQEM/NUBmCsjDY5cwliBE68ZLT86jTqa+lhm3gTSfxmHlDjodpXZRLhcS 5i1jNztESEP9un5yUx5pOq/nir6KSgJHR8+R2S9p0pJOGPPAsiBJjAS9to5oFSqDsTQk UBYsAEWFP3pY/yaWZ9LWjTQIoWH8gk/btjHfpZU19YuhLEhnrXKHmE9UDgq/RfUBL4B6 TQJLd4RLab1QNNIDwYzTWyfqGVEB72GeUcR7fFumjF1BT85IO7UVlGR/AcbnNqkAPYCO 8AN8/IHAJcMOXPtfzvp+gSsEsdxDUgGaAI1kzwFwMrfNIjgCGqtbTPi7jRdZXXgetT0v GTAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nqp5lfU2; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si1072497ejf.418.2020.11.25.03.19.46; Wed, 25 Nov 2020 03:20:09 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=Nqp5lfU2; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbgKYLRK (ORCPT + 99 others); Wed, 25 Nov 2020 06:17:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26218 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbgKYLRK (ORCPT ); Wed, 25 Nov 2020 06:17:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606303028; 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: content-transfer-encoding:content-transfer-encoding; bh=d6tPyIFWwC9FLM9lbcLTabTSHj2Cdv4CTmQuu8Xctvw=; b=Nqp5lfU2JahUvYyB0tvvoKxv9XdsLjTeTHZ1TvSmf3cvc5tpAacpvhZimUhzLPWncP8zD7 uYSmMisVEsKgqfRpDZuQp51R8pZQeRscBgvdjb7aBJ8KZBAN7J5/qH5upo0omrhXg4PJ9H nEHWCKzhbv+TAT9TCyhQyQukyhk10NQ= 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-183-QfIHT8QaNkSP_gbhcImWEw-1; Wed, 25 Nov 2020 06:17:06 -0500 X-MC-Unique: QfIHT8QaNkSP_gbhcImWEw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B793F1005D53; Wed, 25 Nov 2020 11:17:04 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-113-83.ams2.redhat.com [10.36.113.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B2131002C11; Wed, 25 Nov 2020 11:16:58 +0000 (UTC) From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Paul Mackerras , linux-pci@vger.kernel.org, Thomas Gleixner , Marc Zyngier , linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , "Michael S . Tsirkin" , Greg Kurz , Christoph Hellwig , Michael Ellerman , Laurent Vivier Subject: [PATCH v2 0/2] powerpc/pseries: fix MSI/X IRQ affinity on pseries Date: Wed, 25 Nov 2020 12:16:55 +0100 Message-Id: <20201125111657.1141295-1-lvivier@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With virtio, in multiqueue case, each queue IRQ is normally=0D bound to a different CPU using the affinity mask.=0D =0D This works fine on x86_64 but totally ignored on pseries.=0D =0D This is not obvious at first look because irqbalance is doing=0D some balancing to improve that.=0D =0D It appears that the "managed" flag set in the MSI entry=0D is never copied to the system IRQ entry.=0D =0D This series passes the affinity mask from rtas_setup_msi_irqs()=0D to irq_domain_alloc_descs() by adding an affinity parameter to=0D irq_create_mapping().=0D =0D The first patch adds the parameter (no functional change), the=0D second patch passes the actual affinity mask to irq_create_mapping()=0D in rtas_setup_msi_irqs().=0D =0D For instance, with 32 CPUs VM and 32 queues virtio-scsi interface:=0D =0D ... -smp 32 -device virtio-scsi-pci,id=3Dvirtio_scsi_pci0,num_queues=3D32=0D =0D for IRQ in $(grep virtio2-request /proc/interrupts |cut -d: -f1); do=0D for file in /proc/irq/$IRQ/ ; do=0D echo -n "IRQ: $(basename $file) CPU: " ; cat $file/smp_affinity_lis= t=0D done=0D done=0D =0D Without the patch (and without irqbalanced)=0D =0D IRQ: 268 CPU: 0-31=0D IRQ: 269 CPU: 0-31=0D IRQ: 270 CPU: 0-31=0D IRQ: 271 CPU: 0-31=0D IRQ: 272 CPU: 0-31=0D IRQ: 273 CPU: 0-31=0D IRQ: 274 CPU: 0-31=0D IRQ: 275 CPU: 0-31=0D IRQ: 276 CPU: 0-31=0D IRQ: 277 CPU: 0-31=0D IRQ: 278 CPU: 0-31=0D IRQ: 279 CPU: 0-31=0D IRQ: 280 CPU: 0-31=0D IRQ: 281 CPU: 0-31=0D IRQ: 282 CPU: 0-31=0D IRQ: 283 CPU: 0-31=0D IRQ: 284 CPU: 0-31=0D IRQ: 285 CPU: 0-31=0D IRQ: 286 CPU: 0-31=0D IRQ: 287 CPU: 0-31=0D IRQ: 288 CPU: 0-31=0D IRQ: 289 CPU: 0-31=0D IRQ: 290 CPU: 0-31=0D IRQ: 291 CPU: 0-31=0D IRQ: 292 CPU: 0-31=0D IRQ: 293 CPU: 0-31=0D IRQ: 294 CPU: 0-31=0D IRQ: 295 CPU: 0-31=0D IRQ: 296 CPU: 0-31=0D IRQ: 297 CPU: 0-31=0D IRQ: 298 CPU: 0-31=0D IRQ: 299 CPU: 0-31=0D =0D With the patch:=0D =0D IRQ: 265 CPU: 0=0D IRQ: 266 CPU: 1=0D IRQ: 267 CPU: 2=0D IRQ: 268 CPU: 3=0D IRQ: 269 CPU: 4=0D IRQ: 270 CPU: 5=0D IRQ: 271 CPU: 6=0D IRQ: 272 CPU: 7=0D IRQ: 273 CPU: 8=0D IRQ: 274 CPU: 9=0D IRQ: 275 CPU: 10=0D IRQ: 276 CPU: 11=0D IRQ: 277 CPU: 12=0D IRQ: 278 CPU: 13=0D IRQ: 279 CPU: 14=0D IRQ: 280 CPU: 15=0D IRQ: 281 CPU: 16=0D IRQ: 282 CPU: 17=0D IRQ: 283 CPU: 18=0D IRQ: 284 CPU: 19=0D IRQ: 285 CPU: 20=0D IRQ: 286 CPU: 21=0D IRQ: 287 CPU: 22=0D IRQ: 288 CPU: 23=0D IRQ: 289 CPU: 24=0D IRQ: 290 CPU: 25=0D IRQ: 291 CPU: 26=0D IRQ: 292 CPU: 27=0D IRQ: 293 CPU: 28=0D IRQ: 294 CPU: 29=0D IRQ: 295 CPU: 30=0D IRQ: 299 CPU: 31=0D =0D This matches what we have on an x86_64 system.=0D =0D v2: add a wrapper around original irq_create_mapping() with the=0D affinity parameter. Update comments=0D =0D Laurent Vivier (2):=0D genirq: add an irq_create_mapping_affinity() function=0D powerpc/pseries: pass MSI affinity to irq_create_mapping()=0D =0D arch/powerpc/platforms/pseries/msi.c | 3 ++-=0D include/linux/irqdomain.h | 12 ++++++++++--=0D kernel/irq/irqdomain.c | 13 ++++++++-----=0D 3 files changed, 20 insertions(+), 8 deletions(-)=0D =0D -- =0D 2.28.0=0D =0D