Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2317882lqp; Sun, 24 Mar 2024 13:05:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJa0ZI0A6DArG879CniHQShMPYVdIMbvLK9ZJf1zIVO0zGxyKsUnA1YHJtvLtP5DF2WZw96DO0fqMeSF5fldiTUqld3E6ZCHGNOsHkjw== X-Google-Smtp-Source: AGHT+IGu9fAHIxVTE8w31asCt2ciX7PE2DxZ+O7DOOEfjnsNmmiR28ZostOx6cheYeomYv+CHPwD X-Received: by 2002:a17:906:4a56:b0:a46:9b7c:c962 with SMTP id a22-20020a1709064a5600b00a469b7cc962mr3858565ejv.47.1711310755692; Sun, 24 Mar 2024 13:05:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711310755; cv=pass; d=google.com; s=arc-20160816; b=Hg3RdRrPYk6QRXM7qoELN1PQ3Rf6qctGuEN9YDr3YHqm8oh9CrjMjox5SU82IJKohL Uk4MFa3laUfT+9qEL4QIPVneClfh4guzU+GG1lfjSDNa6WIF0GBg8iZFRYqQFDoQoA0Y nVFnecQSBaAhvaFOPvJPmMl+RY68960IcAOxeBlSQbzphb0GJljSA9HQJPOCwnC99y/V gVHnKQ44lD3Y+vlUdws6XeqeEDnI4oj2nhlqBJP5E0UFikiEz4eFqeFUN+cLMdrMaz77 xh+nSbKyv996bY3MsauV4sqynFDqZmVqDKcmLGK+UbNO5clJ8XTOCuu/IJhBwyTalAZl 16SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=tEQkubM2Zqs51Lu+6zFTonIBP1O9zapY/XByNh3O9KE=; fh=QOJOJQpSsgcugsgaaaSEQIYQ9ddeo3SvUt5ZRAlxlH8=; b=oEyXKhRsS+hKeCeIkx68ue+POjcd++kJ1UPziZ6xFD3LNqF/1x+cCwbnNTetFh5gz4 6c+8NPVmbbZ2mo1J3QZ8BdLJe4XIBLoYxEdkdJjjBv1kmmRUZWa+WG/hpGSHN4Idr/Iy ho4DP7pdD8IpOVUXcWkuZQpsVgY0rTSLYYYloNmHre2SkRXYhJ1ugM3mf5MtEOBHJ8lB lQNw0QCgaIXkfctRkunn+ORqka3P6nR00x0PPqN4Vf9mRaSb/9LiSnf/T+itdIMk3vZR BBQWuUMghue/DV1NojtWdmWzpuUE26PtBG4XC9veNrJnp/CCEGbCmmBgI4oh14YQFkYq qxQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AxQ5Ls9W; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-112831-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112831-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g24-20020a170906395800b00a474b389b4dsi1180753eje.48.2024.03.24.13.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 13:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112831-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AxQ5Ls9W; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-112831-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112831-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 40F621F211FC for ; Sun, 24 Mar 2024 20:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05113FC0A; Sun, 24 Mar 2024 20:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AxQ5Ls9W"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1bl5OoF1" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DC7DF9DE for ; Sun, 24 Mar 2024 20:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711310740; cv=none; b=cDiHV9R2GZ9AApdeCq7uiTUt7xNAx4Fkbq5kWIs6dbP73jk49FfI/qvGIfSFNAWO8PFDIlPL91BRG9oLHsxF++36Pfc39ucO0JM7mSe2+MhzYa8ELa0uMAwMZkSFnXCJQECu4HN39sZ4JbZqXoW9wucPm/+yE/mFvhUYIaHe76o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711310740; c=relaxed/simple; bh=MklU3DYa778v4ZDWFXMxmTI+sKqEUz89Ifhdj7zrlEE=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:MIME-Version: Content-Type; b=lapRmOhkAZGKzvjRTk6TWkQ7q6Krue/lwmtCTR1/I8KLkBd6tS6vHTI/2sJJeQOpwV/WQbU7Mcop9fGLgHGfrg4260xtVVWO4fNRMNYVwzIfj8WsnWqA/DlFgyxvJ68C5lb6CK/0n0rdCp97HwD9x8cs88Y/+Bli0/4GzKMckNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AxQ5Ls9W; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1bl5OoF1; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711310736; 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; bh=tEQkubM2Zqs51Lu+6zFTonIBP1O9zapY/XByNh3O9KE=; b=AxQ5Ls9WHGsg+/L7l6fVJ+FYRs0dCJZhZqv4lzn8ilJUG7/281abD67NSBHWg+ADOz4zhg NYCg/az9ZqQBYNIKcyfy3SZCJvphBFPZQQ7XwBybUXtnKZHNU8G0fiqNHFgfGnhVmf21t5 DyJ0ybGwqyPeRdceWPdtnZe2K6VyF3vINjRZ69yt90PbTW9ZjMPhUKQKgOjDhP0Tt9Kcr+ w1diJI0jdyGiWOBGYtPpOb0IXL/wb9ihxpFXmoMm7MnQztl3DG7ZP3mwzdHiC7zJ1D65nJ iTTEkrHKfcLKoznPgtP/YyXwAfIDN+mbJ5gdTXqv7sREShefdAjxsryidstGVA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711310736; 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; bh=tEQkubM2Zqs51Lu+6zFTonIBP1O9zapY/XByNh3O9KE=; b=1bl5OoF135n3KM4dsxyeTA6m6aUzU53gitNgkAs88vPDVUOxVSsDgnFBtIkwP8qgThS4hk VtCqDd0u15GMqFAQ== To: Dimitri Sivanich Cc: David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Steve Wahl , Russ Anderson , Dimitri Sivanich Subject: Re: [PATCH] Allocate DMAR fault interrupts locally In-Reply-To: Date: Sun, 24 Mar 2024 21:05:35 +0100 Message-ID: <87plvjfl9s.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Dimitri! On Mon, Mar 11 2024 at 15:38, Dimitri Sivanich wrote: > On Thu, Feb 29, 2024 at 11:18:37PM +0100, Thomas Gleixner wrote: >> What you really want is a cpu hotplug state in the CPUHP_BP_PREPARE_DYN >> space which enables the interrupt for the node _before_ the first AP of >> the node is brought up. That will solve the problem nicely w/o any of >> the above issues. >> > > Initially this sounds like a good approach. As things currently stand, however, > there are (at least) several problems with attempting to allocate interrupts on > cpus that are not running yet via the existing dmar_set_interrupt path. > > - The code relies on node_to_cpumask_map (cpumask_of_node()), which has been > allocated, but not populated at the CPUHP_BP_PREPARE_DYN stage. > > - The irq_matrix cpumaps do not indicate being online or initialized yet, except > for the boot cpu instance, of course. > > So things still revert to boot cpu allocation, until we exhaust the > vectors. I thought about the following: CPUHP_BP_PREPARE_DYN allocates the hardware interrupt on the control CPU (the boot CPU during early boot). CPUHP_AP_ONLINE_DYN moves it over to the AP. This needs to set affinity and then retrigger the interrupt so that the horrible non-remapped MSI migration logic is invoked. Though that does not work for parallel bringup as then the prepare stage is invoked for all CPUs before any of them gets to the online phase, which obviously ends up with the same problem. > Of course, running the dmar_set_interrupt code from a CPUHP_AP_ONLINE_DYN state > does work (although I believe there is a concurrency issue that could show up > with the current dmar_set_interrupt path). Which concurrency issue? CPU hotplug is fully serialized. > So the code seems to have been designed based on the assumption that it will be > run on an already active (though not necessarily fully onlined?) cpu. To make > this work, any code based on that assumption would need to be fixed. Otherwise, > a different approach is needed. Yes, the interrupt vector code it is designed that way and for the general case this is absolutely the right thing to do. Thanks, tglx