Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp583071ybv; Sat, 22 Feb 2020 09:52:30 -0800 (PST) X-Google-Smtp-Source: APXvYqyclWr+86KlJiGF3Z8R7UjQJrM6dGgT4deSm6kxQwyJ6IheTl/yTKbNwfh9odeJnlyoQiUW X-Received: by 2002:a05:6830:88:: with SMTP id a8mr19554883oto.177.1582393950580; Sat, 22 Feb 2020 09:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582393950; cv=none; d=google.com; s=arc-20160816; b=ZKxs0QRLa+i0tXfg9i4nBScPaXUNtzZ3iJ1YQ1cuzBRL5jwE8hDj2f9suV8V0M3JJX wIBGz4LIJqCGXFyUA4a+FyyeT6/wFhOOSIMTdMiQjXY3QFANmePI5hkUv7lHQc2dOd3V n4i/sU2fzdXMRt90cc75shcJWfVLd6F9T0iw8THFoCe76WJgQcgvUszo7Wk4GceKH285 3Ua/igS8yhD3JgG5ymIMUsBzDHL1bLYiSs3qM+50QQ//frZefVXrjV9f+d0Yi5F1iSjv uQATZEsjcdWEco0s2rN0n+lMc2oUYr3g5V7sCqn9csoeBEgQ8qHl34wVIIYiW2szBMr9 6xEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+k6vcshKzlOrgLczSsM+NviqJvVFIej9VdfUzXk4rKw=; b=nJdatmhrB6YU9ZL5AmeYIALhUWobKWM/lhZfJRstNTe8HE5z2R7Ap1PYQXQ3ZvyLL4 vLUXg15753tz/dJze1PjlY4u/PiOYOrnJaTn2ju5wmQOGpFEvq1aSLYpXb9godgFZDIi FqG5lihTjPtro/aIpC136CnHDKBXz5B/kIsmDF5O0KQiQsMICmt8IlWfiWDbAUz6ifda a2koVaCZb3OSfhvADtwXGjjyUnIisbZitEyQLnFPIUcJD2wuknk5PXT4pz4VqCF4Hftk xtOR8//kO5NX+fqf4k3rbGExv9nsAscYKeJrQLIxsNqpN+DQUvYmW7ULeC989iSbDuUX tWfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=iPp3t+d2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h139si2487786oib.85.2020.02.22.09.52.17; Sat, 22 Feb 2020 09:52:30 -0800 (PST) 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=@alien8.de header.s=dkim header.b=iPp3t+d2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbgBVRwD (ORCPT + 99 others); Sat, 22 Feb 2020 12:52:03 -0500 Received: from mail.skyhub.de ([5.9.137.197]:36234 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726832AbgBVRwA (ORCPT ); Sat, 22 Feb 2020 12:52:00 -0500 Received: from zn.tnic (p200300EC2F1C5400329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2f1c:5400:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 3A2281EC0C2B; Sat, 22 Feb 2020 18:51:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1582393918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=+k6vcshKzlOrgLczSsM+NviqJvVFIej9VdfUzXk4rKw=; b=iPp3t+d2hLwXdK9KVbZ1Q/pMALh9+LAmxFGWPePZ/HbxwA1eHQqOBewIIbSUdos66lL1TQ 4NFMwGEOglbBtnIrKTyDgAd8tERR3eFaXN3Cz6KAwctN4zIhuyqmc7kxHbIHgxQ94BTmNn vIsldXPWISxQOFFD57mByBsNC7/djcg= Date: Sat, 22 Feb 2020 18:51:51 +0100 From: Borislav Petkov To: Srinivas Pandruvada Cc: tony.luck@intel.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Wilson Subject: Re: [PATCH] x86/mce/therm_throt: Handle case where throttle_active_work() is called on behalf of an offline CPU Message-ID: <20200222175151.GD11284@zn.tnic> References: <20200222162432.497201-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200222162432.497201-1-srinivas.pandruvada@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 22, 2020 at 08:24:32AM -0800, Srinivas Pandruvada wrote: > During cpu-hotplug test with CONFIG_PREEMPTION and CONFIG_DEBUG_PREEMPT > enabled, Chris reported error: > > BUG: using smp_processor_id() in preemptible [00000000] code: kworker/1:0/17 > caller is throttle_active_work+0x12/0x280 > > Here throttle_active_work() is a work queue callback scheduled with > schedule_delayed_work_on(). This will not cause this error for the use > of smp_processor_id() under normal conditions as there is a check for > "current->nr_cpus_allowed == 1". > But when the target CPU is offline the workqueue becomes unbound. > Then the work queue callback can be scheduled on another CPU and the > error is printed for the use of smp_processor_id() in preemptible context. So what's wrong with simply doing: if (cpu_is_offline(this_cpu)) return; ? You don't need to run the callback on an offlined CPU anyway... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette