Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp557126imm; Tue, 5 Jun 2018 00:07:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLOpaoY3J6fNKYlM9UZQcD3v0iRi7WnDLdmhospPGX36NWJ8LvF7z8wFZRMsJ5/bzcFRH4T X-Received: by 2002:a63:7d08:: with SMTP id y8-v6mr15261496pgc.417.1528182471670; Tue, 05 Jun 2018 00:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528182471; cv=none; d=google.com; s=arc-20160816; b=i+cfc8B27m0OuU6GBGDazDiTNhOjOUFJqpxrZRIPDIoWwIKHDrk//1Ia4ByL/UtD62 Jij0s84NorF3l1Q4MGQNdJGUTJdJjRYWPbk2ErU7gXiSuSIZYW3Lt6QfsGsZ+DW6BJHK nZ/aqUyJn3sXni9+Qm4jebrQWLUbhUT7DeO5JzteXhP9Byrqu6YKrzQs1Vce6B9VqSVA TIgthzKhtVmNgo+Q4wMfNEug9uzFmsmRbh7fCxPb5VnCfTebkkbLPna/gSaZjNhFQFAG mJf7qiN1La0zYLFtoHsQZx3gUt5x0A+fwmleWApngsPtB9R+6XqX5Q4r1VMYhO+hZjvQ v6ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=lFN9v7GXvQQ56FxDaqf8iOgFSS6sR9wqbbbgxrobBm4=; b=BLs3bVN8u2PEiu1Dv1iN8mABeeKFBbxOrYaoBNp00Aaid4j0DWSWYd4KYwlSHhvTX3 TWOI4SkknS9vcI4qDxxWhN016O+yXQYSqVe7G2fysAPuIgKUl0uewTincgLyX91+6T3O busRbcnIvkl5jB6jfDM2BitpI31AN5XDCkdTIxqyeMEVLpT2E7ahDKDTkhCLaqmTktuh 5lna6jB2SdmS4XNNzJ9v7vEDNtAKX1QYtfajyLEiX/xp/5NvmzozWl0evLt5gHL9bAjI HBQgTYVPYLIudRdahrWZmRK2m606zGnqvfhbkTEDsgImeyaJrX3mqgHWvuGdNTvMnQBV uO1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Id8TZKqv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si13190985plf.495.2018.06.05.00.07.37; Tue, 05 Jun 2018 00:07:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Id8TZKqv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751822AbeFEHHK (ORCPT + 99 others); Tue, 5 Jun 2018 03:07:10 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:38409 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbeFEHHI (ORCPT ); Tue, 5 Jun 2018 03:07:08 -0400 Received: by mail-oi0-f68.google.com with SMTP id d5-v6so1101700oib.5; Tue, 05 Jun 2018 00:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lFN9v7GXvQQ56FxDaqf8iOgFSS6sR9wqbbbgxrobBm4=; b=Id8TZKqvMWiwMHwFGXLN96ZpJ4j5zr3meSxaYwFweQRppAxevRHzX3CgGQ5ITPNk+X ATFGbPiFKXjfk0DxNUiBarADxwrlF4YDwpjYxTLgmRuG5ht8Fxvzz7vjXhO658GAw8To e9eVlEh+QdO8JiVbEBFktxhfSAvjJJ3nYY0yvPJym7akwYwzc/FF9fStEUA+SER0IcYq jK9Osdzf/Wa42DOUkvEFAg2GHO5l02inFO08QAs2sJHkm7Qm/LJe5/SiG+7NeWhQ6GrM rypov6rNKfMWTm/VEcJK8d8Jp17jPCcZXoozHrZQ4fhxMzZY17DB6F4icrnBQrqdcgiK Xnow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lFN9v7GXvQQ56FxDaqf8iOgFSS6sR9wqbbbgxrobBm4=; b=OYtxVuSU9h6YM8oX5OQ8b7ng5mcdGGrgdvVl803czd3Qt8ppGXtjX7kxw335PIhqG8 lE3TupxuPOuLFWlNA96a8NzaEKlFJFH9SdDiJWfsx6Fn0Z1mDWGT2cMAgGPUgrSaeH0I 2RfRbodVHLABfL7mluXL/qnECNQ+lDxEWZERhO7WEd+mt8XhjbbQxnoQAk7GHj/DtspX fasQJTbXbl2TgjHB9DaK1lBjtTswxUsvIGfzMXIo9PF+fcZppi4RfyemGmbdMo3yfnvm te+ATnSn7lJUEEdoCngP2T0v3jiUgZ25fjel0xQDSceeH89UyGiwsN7lspD3yZQQ4N8H AKNw== X-Gm-Message-State: APt69E1+E8bsqXL3+5UBk18YH0pbBxixYYupw9KSlgSW/OednFjIJplP /kg6OWk5TxRCutD/M+/2666skfIdTS6wnn00MXA= X-Received: by 2002:aca:3544:: with SMTP id c65-v6mr5200012oia.326.1528182428316; Tue, 05 Jun 2018 00:07:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:349c:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 00:07:08 -0700 (PDT) In-Reply-To: <20180604162224.386544292@linutronix.de> References: <20180604162224.386544292@linutronix.de> From: Song Liu Date: Tue, 5 Jun 2018 00:07:08 -0700 Message-ID: Subject: Re: [patch 2/8] genirq/generic_pending: Do not lose pending affinity update To: Thomas Gleixner Cc: LKML , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Dmitry Safonov <0x7f454c46@gmail.com>, Tariq Toukan , Joerg Roedel , Mike Travis , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 4, 2018 at 8:33 AM, Thomas Gleixner wrote: > The generic pending interrupt mechanism moves interrupts from the interrupt > handler on the original target CPU to the new destination CPU. This is > required for x86 and ia64 due to the way the interrupt delivery and > acknowledge works if the interrupts are not remapped. > > However that update can fail for various reasons. Some of them are valid > reasons to discard the pending update, but the case, when the previous move > has not been fully cleaned up is not a legit reason to fail. > > Check the return value of irq_do_set_affinity() for -EBUSY, which indicates > a pending cleanup, and rearm the pending move in the irq dexcriptor so it's > tried again when the next interrupt arrives. > > Fixes: 996c591227d9 ("x86/irq: Plug vector cleanup race") > Signed-off-by: Thomas Gleixner > Cc: stable@vger.kernel.org Tested-by: Song Liu > --- > kernel/irq/migration.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > --- a/kernel/irq/migration.c > +++ b/kernel/irq/migration.c > @@ -38,17 +38,18 @@ bool irq_fixup_move_pending(struct irq_d > void irq_move_masked_irq(struct irq_data *idata) > { > struct irq_desc *desc = irq_data_to_desc(idata); > - struct irq_chip *chip = desc->irq_data.chip; > + struct irq_data *data = &desc->irq_data; > + struct irq_chip *chip = data->chip; > > - if (likely(!irqd_is_setaffinity_pending(&desc->irq_data))) > + if (likely(!irqd_is_setaffinity_pending(data))) > return; > > - irqd_clr_move_pending(&desc->irq_data); > + irqd_clr_move_pending(data); > > /* > * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. > */ > - if (irqd_is_per_cpu(&desc->irq_data)) { > + if (irqd_is_per_cpu(data)) { > WARN_ON(1); > return; > } > @@ -73,9 +74,20 @@ void irq_move_masked_irq(struct irq_data > * For correct operation this depends on the caller > * masking the irqs. > */ > - if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) > - irq_do_set_affinity(&desc->irq_data, desc->pending_mask, false); > + if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) { > + int ret; > > + ret = irq_do_set_affinity(data, desc->pending_mask, false); > + /* > + * If the there is a cleanup pending in the underlying > + * vector management, reschedule the move for the next > + * interrupt. Leave desc->pending_mask intact. > + */ > + if (ret == -EBUSY) { > + irqd_set_move_pending(data); > + return; > + } > + } > cpumask_clear(desc->pending_mask); > } > > >