Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3029264lqo; Tue, 21 May 2024 05:02:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+wPrSJfuO72mA3S6FSOv4spj4KWQJJHTvdWn3+sZId/Zpy5PAuv1I6n/R+DV5g+MHvxK25Miwq5XRZYfBEuA2XL1WZNq64/MzgrhHpQ== X-Google-Smtp-Source: AGHT+IHH/28D1MJUcwKp6yTikO+IyxrvkLKJ5823HBLwphmA8rvXLfbNu1qZ+Nbd+SLiG+6fI3Wh X-Received: by 2002:a05:6a20:3d88:b0:1af:cefe:9741 with SMTP id adf61e73a8af0-1afde0b6d8dmr48160626637.17.1716292952785; Tue, 21 May 2024 05:02:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716292952; cv=pass; d=google.com; s=arc-20160816; b=CiLmRXjrEs6kGArYAVFgklQhcK4VwlvqVvmsgUGSOUCJ6WV6kandRbz0i6wxJjWSEr k32vVef5z+bQgSdf6MEqOEhHtuEYy5QD0AKZi8imDFsWu/7EFAvqNjK2hcR/bLNlu6d7 r3Niq8LAxPx00JJSjoVBOrGjrNAQ45LMzzz79CkUBURnW9ZRUTnZiQtc2jkWNkjFHE65 qWdLkOwkQKaAlIavlZkNUNhxscPsi2H4jh/ltmW1SIW+YwlS+cg71MKIUuTumxDQoE3k Y/fyoVIqseBnzSnHXU93QgH0AXpIW6ZWMGVxsvZ2yvf0nlMyEcNcgQsImXZdSQaGkGe9 gdfA== 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=vvJ0f2sUP/26j4faAiu+S+86UTdCTwt5gHLn8LGtfCc=; fh=nCpGXBL33fxarqwpLHEut+9Ua3Axi0Xey+VyimNYL2w=; b=LOCFaj49BXAYZJfh5xHcns1Wwa2Cr14Kbuw+XtM2eFeU05Sb3TELGX2pmWxBb88TS2 7YdENnwL7pLaqlgn8GQ4V69uEnf5t0erov7ou3zZ7TjOPPAoTwBulVLpkUq/Fwd5l8es RGIjTjwSxYjshOvK1QzJTACK3zbprX+nIWSU8bAMK19m+7Pmsuvm8MqqBhT3Vi91Ppw+ MMqgY4kEqOpqI6eFJgEknOPRvH2K15/K90OO3WvHgjxj6toiOCy+vZv0MIp0/SqsanKR wjXOQccBVCHCwTAeqTBgpj0beoSbappCP9vsfoTb81OjvVWU8uu4flFcBliQ0Dc1xLrH 3ESA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FIDBnUJ3; 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-184921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6622a5f35c3si6922790a12.334.2024.05.21.05.02.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FIDBnUJ3; 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-184921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184921-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A0AABB21D94 for ; Tue, 21 May 2024 12:01:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34BED745D5; Tue, 21 May 2024 12:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FIDBnUJ3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Spr7JNRi" 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 251C455C29 for ; Tue, 21 May 2024 12:00:54 +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=1716292856; cv=none; b=s7kVkCRDEykzZiiQJikkU42zZQbkDiNIVSj6N+1WjNr1bUHdFn3ycenxSUKnWSjthwMTmMPv5CKaHiY0KQ5LeoCeHAauQUJ9gkvAALqZkTFricLNWUwqYfCvTyBKntREo04XVadNLB0pqoOWmTbNGMVoKUCATRkaoRcH3gJ92vo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292856; c=relaxed/simple; bh=2+hxZ4gWqxErB7umts2EDcT/gPEgYlbtK771GFDB2lY=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:MIME-Version: Content-Type; b=p+qOAJv4NCs83J4ggb+shlM2K5e+VhW2S+X39nM+1O03BYnRE8qXB0avu/5nTFJ7juGs2vSeMkD40qCRDlsOQdbjhf1iaTw+r+n2tNFi0kODVok1Hcnez8tCbISZOeDEG0TBstIGvjKDBnUeTDH5GE6Qd5UDa10wjzdjh7Z5f4U= 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=FIDBnUJ3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Spr7JNRi; 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=1716292852; 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=vvJ0f2sUP/26j4faAiu+S+86UTdCTwt5gHLn8LGtfCc=; b=FIDBnUJ3tNa2A87zGFoilcQ4NW/ggJY5l+gygYNhzfpPj0KyyuYxcXa3VTu04ASRNisSJ8 guaI8L20xI8Y+TRBhm/6NJCPsWIZm2iJTp76YYRkPr/xcf+EXXzlZ7VcJIVUUj1EXvfZwj j1PXDAYtX1qKNXnBGyayXWHkYDQQZxmWXdzz2hBCpMfUzfV9+ehA+5GChi4mPXREyzk+w7 mRTyx8OnTRn7JEvrI6vDGnrlyl7gC0kVpo+XEWbK+a9YwLhcGjsuwBN5b6nFgXx4ZGqiG4 65PApQBXsuKuBS47mElardI3u3kJKnGyGZaEa+OhA/EvtEyl9p57JZPvoI8AHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716292852; 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=vvJ0f2sUP/26j4faAiu+S+86UTdCTwt5gHLn8LGtfCc=; b=Spr7JNRi3mmNDcs/K+u7ptTiyPb7qefZdIkH59E9tIl8jW9Bgp2+3hGyy6nd3Ajd5By1Ie ATxdF3CVO32NqwAA== To: Dongli Zhang , x86@kernel.org Cc: mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, joe.jin@oracle.com, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, Borislav Petkov Subject: Re: [PATCH 1/1] x86/vector: Fix vector leak during CPU offline In-Reply-To: <954040a2-435d-48d9-b5de-9ce46ffba238@oracle.com> Date: Tue, 21 May 2024 14:00:52 +0200 Message-ID: <875xv7idcb.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 On Wed, May 15 2024 at 12:51, Dongli Zhang wrote: > On 5/13/24 3:46 PM, Thomas Gleixner wrote: >> So yes, moving the invocation of irq_force_complete_move() before the >> irq_needs_fixup() call makes sense, but it wants this to actually work >> correctly: >> @@ -1097,10 +1098,11 @@ void irq_force_complete_move(struct irq_ >> goto unlock; >> >> /* >> - * If prev_vector is empty, no action required. >> + * If prev_vector is empty or the descriptor was previously >> + * not on the outgoing CPU no action required. >> */ >> vector = apicd->prev_vector; >> - if (!vector) >> + if (!vector || apicd->prev_cpu != smp_processor_id()) >> goto unlock; >> > > The above may not work. migrate_one_irq() relies on irq_force_complete_move() to > always reclaim the apicd->prev_vector. Otherwise, the call of > irq_do_set_affinity() later may return -EBUSY. You're right. But that still can be handled in irq_force_complete_move() with a single unconditional invocation in migrate_one_irq(): cpu = smp_processor_id(); if (!vector || (apicd->cur_cpu != cpu && apicd->prev_cpu != cpu)) goto unlock; because there are only two cases when a cleanup is required: 1) The outgoing CPU is the current target 2) The outgoing CPU was the previous target No? Thanks, tglx