Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4709672ybi; Mon, 15 Jul 2019 13:27:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKxRDWK7PbuXrO/WFDdkC+kCvPvuGPUZXukTbZnDObz5yjrP7qCqPXNH3kaZEkhmMyFnF7 X-Received: by 2002:a17:902:b789:: with SMTP id e9mr29646598pls.294.1563222464202; Mon, 15 Jul 2019 13:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563222464; cv=none; d=google.com; s=arc-20160816; b=nmM5FmIO64TpjvDuT+0J32O3EHZAbPT21OqusthRxid5OPhuwMwhWmeoc7B21t5MiG GVkvHvjoYLLJ4Q3ZVmaM5h7GLLX8N1to403QAsESlr6wI/HfbfuxOJm8/nNgWMVoab+w +m8K3KSzGI4P+PASR+4kMUn50DGfkUSOBu141wSX5C9C5ewGT2OQaGfzYXUx7+FJq8qe J/42/yEQ2jYhS/f4qwA9Ihz5QY8sRLhSS9dG+KYQtbUUMm/go/g+VRC7T61BvmTOqyzq y+CscS1Ua8qN5BESwLIUqog7tEtC2r6cIadca5K5SYpMTV+KBiUy+/i/6cg5JTU39Ey/ 8wWQ== 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 :message-id:date:subject:cc:to:from; bh=2CVrVxxYKkKu3Ne0k5bckhXRTOY/Pu3ChzCuefdK2kk=; b=CzdUwiL8n0c4bPT5PXl+WWix6SI6ooQlXdHl1vpNIUx9XXVzCpkxQNFL5TI7863Y12 h4bnBrKKf3PWU1BuR0GcMyKWeY6xggEdPMeZqfvn+BjzMGdDRmKyGl/uMIirwJH79sAd jj/ITcUuU8vYUV7QTqwT+c+jVbAF5FKW7zeHo26svvDksMOLzqvJkks911eZBxWa4fB0 eI9xLvJUFHFrURyQtiFfN6W8fITJbeofrDL/87nBPopx3SIU/WRH6KR1UEulSmnTj3Vh CCiXEIvQtwSb5ztZexsEc4YCzZuSfnSXHkOTVT9VMjbEKSTg6FEH5nLcO5Drjyyoq67e rKFQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si17139773pfa.282.2019.07.15.13.27.25; Mon, 15 Jul 2019 13:27: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732287AbfGOUZD (ORCPT + 99 others); Mon, 15 Jul 2019 16:25:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731055AbfGOUZD (ORCPT ); Mon, 15 Jul 2019 16:25:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62F673081244; Mon, 15 Jul 2019 20:25:02 +0000 (UTC) Received: from torg.redhat.com (ovpn-121-239.rdu2.redhat.com [10.10.121.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 958225D721; Mon, 15 Jul 2019 20:25:01 +0000 (UTC) From: Clark Williams To: Thomas Gleixner Cc: LKML , RT List Subject: [PATCH] x86_pkg_temp_thermal: make pkg_temp_lock a raw spinlock Date: Mon, 15 Jul 2019 15:25:00 -0500 Message-Id: <20190715202500.6742-1-williams@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 15 Jul 2019 20:25:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The spinlock pkg_temp_lock has the potential of being taken in atomic context on v5.2-rt PREEMPT_RT. It's static and limited scope so go ahead and make it a raw spinlock. Signed-off-by: Clark Williams --- drivers/thermal/intel/x86_pkg_temp_thermal.c | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index 319b77126168..92ceed3de6f3 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -63,7 +63,7 @@ static int max_packages __read_mostly; /* Array of package pointers */ static struct pkg_device **packages; /* Serializes interrupt notification, work and hotplug */ -static DEFINE_SPINLOCK(pkg_temp_lock); +static DEFINE_RAW_SPINLOCK(pkg_temp_lock); /* Protects zone operation in the work function against hotplug removal */ static DEFINE_MUTEX(thermal_zone_mutex); @@ -279,12 +279,12 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) u64 msr_val, wr_val; mutex_lock(&thermal_zone_mutex); - spin_lock_irq(&pkg_temp_lock); + raw_spin_lock_irq(&pkg_temp_lock); ++pkg_work_cnt; pkgdev = pkg_temp_thermal_get_dev(cpu); if (!pkgdev) { - spin_unlock_irq(&pkg_temp_lock); + raw_spin_unlock_irq(&pkg_temp_lock); mutex_unlock(&thermal_zone_mutex); return; } @@ -298,7 +298,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) } enable_pkg_thres_interrupt(); - spin_unlock_irq(&pkg_temp_lock); + raw_spin_unlock_irq(&pkg_temp_lock); /* * If tzone is not NULL, then thermal_zone_mutex will prevent the @@ -323,7 +323,7 @@ static int pkg_thermal_notify(u64 msr_val) struct pkg_device *pkgdev; unsigned long flags; - spin_lock_irqsave(&pkg_temp_lock, flags); + raw_spin_lock_irqsave(&pkg_temp_lock, flags); ++pkg_interrupt_cnt; disable_pkg_thres_interrupt(); @@ -335,7 +335,7 @@ static int pkg_thermal_notify(u64 msr_val) pkg_thermal_schedule_work(pkgdev->cpu, &pkgdev->work); } - spin_unlock_irqrestore(&pkg_temp_lock, flags); + raw_spin_unlock_irqrestore(&pkg_temp_lock, flags); return 0; } @@ -381,9 +381,9 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) pkgdev->msr_pkg_therm_high); cpumask_set_cpu(cpu, &pkgdev->cpumask); - spin_lock_irq(&pkg_temp_lock); + raw_spin_lock_irq(&pkg_temp_lock); packages[pkgid] = pkgdev; - spin_unlock_irq(&pkg_temp_lock); + raw_spin_unlock_irq(&pkg_temp_lock); return 0; } @@ -420,7 +420,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) } /* Protect against work and interrupts */ - spin_lock_irq(&pkg_temp_lock); + raw_spin_lock_irq(&pkg_temp_lock); /* * Check whether this cpu was the current target and store the new @@ -452,9 +452,9 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) * To cancel the work we need to drop the lock, otherwise * we might deadlock if the work needs to be flushed. */ - spin_unlock_irq(&pkg_temp_lock); + raw_spin_unlock_irq(&pkg_temp_lock); cancel_delayed_work_sync(&pkgdev->work); - spin_lock_irq(&pkg_temp_lock); + raw_spin_lock_irq(&pkg_temp_lock); /* * If this is not the last cpu in the package and the work * did not run after we dropped the lock above, then we @@ -465,7 +465,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) pkg_thermal_schedule_work(target, &pkgdev->work); } - spin_unlock_irq(&pkg_temp_lock); + raw_spin_unlock_irq(&pkg_temp_lock); /* Final cleanup if this is the last cpu */ if (lastcpu) -- 2.21.0