Unverified Commit 87cf1e37 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7159 【OLK 6.6】 backport some mailist patches for perf

Merge Pull Request from: @chen-hao418 
 
maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9OCI5
CVE: NA

Signed-off-by: Hao Chen <chenhao418@huawei.com> 
 
Link:https://gitee.com/openeuler/kernel/pulls/7159

 

Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 02389044 7809e953
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -350,15 +350,27 @@ static bool hisi_pcie_pmu_validate_event_group(struct perf_event *event)
			return false;

		for (num = 0; num < counters; num++) {
			/*
			 * If we find a related event, then it's a valid group
			 * since we don't need to allocate a new counter for it.
			 */
			if (hisi_pcie_pmu_cmp_event(event_group[num], sibling))
				break;
		}

		/*
		 * Otherwise it's a new event but if there's no available counter,
		 * fail the check since we cannot schedule all the events in
		 * the group simultaneously.
		 */
		if (num == HISI_PCIE_MAX_COUNTERS)
			return false;

		if (num == counters)
			event_group[counters++] = sibling;
	}

	return counters <= HISI_PCIE_MAX_COUNTERS;
	return true;
}

static int hisi_pcie_pmu_event_init(struct perf_event *event)
+14 −2
Original line number Diff line number Diff line
@@ -1085,15 +1085,27 @@ static bool hns3_pmu_validate_event_group(struct perf_event *event)
			return false;

		for (num = 0; num < counters; num++) {
			/*
			 * If we find a related event, then it's a valid group
			 * since we don't need to allocate a new counter for it.
			 */
			if (hns3_pmu_cmp_event(event_group[num], sibling))
				break;
		}

		/*
		 * Otherwise it's a new event but if there's no available counter,
		 * fail the check since we cannot schedule all the events in
		 * the group simultaneously.
		 */
		if (num == HNS3_PMU_MAX_HW_EVENTS)
			return false;

		if (num == counters)
			event_group[counters++] = sibling;
	}

	return counters <= HNS3_PMU_MAX_HW_EVENTS;
	return true;
}

static u32 hns3_pmu_get_filter_condition(struct perf_event *event)
@@ -1515,7 +1527,7 @@ static int hns3_pmu_irq_register(struct pci_dev *pdev,
		return ret;
	}

	ret = devm_add_action(&pdev->dev, hns3_pmu_free_irq, pdev);
	ret = devm_add_action_or_reset(&pdev->dev, hns3_pmu_free_irq, pdev);
	if (ret) {
		pci_err(pdev, "failed to add free irq action, ret = %d.\n", ret);
		return ret;