From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbdAZONR (ORCPT ); Thu, 26 Jan 2017 09:13:17 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35944 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752054AbdAZONQ (ORCPT ); Thu, 26 Jan 2017 09:13:16 -0500 MIME-Version: 1.0 From: Hardik H Bagdi Date: Thu, 26 Jan 2017 09:12:34 -0500 Message-ID: Subject: Understanding stop_machine() use for cpu_down() To: linux-kernel@vger.kernel.org Cc: rusty@rustcorp.com.au, vatsa@in.ibm.com, ashok.raj@intel.com, zwanem@gmail.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm trying to understand why stop_machine() is necessary for cpu_down() operation. I see that multi_cpu_stop() on every online cpu (which hogs the cpu and then triggers state changes state) and then, take_cpu_down is invoked on the outgoing cpu. This happens by every cpu decrementing the msdata->thread_ack and last one trigger a state change. I'm trying to understand why is this necessary. Is to wait for RCU grace period(s)? If yes, what variable/struct is being protected and how does stop_machine() help there? I see there was a patch (https://lwn.net/Articles/538819/) but had some issues with idle_loop. Is there an alternative where the stop_machine would not be necessary? Or more specifically, is there a reason why every CPU would need to stop? Any help would be appreciated. Thanks, Hardik