On Fri, Jan 10, 2025 at 10:21:49AM +0100, Daniel Wagner wrote: > Hi Ming, > > On Fri, Dec 20, 2024 at 04:54:21PM +0800, Ming Lei wrote: > > On Thu, Dec 19, 2024 at 04:38:43PM +0100, Daniel Wagner wrote: > > > > > When isolcpus=managed_irq is enabled all hardware queues should run on > > > the housekeeping CPUs only. Thus ignore the affinity mask provided by > > > the driver. > > > > Compared with in-tree code, the above words are misleading. > > > > - irq core code respects isolated CPUs by trying to exclude isolated > > CPUs from effective masks > > > > - blk-mq won't schedule blockd on isolated CPUs > > I see your point, the commit should highlight the fact when an > application is issuing an I/O, this can lead to stalls. > > What about a commit message like: > > When isolcpus=managed_irq is enabled, and the last housekeeping CPU for > a given hardware context goes offline, there is no CPU left which > handles the IOs anymore. If isolated CPUs mapped to this hardware > context are online and an application running on these isolated CPUs > issue an IO this will lead to stalls. It isn't correct, the in-tree code doesn't have such stall, no matter if IO is issued from HK or isolated CPUs since the managed irq is guaranteed to live if any mapped CPU is online. > > The kernel will not schedule IO to isolated CPUS thus this avoids IO > stalls. > > Thus issue a warning when housekeeping CPUs are offlined for a hardware > context while there are still isolated CPUs online. > > > If application aren't run on isolated CPUs, IO interrupt usually won't > > be triggered on isolated CPUs, so isolated CPUs are _not_ ignored. > > FWIW, the 'usually' part is what made our customers nervous. They saw > some IRQ noise on the isolated CPUs with their workload and reported > with these changes all was good. Unfortunately, we never got the hands > on the workload, hard to say what was causing it. Please see irq_do_set_affinity(): if (irqd_affinity_is_managed(data) && housekeeping_enabled(HK_TYPE_MANAGED_IRQ)) { const struct cpumask *hk_mask; hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ); cpumask_and(&tmp_mask, mask, hk_mask); if (!cpumask_intersects(&tmp_mask, cpu_online_mask)) prog_mask = mask; else prog_mask = &tmp_mask; } else { prog_mask = mask; The whole mask which may include isolated CPUs is only programmed to hardware if there isn't any online CPU in `irq_mask & hk_mask`. > > > > On Thu, Dec 19, 2024 at 05:20:44PM +0800, Ming Lei wrote: > > > > > + cpumask_andnot(isol_mask, > > > > > + cpu_possible_mask, > > > > > + housekeeping_cpumask(HK_TYPE_MANAGED_IRQ)); > > > > > + > > > > > + for_each_cpu(cpu, isol_mask) { > > > > > + qmap->mq_map[cpu] = qmap->queue_offset + queue; > > > > > + queue = (queue + 1) % qmap->nr_queues; > > > > > + } > > > > > > > > Looks the IO hang issue in V3 isn't addressed yet, is it? > > > > > > > > https://lore.kernel.org/linux-block/ZrtX4pzqwVUEgIPS@fedora/ > > > > > > I've added an explanation in the cover letter why this is not > > > addressed. From the cover letter: > > > > > > I've experimented for a while and all solutions I came up were horrible > > > hacks (the hotpath needs to be touched) and I don't want to slow down all > > > other users (which are almost everyone). IMO, it's just not worth trying > > > > IMO, this patchset is one improvement on existed best-effort approach, which > > works fine most of times, so why you do think it slows down everyone? > > I was talking about implementing the feature which would remap the > isolated CPUs to online hardware context when the current hardware > context goes offline. I didn't find a solution which I think would be > worth presenting. All involved some sort of locking/refcounting in the > hotpath, which I think we should just avoid. I understand the trouble, but it is still one improvement from user viewpoint instead of feature since the interface of 'isolcpus=manage_irq' isn't changed. > > > > to fix this corner case. If the user is using isolcpus and does CPU > > > hotplug, we can expect that the user can also first offline the isolated > > > CPUs. I've discussed this topic during ALPSS and the room came to the > > > same conclusion. Thus I just added a patch which issues a warning that > > > IOs are likely to hang. > > > > If the change need userspace cooperation for using 'managed_irq', the exact > > behavior need to be documented in both this commit and Documentation/admin-guide/kernel-parameters.txt, > > instead of cover-letter only. > > > > But this patch does cause regression for old applications which can't > > follow the new introduced rule: > > > > ``` > > If the user is using isolcpus and does CPU hotplug, we can expect that the > > user can also first offline the isolated CPUs. > > ``` > > Indeed, I forgot to update the documentation. I'll update it accordingly. It isn't documentation thing, it breaks the no-regression policy, which crosses our red-line. If you really want to move on, please add one new kernel command line with documenting the new usage which requires applications to offline CPU in order. thanks, Ming