Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2005686imm; Thu, 24 May 2018 04:23:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp81M7iTs88+ykQp4/wMfGHFoLkfewteA6tO/giugpMp/+lab7rlhqR12U1reHSSWGZsI17 X-Received: by 2002:a17:902:8a81:: with SMTP id p1-v6mr7122255plo.33.1527161003728; Thu, 24 May 2018 04:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161003; cv=none; d=google.com; s=arc-20160816; b=Uayp6pkM9ec9YADiUsMZziYyU1QwVoqj04JH1hNhEtzQTi2LUFTiPJXdyzof1qWEAk WpOx7yOuAP4Hh7fzgAOCRC3q2271xDyueXjsX0gB28ari7FNB64rouJACIZ04y81+r0W BEZWuHxw+MzipLMZJ/td0rJkSvc9eS5Fy4lLrd8QLRZmpPfQzaXgrsMaBmZjTAROpO/b z60qmog6uGQJZ9WEDhWKHiTXe1aZ4Eyx0IC+8wEB6vhaaSItPgkuQhUbZEjtDo1CMf/6 mslUeiNHJ/nxoDkqK51FN4Fo53E5kQs1tnLSYkfNtl+DP6VKuxw5upxOiXpJVzRTA1dY h8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MaOqdoCm4kl8XmopCInnqB9dgVN7/KggPRn8y1gqYc4=; b=Rox8scKx6l9kZQktLHSpxklUffegHrwx5IB83Y7RFEAQtioime4faBuSx0efYHT/2C Ja7Ua4QcWuj7kLGjMNnriY0+VYQdSMM7RIea1cWq0ExmwNFPF/mcRrtijJrYFmrPsEfw Sgw8xZZpJtvcr95YjjT2llEaagHeWZBKbLUZ4zkuR7PKcbQUF5GFvFMfnDqcgL6+7zGH di6GblduWdCJK71rysaIg2KVyGaHSbPxOw1Nex+Mdtsjyiixe5DKUZQxddyFKZTI+NJE kVPu9YygDwnnQ1wCE/t0ndLwT7ARV2c5vkczPvpSXO49BP8Ln3xcNPbwK4kTfvBXU11/ /4ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TovC5Hp6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si21289593plz.66.2018.05.24.04.23.09; Thu, 24 May 2018 04:23:23 -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=@kernel.org header.s=default header.b=TovC5Hp6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033047AbeEXLWZ (ORCPT + 99 others); Thu, 24 May 2018 07:22:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:51312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967840AbeEXJwT (ORCPT ); Thu, 24 May 2018 05:52:19 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ABA420847; Thu, 24 May 2018 09:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155538; bh=hS8irXEPsBQWQvJmNOu0N1Iuvj1xpkxCMD1zdGR0eAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TovC5Hp6w+hmYZe4swKMJBrahlIZ90ksmTv+s3Xv3M0jGFO+b1D0amlIhlYfDMPaY l/ChhmUcKrK8g2Fi9yZh7d8pDj5ayvNgM3cNbC7WRQ3V0mM3GKsfV8Twv3vI/1oLhC 1m73/XbC6XhAT2R2pH2vab57GEC/a2TjYWopkxfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Hemminger , "David S. Miller" Subject: [PATCH 4.14 025/165] hv_netvsc: fix race in napi poll when rescheduling Date: Thu, 24 May 2018 11:37:11 +0200 Message-Id: <20180524093622.999356098@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephen Hemminger [ Commit d64e38ae690e3337db0d38d9b149a193a1646c4b upstream. ] There is a race between napi_reschedule and re-enabling interrupts which could lead to missed host interrrupts. This occurs when interrupts are re-enabled (hv_end_read) and vmbus irq callback (netvsc_channel_cb) has already scheduled NAPI. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1205,9 +1205,10 @@ int netvsc_poll(struct napi_struct *napi if (send_recv_completions(ndev, net_device, nvchan) == 0 && work_done < budget && napi_complete_done(napi, work_done) && - hv_end_read(&channel->inbound)) { + hv_end_read(&channel->inbound) && + napi_schedule_prep(napi)) { hv_begin_read(&channel->inbound); - napi_reschedule(napi); + __napi_schedule(napi); } /* Driver may overshoot since multiple packets per descriptor */