lkml.org 
[lkml]   [2015]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf: Fix multi-segment problem of perf_event_intel_uncore
On Thu, Jul 02, 2015 at 05:01:40AM +0900, Taku Izumi wrote:
> + raw_spin_lock(&pci2phy_map_lock);
> + list_for_each_entry(map, &pci2phy_map_head, list) {
> + if (map->segment == pci_domain_nr(pdev->bus)) {
> + phys_id = map->pbus_to_physid[pdev->bus->number];
> + break;
> + }
> + }
> + raw_spin_unlock(&pci2phy_map_lock);

> + raw_spin_lock(&pci2phy_map_lock);
> + list_for_each_entry(map, &pci2phy_map_head, list) {
> + if (map->segment == pci_domain_nr(pdev->bus)) {
> + phys_id = map->pbus_to_physid[pdev->bus->number];
> + break;
> + }
> + }
> + raw_spin_unlock(&pci2phy_map_lock);

> + raw_spin_lock(&pci2phy_map_lock);
> + list_for_each_entry(map, &pci2phy_map_head, list) {
> + if (map->segment == segment) {
> + found = true;
> + break;
> + }
> + }
> + if (!found) {
> + map = kmalloc(sizeof(struct pci2phy_map), GFP_KERNEL);
> + if (map) {
> + map->segment = segment;
> + map->pbus_to_physid[bus] = 0;
> + list_add_tail(&map->list, &pci2phy_map_head);
> + }
> + } else {
> + map->pbus_to_physid[bus] = 0;
> + }
> + raw_spin_unlock(&pci2phy_map_lock);

> + raw_spin_lock(&pci2phy_map_lock);
> + list_for_each_entry(map, &pci2phy_map_head, list) {
> + if (map->segment == segment) {
> + found = true;
> + break;
> + }
> + }
> + if (!found) {
> + map = kmalloc(sizeof(struct pci2phy_map), GFP_KERNEL);
> + if (!map) {
> + err = -ENOMEM;
> + break;
> + }
> + map->segment = segment;
> + list_add_tail(&map->list, &pci2phy_map_head);
> + }
> + raw_spin_unlock(&pci2phy_map_lock);

You'd think they invent something to avoid repetitions like that.. Oh
wait..


\
 
 \ /
  Last update: 2015-07-02 13:41    [W:2.169 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site