Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3924885imm; Mon, 8 Oct 2018 11:46:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV608MLeI09/3ugR+o8HBuO99sIlRUWaF1KUEoe7hVmX/94VZcrZzI45vLrKxgAyKco3L6toZ X-Received: by 2002:a62:18d3:: with SMTP id 202-v6mr20855861pfy.143.1539024414897; Mon, 08 Oct 2018 11:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024414; cv=none; d=google.com; s=arc-20160816; b=xF8aRazPzvPrlU4sehDXI5+wLR6Hu8wwL1LsUxx0y4idNAtnIwSyCiS744l6xxa9G9 IEbJrgWIuxPiSkY7cxm1DbvnhkvtAkR6J5gt3ZxjWtMjm1l0P4WBpvvJtC+uNDF6li2X A8GW8YTiugx3jIF5TFKDHoONbxXenINTsYfh6/9YBqNMED6thatzq69Zm84faG5pT6Rs FFy2Kzfit0K2u5lRHouxiyFeHJWiLRA/mQIkNam74/fab6Si0DuUT9cTvO0/haWQybvf WMi0T32LS1hKG0MDXVZWJDJpIGX8M562qRMX9rkthaG5w4R8mMBinZPLMRQfxmYxzgpA K0Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sl0GT8WfTj8EU/TVkf7in44RfGDiOsQD9qGhbubNgRA=; b=DQ222Gqkfg6ticURdBJTaEhqckFfhlZ/NK4fw63Up/tu1czazNdIVVFXwpi0fjg+TC ffPxFq4KlT0YMJilNxOqWJWNRe2bbqpSGchQx0Rm5aQeJxHBV2+pvjMhCtPNctNdJye0 tHbx8B+n4oSxgT1wCD9a44T7S6WJ9WZuUQTraAfFD0hPCIhpVsqwF6VEow7vmOZ9V+8X 3EqYuzlBid4HTLxC0KDH523J0BIU9GSRDuYnEiYka8P4vpVnkmiMJYQ4R/FYX/igOUjJ HFEeL8nB6QMOMv9n2qyZR9kZsmoXgwyKtM2kuK+OWkOcxjd48nUXmVAfP9sd+enujZx1 hkOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LEjRF0Yh; 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 k9-v6si19043559pfg.57.2018.10.08.11.46.39; Mon, 08 Oct 2018 11:46:54 -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=LEjRF0Yh; 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 S1730891AbeJIB6G (ORCPT + 99 others); Mon, 8 Oct 2018 21:58:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:46098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730200AbeJIB6G (ORCPT ); Mon, 8 Oct 2018 21:58:06 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 38AE22064A; Mon, 8 Oct 2018 18:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024300; bh=Tt62fx2IAlLYKtFG4xvsJprTfvRkFjZijynlY1GCBZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEjRF0Yh4cwZRcKp4jFfKVkAJlk8NGNXU9HqoUpgDqfm2j8VdZTa7LZiu+I3/QCYb z7XPXevWPdf0+l8GWqabfhdhesM+3nCIS4BFTzl5K+avljwVBRqERQ3YwPcz3lzLcl UU7igQRZjQnE7iXcs9syGHR3NCFfwjqmeu+wGWfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dexuan Cui , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger Subject: [PATCH 4.14 90/94] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() Date: Mon, 8 Oct 2018 20:32:11 +0200 Message-Id: <20181008175610.839100740@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175605.067676667@linuxfoundation.org> References: <20181008175605.067676667@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Dexuan Cui commit 41e270f6898e7502be9fd6920ee0a108ca259d36 upstream. With CONFIG_DEBUG_PREEMPT=y, I always see this warning: BUG: using smp_processor_id() in preemptible [00000000] Fix the false warning by using get/put_cpu(). Here vmbus_connect() sends a message to the host and waits for the host's response. The host will deliver the response message and an interrupt on CPU msg->target_vcpu, and later the interrupt handler will wake up vmbus_connect(). vmbus_connect() doesn't really have to run on the same cpu as CPU msg->target_vcpu, so it's safe to call put_cpu() just here. Signed-off-by: Dexuan Cui Cc: stable@vger.kernel.org Cc: K. Y. Srinivasan Cc: Haiyang Zhang Cc: Stephen Hemminger Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- drivers/hv/connection.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -74,6 +74,7 @@ static int vmbus_negotiate_version(struc __u32 version) { int ret = 0; + unsigned int cur_cpu; struct vmbus_channel_initiate_contact *msg; unsigned long flags; @@ -96,9 +97,10 @@ static int vmbus_negotiate_version(struc * the CPU attempting to connect may not be CPU 0. */ if (version >= VERSION_WIN8_1) { - msg->target_vcpu = - hv_cpu_number_to_vp_number(smp_processor_id()); - vmbus_connection.connect_cpu = smp_processor_id(); + cur_cpu = get_cpu(); + msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu); + vmbus_connection.connect_cpu = cur_cpu; + put_cpu(); } else { msg->target_vcpu = 0; vmbus_connection.connect_cpu = 0;