~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/x86/kernel/cpu/perf_event_p4.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Netburst Perfomance Events (P4, old Xeon)
 
2
 * Netburst Performance Events (P4, old Xeon)
3
3
 *
4
4
 *  Copyright (C) 2010 Parallels, Inc., Cyrill Gorcunov <gorcunov@openvz.org>
5
5
 *  Copyright (C) 2010 Intel Corporation, Lin Ming <ming.m.lin@intel.com>
679
679
         */
680
680
 
681
681
        /*
682
 
         * if an event is shared accross the logical threads
 
682
         * if an event is shared across the logical threads
683
683
         * the user needs special permissions to be able to use it
684
684
         */
685
685
        if (p4_ht_active() && p4_event_bind_map[v].shared) {
764
764
        u64 v;
765
765
 
766
766
        /* an official way for overflow indication */
767
 
        rdmsrl(hwc->config_base + hwc->idx, v);
 
767
        rdmsrl(hwc->config_base, v);
768
768
        if (v & P4_CCCR_OVF) {
769
 
                wrmsrl(hwc->config_base + hwc->idx, v & ~P4_CCCR_OVF);
 
769
                wrmsrl(hwc->config_base, v & ~P4_CCCR_OVF);
770
770
                return 1;
771
771
        }
772
772
 
777
777
         * the counter has reached zero value and continued counting before
778
778
         * real NMI signal was received:
779
779
         */
 
780
        rdmsrl(hwc->event_base, v);
780
781
        if (!(v & ARCH_P4_UNFLAGGED_BIT))
781
782
                return 1;
782
783
 
790
791
         *
791
792
         * It's still allowed that two threads setup same cache
792
793
         * events so we can't simply clear metrics until we knew
793
 
         * noone is depending on us, so we need kind of counter
 
794
         * no one is depending on us, so we need kind of counter
794
795
         * for "ReplayEvent" users.
795
796
         *
796
797
         * What is more complex -- RAW events, if user (for some
797
798
         * reason) will pass some cache event metric with improper
798
799
         * event opcode -- it's fine from hardware point of view
799
 
         * but completely nonsence from "meaning" of such action.
 
800
         * but completely nonsense from "meaning" of such action.
800
801
         *
801
802
         * So at moment let leave metrics turned on forever -- it's
802
803
         * ok for now but need to be revisited!
815
816
         * state we need to clear P4_CCCR_OVF, otherwise interrupt get
816
817
         * asserted again and again
817
818
         */
818
 
        (void)checking_wrmsrl(hwc->config_base + hwc->idx,
 
819
        (void)checking_wrmsrl(hwc->config_base,
819
820
                (u64)(p4_config_unpack_cccr(hwc->config)) &
820
821
                        ~P4_CCCR_ENABLE & ~P4_CCCR_OVF & ~P4_CCCR_RESERVED);
821
822
}
885
886
        p4_pmu_enable_pebs(hwc->config);
886
887
 
887
888
        (void)checking_wrmsrl(escr_addr, escr_conf);
888
 
        (void)checking_wrmsrl(hwc->config_base + hwc->idx,
 
889
        (void)checking_wrmsrl(hwc->config_base,
889
890
                                (cccr & ~P4_CCCR_RESERVED) | P4_CCCR_ENABLE);
890
891
}
891
892
 
946
947
                if (!x86_perf_event_set_period(event))
947
948
                        continue;
948
949
                if (perf_event_overflow(event, 1, &data, regs))
949
 
                        p4_pmu_disable_event(event);
 
950
                        x86_pmu_stop(event, 0);
950
951
        }
951
952
 
952
 
        if (handled) {
953
 
                /* p4 quirk: unmask it again */
954
 
                apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
 
953
        if (handled)
955
954
                inc_irq_stat(apic_perf_irqs);
956
 
        }
 
955
 
 
956
        /*
 
957
         * When dealing with the unmasking of the LVTPC on P4 perf hw, it has
 
958
         * been observed that the OVF bit flag has to be cleared first _before_
 
959
         * the LVTPC can be unmasked.
 
960
         *
 
961
         * The reason is the NMI line will continue to be asserted while the OVF
 
962
         * bit is set.  This causes a second NMI to generate if the LVTPC is
 
963
         * unmasked before the OVF bit is cleared, leading to unknown NMI
 
964
         * messages.
 
965
         */
 
966
        apic_write(APIC_LVTPC, APIC_DM_NMI);
957
967
 
958
968
        return handled;
959
969
}