All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH 5.4 50/50] PM / devfreq: Add missing locking while setting suspend_freq
Date: Fri,  8 May 2020 14:35:56 +0200	[thread overview]
Message-ID: <20200508123049.823407886@linuxfoundation.org> (raw)
In-Reply-To: <20200508123043.085296641@linuxfoundation.org>

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit e1e047ace8cef6d143f38c7d769753f133becbe6 upstream.

Commit 2abb0d5268ae ("PM / devfreq: Lock devfreq in trans_stat_show")
revealed a missing locking while calling devfreq_update_status() function
during suspend/resume cycle.

Code analysis revealed that devfreq_set_target() function was called
without needed locks held for setting device specific suspend_freq if such
has been defined. This patch fixes that by adding the needed locking, what
fixes following kernel warning on Exynos4412-based OdroidU3 board during
system suspend:

PM: suspend entry (deep)
Filesystems sync: 0.002 seconds
Freezing user space processes ... (elapsed 0.001 seconds) done.
OOM killer disabled.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
------------[ cut here ]------------
WARNING: CPU: 2 PID: 1385 at drivers/devfreq/devfreq.c:204 devfreq_update_status+0xc0/0x188
Modules linked in:
CPU: 2 PID: 1385 Comm: rtcwake Not tainted 5.4.0-rc6-next-20191111 #6848
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0112588>] (unwind_backtrace) from [<c010e070>] (show_stack+0x10/0x14)
[<c010e070>] (show_stack) from [<c0afb010>] (dump_stack+0xb4/0xe0)
[<c0afb010>] (dump_stack) from [<c01272e0>] (__warn+0xf4/0x10c)
[<c01272e0>] (__warn) from [<c01273a8>] (warn_slowpath_fmt+0xb0/0xb8)
[<c01273a8>] (warn_slowpath_fmt) from [<c07d105c>] (devfreq_update_status+0xc0/0x188)
[<c07d105c>] (devfreq_update_status) from [<c07d2d70>] (devfreq_set_target+0xb0/0x15c)
[<c07d2d70>] (devfreq_set_target) from [<c07d3598>] (devfreq_suspend+0x2c/0x64)
[<c07d3598>] (devfreq_suspend) from [<c05de0b0>] (dpm_suspend+0xa4/0x57c)
[<c05de0b0>] (dpm_suspend) from [<c05def74>] (dpm_suspend_start+0x98/0xa0)
[<c05def74>] (dpm_suspend_start) from [<c0195b58>] (suspend_devices_and_enter+0xec/0xc74)
[<c0195b58>] (suspend_devices_and_enter) from [<c0196a20>] (pm_suspend+0x340/0x410)
[<c0196a20>] (pm_suspend) from [<c019480c>] (state_store+0x6c/0xc8)
[<c019480c>] (state_store) from [<c033fc50>] (kernfs_fop_write+0x10c/0x228)
[<c033fc50>] (kernfs_fop_write) from [<c02a6d3c>] (__vfs_write+0x30/0x1d0)
[<c02a6d3c>] (__vfs_write) from [<c02a9afc>] (vfs_write+0xa4/0x180)
[<c02a9afc>] (vfs_write) from [<c02a9d58>] (ksys_write+0x60/0xd8)
[<c02a9d58>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xed3d7fa8 to 0xed3d7ff0)
...
irq event stamp: 9667
hardirqs last  enabled at (9679): [<c0b1e7c4>] _raw_spin_unlock_irq+0x20/0x58
hardirqs last disabled at (9698): [<c0b16a20>] __schedule+0xd8/0x818
softirqs last  enabled at (9694): [<c01026fc>] __do_softirq+0x4fc/0x5fc
softirqs last disabled at (9719): [<c012fe68>] irq_exit+0x16c/0x170
---[ end trace 41ac5b57d046bdbc ]---
------------[ cut here ]------------

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/devfreq/devfreq.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -902,7 +902,9 @@ int devfreq_suspend_device(struct devfre
 	}
 
 	if (devfreq->suspend_freq) {
+		mutex_lock(&devfreq->lock);
 		ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
+		mutex_unlock(&devfreq->lock);
 		if (ret)
 			return ret;
 	}
@@ -930,7 +932,9 @@ int devfreq_resume_device(struct devfreq
 		return 0;
 
 	if (devfreq->resume_freq) {
+		mutex_lock(&devfreq->lock);
 		ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
+		mutex_unlock(&devfreq->lock);
 		if (ret)
 			return ret;
 	}



  parent reply	other threads:[~2020-05-08 12:54 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 12:35 [PATCH 5.4 00/50] 5.4.40-rc1 review Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 01/50] vhost: vsock: kick send_pkt worker once device is started Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 02/50] drm/bridge: analogix_dp: Split bind() into probe() and real bind() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 03/50] ASoC: topology: Check return value of soc_tplg_create_tlv Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 04/50] ASoC: topology: Check return value of soc_tplg_*_create Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 05/50] ASoC: topology: Check soc_tplg_add_route return value Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 06/50] ASoC: topology: Check return value of pcm_new_ver Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 07/50] ASoC: topology: Check return value of soc_tplg_dai_config Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 08/50] selftests/ipc: Fix test failure seen after initial test run Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 09/50] ASoC: sgtl5000: Fix VAG power-on handling Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 10/50] ASoC: topology: Fix endianness issue Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 11/50] usb: dwc3: gadget: Properly set maxpacket limit Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 12/50] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 13/50] ASoC: rsnd: Fix HDMI channel mapping for " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 14/50] ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 15/50] remoteproc: qcom_q6v5_mss: fix a bug in q6v5_probe() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 16/50] drm/amdgpu: Correctly initialize thermal controller for GPUs with Powerplay table v0 (e.g Hawaii) Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 17/50] wimax/i2400m: Fix potential urb refcnt leak Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 18/50] net: stmmac: fix enabling socfpgas ptp_ref_clock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 19/50] net: stmmac: Fix sub-second increment Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 20/50] ASoC: rsnd: Dont treat master SSI in multi SSI setup as parent Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 21/50] ASoC: rsnd: Fix "status check failed" spam for multi-SSI Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 22/50] cifs: protect updating server->dstaddr with a spinlock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 23/50] scripts/config: allow colons in option strings for sed Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 24/50] cifs: do not share tcons with DFS Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 25/50] tracing: Fix memory leaks in trace_events_hist.c Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 26/50] lib/mpi: Fix building for powerpc with clang Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 27/50] mac80211: sta_info: Add lockdep condition for RCU list usage Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 28/50] net: bcmgenet: suppress warnings on failed Rx SKB allocations Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 29/50] net: systemport: " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 30/50] drm/i915: Extend WaDisableDARBFClkGating to icl,ehl,tgl Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 31/50] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 32/50] drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 33/50] Revert "software node: Simplify software_node_release() function" Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 34/50] lib: devres: add a helper function for ioremap_uc Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 35/50] mfd: intel-lpss: Use devm_ioremap_uc for MMIO Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 36/50] hexagon: clean up ioremap Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 37/50] hexagon: define ioremap_uc Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 38/50] ALSA: hda: Match both PCI ID and SSID for driver blacklist Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 39/50] x86/kvm: fix a missing-prototypes "vmread_error" Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 40/50] dma-direct: exclude dma_direct_map_resource from the min_low_pfn check Greg Kroah-Hartman
2020-05-08 13:20   ` Naresh Kamboju
2020-05-08 13:27     ` Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 41/50] platform/x86: GPD pocket fan: Fix error message when temp-limits are out of range Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 42/50] ACPI: PM: s2idle: Fix comment in acpi_s2idle_prepare_late() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 43/50] mac80211: add ieee80211_is_any_nullfunc() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 44/50] cgroup, netclassid: remove double cond_resched Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 45/50] libbpf: Fix readelf output parsing for Fedora Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 46/50] mm/mremap: Add comment explaining the untagging behaviour of mremap() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 47/50] Revert "drm/amd/display: setting the DIG_MODE to the correct value." Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 48/50] tools headers UAPI: Sync copy of arm64s asm/unistd.h with the kernel sources Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.4 49/50] udp: document udp_rcv_segment special case for looped packets Greg Kroah-Hartman
2020-05-08 12:35 ` Greg Kroah-Hartman [this message]
2020-05-08 13:22 ` [PATCH 5.4 00/50] 5.4.40-rc1 review Naresh Kamboju
2020-05-11 16:35 ` shuah
2020-05-11 17:21   ` Ben Hutchings
2020-05-11 17:49     ` shuah
2020-05-11 17:51     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508123049.823407886@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.