[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150702111718.GZ19282@twins.programming.kicks-ass.net>
Date: Thu, 2 Jul 2015 13:17:18 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Taku Izumi <izumi.taku@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org, mingo@...hat.com, acme@...nel.org,
kan.liang@...el.com, ak@...ux.intel.com, eranian@...gle.com
Subject: Re: [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..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists