ANDROID: PCI/PM: Use usleep_range for d3hot_delay
This patch implements a vendor hook that changes d3hot_delay to use usleep_range() instead of msleep() to reduce the resume time from 20ms to 10ms. The call sequence is as follows: pci_pm_resume_noirq() pci_pm_default_resume_early() pci_power_up() pci_raw_set_power_state() --> msleep(10) The default d3hot_delay is 10ms. Using msleep for delays less than 20ms could result in delays up to 20ms. Reference: Documentation/timers/timers-howto.rst Using usleep_range() results in the delay being closer to 10ms and this reduces the resume time. Bug: 194231641 Change-Id: If3e4dcfb99edad302371273933fa6784854cf892 Signed-off-by: Sajid Dalvi <sdalvi@google.com>
This commit is contained in:
parent
045204b080
commit
bce9e7942a
@ -73,6 +73,7 @@
|
||||
#include <trace/hooks/sound.h>
|
||||
#include <trace/hooks/snd_compr.h>
|
||||
#include <trace/hooks/ipv4.h>
|
||||
#include <trace/hooks/pci.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@ -378,3 +379,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_sendmsg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_recvmsg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep);
|
||||
|
@ -31,6 +31,9 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/dma.h>
|
||||
#include <linux/aer.h>
|
||||
#ifndef __GENKSYMS__
|
||||
#include <trace/hooks/pci.h>
|
||||
#endif
|
||||
#include "pci.h"
|
||||
|
||||
DEFINE_MUTEX(pci_slot_mutex);
|
||||
@ -64,12 +67,16 @@ struct pci_pme_device {
|
||||
static void pci_dev_d3_sleep(struct pci_dev *dev)
|
||||
{
|
||||
unsigned int delay = dev->d3hot_delay;
|
||||
int err = -EOPNOTSUPP;
|
||||
|
||||
if (delay < pci_pm_d3hot_delay)
|
||||
delay = pci_pm_d3hot_delay;
|
||||
|
||||
if (delay)
|
||||
msleep(delay);
|
||||
if (delay) {
|
||||
trace_android_rvh_pci_d3_sleep(dev, delay, &err);
|
||||
if (err == -EOPNOTSUPP)
|
||||
msleep(delay);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI_DOMAINS
|
||||
|
22
include/trace/hooks/pci.h
Normal file
22
include/trace/hooks/pci.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM pci
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_PCI_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_PCI_H
|
||||
#include <linux/tracepoint.h>
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
/*
|
||||
* Following tracepoints are not exported in tracefs and provide a
|
||||
* mechanism for vendor modules to hook and extend functionality
|
||||
*/
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_pci_d3_sleep,
|
||||
TP_PROTO(struct pci_dev *dev, unsigned int delay, int *err),
|
||||
TP_ARGS(dev, delay, err), 1);
|
||||
|
||||
#endif /* _TRACE_HOOK_PCI_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
Loading…
Reference in New Issue
Block a user