Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3524481yba; Tue, 16 Apr 2019 13:14:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwctxGv/CASVFRldwmcVWGjVDsb/EdxOldL4+hPvzRwfWp1B7v6cgDVCtpPKehXTpy0fjcc X-Received: by 2002:aa7:83ce:: with SMTP id j14mr56040547pfn.57.1555445641388; Tue, 16 Apr 2019 13:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555445641; cv=none; d=google.com; s=arc-20160816; b=wz5+zNmBADn5F1SOK3gJctqbXApEw0dDWjv/svJIBil/V9cGDwvFGs6Cl1hTxEOTYN oUmutGOMWRI53CE3u9dazDgBprnwdhvmOUrvXWGNZffdg6Nxr3gR9KKH+WY9jVR+TEaq GL09T8wOKk5cToA4+/7qooKH2uJFXAKV+h79pZvB4iaEv7N6ZPWqIX1FILaB5XhDMSFj L9sEx8p6nLnA0IEwN6ARb3Hgols+Y/WAiMa9FtTreNTFh4MXKGAFhnD+fXyfr8uXWP7i jz1mRLpZfdQoRUG+IYiKHF8WJrUqGC9RI/8nEryW8/PoMjo/NynAkbmR8oB8Z45hJd9P Yt+Q== 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 :message-id:in-reply-to:subject:cc:to:from:date; bh=7FrVeNAOd/QWQTTWsVvarqV6zKVkkZXmQHUBgcC2Asw=; b=mR7ZpePHZZ9arfwVLUisDVve5o46JICqEGie56YPdEwbTiofZ+7py2uVA0QWVnp9w1 tL9MQemZnDOxNXMoOzumOrghFv00GtXYCcnIPvw3x9zJGHXvMYHhDANTXYhypr61aV6K YFysAVG+V1CDykTmb84eV1vCnCJXqyQbOciInbnkYKD40RnL/lRsWK1CAmUOKam7Ze+V TFRrUpHASg61VJ+O8UW+agr6LFiQ4O7f1QV374hBRUYOClQLhHrx/65GzL/jPdxcwCxk 0pTubPj0Wyq7xF486psRhW9CxWO4Qd1ZFSjYW54NrnhlFBlaJ41fcU84ffToMKXKMOQL zIHg== ARC-Authentication-Results: i=1; mx.google.com; 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 x2si47822994pgh.231.2019.04.16.13.13.44; Tue, 16 Apr 2019 13:14:01 -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; 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 S1728924AbfDPUNL (ORCPT + 99 others); Tue, 16 Apr 2019 16:13:11 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50511 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728000AbfDPUNK (ORCPT ); Tue, 16 Apr 2019 16:13:10 -0400 Received: from pd9ef12d2.dip0.t-ipconnect.de ([217.239.18.210] helo=nanos.glx-home) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hGUS0-0003Ay-6Q; Tue, 16 Apr 2019 22:13:04 +0200 Date: Tue, 16 Apr 2019 22:13:03 +0200 (CEST) From: Thomas Gleixner To: Vitaly Kuznetsov cc: Dexuan Cui , "riel@surriel.com" , "jpoimboe@redhat.com" , "luto@kernel.org" , Stephen Hemminger , Sasha Levin , Haiyang Zhang , KY Srinivasan , "linux-kernel@vger.kernel.org" , Michael Kelley , "marcelo.cerri@canonical.com" , "apw@canonical.com" , "olaf@aepfle.de" , "jasowang@redhat.com" , Peter Zijlstra Subject: Re: [PATCH] smp: Do not warn if smp_call_function_single() is doing a self call. In-Reply-To: <87o9562o3w.fsf@vitty.brq.redhat.com> Message-ID: References: <20190412235341.29379-1-decui@microsoft.com> <20190415122128.GO11158@hirez.programming.kicks-ass.net> <20190416093123.GR11158@hirez.programming.kicks-ass.net> <87o9562o3w.fsf@vitty.brq.redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Apr 2019, Vitaly Kuznetsov wrote: > Peter Zijlstra writes: > > > On Mon, Apr 15, 2019 at 11:39:57PM +0000, Dexuan Cui wrote: > >> > From: Peter Zijlstra > >> > Sent: Monday, April 15, 2019 5:21 AM > >> > To: Dexuan Cui > >> > > >> > On Fri, Apr 12, 2019 at 11:53:57PM +0000, Dexuan Cui wrote: > >> > > If smp_call_function_single() is calling the function for itself, it's safe > >> > > to run with irqs_disabled() == true. > >> > > > >> > > I hit the warning because I'm in the below path in the .suspend callback of > >> > > a "syscore_ops" to support hibernation for a VM running on Hyper-V: > >> > > > >> > > hv_synic_cleanup() -> > >> > > clockevents_unbind_device() -> > >> > > clockevents_unbind() -> > >> > > smp_call_function_single(). > >> > > > >> > > When the .suspend callback runs, only CPU0 is online and irqs_disabled() is > >> > > true. > >> > > >> > Pray tell, how well do you think mutex_lock() works with interrupts > >> > disabled? > >> > >> Good point. I realized generally speaking this patch makes no sense, so let me > >> try the solution proposed by Vitaly, i.e. fix clockevents_unbind() instead. > > > > That's still not the problem. You're calling clockevents_unbind_device() > > with IRQs disabled, that's not correct. It doesn't matter what > > clockevents_unbind() does thereafter. > > > > True. And before we start digging deeper into this, let's step back: why > do we need to do clockevents_unbind_device() on hybernation? Can we just > disable the device and re-enable it back on resume? Yes. That's the right thing to do. Simple solution is to implement the suspend/resume callbacks on the clock events device and be done with it. > Actually, all usages of clockevents_unbind_device() in kernel are > limited to Hyper-V and with Michael's patches moving this out of VMBus > driver I think it can go away completely. Correct. There was a driver which required that, but that's gone by now and of course nobody noticed that it was the last user. The reason why this exists was to allow switching out an active clocksource similar to the sysfs unbind file but without user space interaction. Thanks, tglx