--- /dev/null
+From 6980a00155e7e22b2dc449d1e41e618429febeb5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 11 Oct 2019 11:21:39 -0700
+Subject: perf script: Fix --reltime with --time
+
+From: Andi Kleen <ak@linux.intel.com>
+
+[ Upstream commit b3509b6ed7a79ec49f6b64e4f3b780f259a2a468 ]
+
+My earlier patch to just enable --reltime with --time was a little too
+optimistic. The --time parsing would accept absolute time, which is
+very confusing to the user.
+
+Support relative time in --time parsing too. This only works with recent
+perf record that records the first sample time. Otherwise we error out.
+
+Fixes: 3714437d3fcc ("perf script: Allow --time with --reltime")
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Link: http://lore.kernel.org/lkml/20191011182140.8353-1-andi@firstfloor.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/builtin-script.c | 5 +++--
+ tools/perf/util/time-utils.c | 27 ++++++++++++++++++++++++---
+ tools/perf/util/time-utils.h | 5 +++++
+ 3 files changed, 32 insertions(+), 5 deletions(-)
+
+diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
+index e9a2b4593d1d..da016f398aa8 100644
+--- a/tools/perf/builtin-script.c
++++ b/tools/perf/builtin-script.c
+@@ -3864,10 +3864,11 @@ int cmd_script(int argc, const char **argv)
+ goto out_delete;
+
+ if (script.time_str) {
+- err = perf_time__parse_for_ranges(script.time_str, session,
++ err = perf_time__parse_for_ranges_reltime(script.time_str, session,
+ &script.ptime_range,
+ &script.range_size,
+- &script.range_num);
++ &script.range_num,
++ reltime);
+ if (err < 0)
+ goto out_delete;
+
+diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
+index 9796a2e43f67..302443921681 100644
+--- a/tools/perf/util/time-utils.c
++++ b/tools/perf/util/time-utils.c
+@@ -458,10 +458,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
+ return true;
+ }
+
+-int perf_time__parse_for_ranges(const char *time_str,
++int perf_time__parse_for_ranges_reltime(const char *time_str,
+ struct perf_session *session,
+ struct perf_time_interval **ranges,
+- int *range_size, int *range_num)
++ int *range_size, int *range_num,
++ bool reltime)
+ {
+ bool has_percent = strchr(time_str, '%');
+ struct perf_time_interval *ptime_range;
+@@ -471,7 +472,7 @@ int perf_time__parse_for_ranges(const char *time_str,
+ if (!ptime_range)
+ return -ENOMEM;
+
+- if (has_percent) {
++ if (has_percent || reltime) {
+ if (session->evlist->first_sample_time == 0 &&
+ session->evlist->last_sample_time == 0) {
+ pr_err("HINT: no first/last sample time found in perf data.\n"
+@@ -479,7 +480,9 @@ int perf_time__parse_for_ranges(const char *time_str,
+ "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n");
+ goto error;
+ }
++ }
+
++ if (has_percent) {
+ num = perf_time__percent_parse_str(
+ ptime_range, size,
+ time_str,
+@@ -492,6 +495,15 @@ int perf_time__parse_for_ranges(const char *time_str,
+ if (num < 0)
+ goto error_invalid;
+
++ if (reltime) {
++ int i;
++
++ for (i = 0; i < num; i++) {
++ ptime_range[i].start += session->evlist->first_sample_time;
++ ptime_range[i].end += session->evlist->first_sample_time;
++ }
++ }
++
+ *range_size = size;
+ *range_num = num;
+ *ranges = ptime_range;
+@@ -504,6 +516,15 @@ int perf_time__parse_for_ranges(const char *time_str,
+ return ret;
+ }
+
++int perf_time__parse_for_ranges(const char *time_str,
++ struct perf_session *session,
++ struct perf_time_interval **ranges,
++ int *range_size, int *range_num)
++{
++ return perf_time__parse_for_ranges_reltime(time_str, session, ranges,
++ range_size, range_num, false);
++}
++
+ int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
+ {
+ u64 sec = timestamp / NSEC_PER_SEC;
+diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
+index 4f42988eb2f7..1142b0bddd5e 100644
+--- a/tools/perf/util/time-utils.h
++++ b/tools/perf/util/time-utils.h
+@@ -26,6 +26,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
+
+ struct perf_session;
+
++int perf_time__parse_for_ranges_reltime(const char *str, struct perf_session *session,
++ struct perf_time_interval **ranges,
++ int *range_size, int *range_num,
++ bool reltime);
++
+ int perf_time__parse_for_ranges(const char *str, struct perf_session *session,
+ struct perf_time_interval **ranges,
+ int *range_size, int *range_num);
+--
+2.20.1
+
--- /dev/null
+From f0c4087d2245820d0e27f8dd3a165b3e4e0e2b73 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Nov 2019 16:38:47 -0800
+Subject: scsi: lpfc: use hdwq assigned cpu for allocation
+
+From: James Smart <jsmart2021@gmail.com>
+
+[ Upstream commit 4583a4f66b323c6e4d774be2649e83a4e7c7b78c ]
+
+Looking at the recent conversion from smp_processor_id() to
+raw_smp_processor_id(), realized that the allocation should be based on the
+cpu the hdwq is bound to, not the executing cpu.
+
+Revise to pull cpu number from the hdwq
+
+Fixes: 765ab6cdac3b ("scsi: lpfc: Fix a kernel warning triggered by lpfc_get_sgl_per_hdwq()")
+Link: https://lore.kernel.org/r/20191116003847.6141-1-jsmart2021@gmail.com
+Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
+Signed-off-by: James Smart <jsmart2021@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/lpfc/lpfc_sli.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
+index 2d75be07cd6e..e2cec1f6e659 100644
+--- a/drivers/scsi/lpfc/lpfc_sli.c
++++ b/drivers/scsi/lpfc/lpfc_sli.c
+@@ -20430,7 +20430,7 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
+ /* allocate more */
+ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
+ tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC,
+- cpu_to_node(raw_smp_processor_id()));
++ cpu_to_node(hdwq->io_wq->chann));
+ if (!tmp) {
+ lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
+ "8353 error kmalloc memory for HDWQ "
+@@ -20573,7 +20573,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
+ /* allocate more */
+ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
+ tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC,
+- cpu_to_node(raw_smp_processor_id()));
++ cpu_to_node(hdwq->io_wq->chann));
+ if (!tmp) {
+ lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
+ "8355 error kmalloc memory for HDWQ "
+--
+2.20.1
+