Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3932391imm; Mon, 8 Oct 2018 11:54:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61j9hsB266PAEbN5MKfIUkM7tcIr3vr7EokN7YaRVxWJwyqP8ONK86gGGrXolfMZppX5lJm X-Received: by 2002:a63:fd58:: with SMTP id m24-v6mr22849160pgj.132.1539024884897; Mon, 08 Oct 2018 11:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024884; cv=none; d=google.com; s=arc-20160816; b=v9LSgaCugvGAEcge4l/+To87b7sRMA+B6/bJkr+qYRlxNYgcRIJ2SupERcUG1E0Qky LXwcd82RfAI6Of4Yp6SiQfG0ScOHA6aSPgvrm1AhCYFNE+CFpjGc+LCwMCj8fxOol5cw WIPpBwqQzKw2hCmsZ4nEFPiKAQy3LIZkUg3q/sXRAIe8Xb/trn52CvqYalbZ5gInceP/ to+6HOzWMkfDXFKoV1SeHgUFauztcIAzKPUExK6ST+58OXILsPUxDmGoNlyh3lzb50pi CTPR4it3ntdKucDaTM+Bo4U6pB/DvfBpPQdWE98wPkSMagg9vfrxuj5GjsjO1vvj2RxD d37g== 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=LAlff/HVq+Vs5PwN3kZF3WViVmGeJt5rQr5Zbxl2Dz0=; b=hs+5rjZVZekBZm6G+E0kdFOKrRl4rn/paozvrvPKdA0oSslrjceim9lMJsMrrIxcyM 3aVMtevQgJGLYa/30pVS7DebQsoxtDRMS2RqI4JT+S+LckqjsRNpuowlPOYUu+D3LHYb T7Z180M8tjBrR3DmYq66OfugYrzGJ4I09nLS+2lSdDmdOCmkBnV44iOnl7JlWdv7UCmC eWlIW+vfVySCPTRjWmsgS1nNs0ywM62OXriDIUu711iXxhWJQC8rkeUrCIvtzHI0m3is D8ODC604/1UBCMADHTStumPbU0XUYk+bYbEXjlrT6dQi1tfXAf0n38G5NZX8IZy5ZOMW k5iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CG7GhEwx; 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 m16-v6si15384217pgl.462.2018.10.08.11.54.29; Mon, 08 Oct 2018 11:54:44 -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=CG7GhEwx; 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 S1732923AbeJICH0 (ORCPT + 99 others); Mon, 8 Oct 2018 22:07:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:58012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeJICHZ (ORCPT ); Mon, 8 Oct 2018 22:07:25 -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 976182087D; Mon, 8 Oct 2018 18:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024857; bh=FkRoXFK2Fc9ttFQrZ2ZvlovEjn38SFgvqSehJ/+1T2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CG7GhEwxIZLk+lAMExu2udDllT7jC8mgGMwnerAbOhPeCD3/MuPn9wdpYGndx0RzM qQ2ugPlc2j0l79SPSGooDPcaaPrU7KGILAw1dB5eDbN46ZE2f8/wp4SWxwdflI+8BB 6oex4cKoyjJN5/9p+rCIPIFSSwCiE2mRpdP9QTME= 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.18 163/168] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() Date: Mon, 8 Oct 2018 20:32:23 +0200 Message-Id: <20181008175626.252729336@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@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.18-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 @@ -76,6 +76,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; @@ -118,9 +119,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;