Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 26 Jul 2010 15:10:00 +0000 (08:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 26 Jul 2010 15:10:00 +0000 (08:10 -0700)
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPI / Sleep: Allow the NVS saving to be skipped during suspend to RAM
  ACPI: create "processor.bm_check_disable" boot param
  ACPI: skip checking BM_STS if the BIOS doesn't ask for it
  ACPI: fix unused function warning
  ACPI: processor: fix processor_physically_present on UP
  ACPI video: fix string mismatch for Sony SR290 laptop
  ACPI battery: don't invoke power_supply_changed twice when battery is hot-added
  ACPI: handle systems which asynchoronously enable ACPI mode

18 files changed:
arch/arm/mach-omap2/board-rx51-peripherals.c
arch/powerpc/include/asm/kexec.h
arch/powerpc/include/asm/mmu-hash64.h
arch/powerpc/kernel/prom.c
arch/powerpc/mm/hash_low_64.S
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/hugetlbpage-hash64.c
arch/powerpc/mm/numa.c
arch/powerpc/platforms/pseries/hotplug-memory.c
drivers/base/core.c
drivers/virtio/virtio_ring.c
include/asm-generic/vmlinux.lds.h
scripts/kconfig/nconf.gui.c
scripts/package/Makefile
scripts/setlocalversion
tools/perf/Makefile
tools/perf/util/hist.c
tools/perf/util/symbol.c

index c5555ca13d00952f901e10268dc6d0d6ea5963c4..03483920ed6e0b12fa007c3438d3ea4401f8ec7f 100644 (file)
@@ -220,10 +220,10 @@ static int board_keymap[] = {
        KEY(4, 4, KEY_LEFTCTRL),
        KEY(4, 5, KEY_RIGHTALT),
        KEY(4, 6, KEY_LEFTSHIFT),
-       KEY(4, 8, KEY_10),
+       KEY(4, 8, KEY_F10),
 
        KEY(5, 0, KEY_Y),
-       KEY(5, 8, KEY_11),
+       KEY(5, 8, KEY_F11),
 
        KEY(6, 0, KEY_U),
 
index 2a9cd74a841e3e234b6d1a4bb6beb8e5cd1b207b..076327f2eff777b2cdbd4e15de8336ce7b03faa6 100644 (file)
@@ -8,9 +8,9 @@
  * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory
  * and therefore we can only deal with memory within this range
  */
-#define KEXEC_SOURCE_MEMORY_LIMIT      (2 * 1024 * 1024 * 1024UL)
-#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL)
-#define KEXEC_CONTROL_MEMORY_LIMIT     (2 * 1024 * 1024 * 1024UL)
+#define KEXEC_SOURCE_MEMORY_LIMIT      (2 * 1024 * 1024 * 1024UL - 1)
+#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
+#define KEXEC_CONTROL_MEMORY_LIMIT     (2 * 1024 * 1024 * 1024UL - 1)
 
 #else
 
index 2102b214a87c9ab49b7540962c2faef15251f55c..0e398cfee2c82826b6abad1eb8ece6330df6b0b4 100644 (file)
@@ -250,7 +250,9 @@ extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
 int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
                     pte_t *ptep, unsigned long trap, int local, int ssize,
                     unsigned int shift, unsigned int mmu_psize);
-
+extern void hash_failure_debug(unsigned long ea, unsigned long access,
+                              unsigned long vsid, unsigned long trap,
+                              int ssize, int psize, unsigned long pte);
 extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
                             unsigned long pstart, unsigned long prot,
                             int psize, int ssize);
index 9d3953983fb74759a2ab2bfbb2a5f7dd316e62ca..fed9bf6187d1a514e88677b144c5ad1273be8505 100644 (file)
@@ -414,7 +414,7 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
        u64 base, size, memblock_size;
        unsigned int is_kexec_kdump = 0, rngs;
 
-       ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l);
+       ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
        if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
                return 0;
        memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
index a719f53921a57c390503b708c38cb4e1146a176b..3079f6b44cf531e5f1dafc8fa9e9a9e38e59dc15 100644 (file)
@@ -68,9 +68,6 @@ _GLOBAL(__hash_page_4K)
        std     r8,STK_PARM(r8)(r1)
        std     r9,STK_PARM(r9)(r1)
        
-       /* Add _PAGE_PRESENT to access */
-       ori     r4,r4,_PAGE_PRESENT
-
        /* Save non-volatile registers.
         * r31 will hold "old PTE"
         * r30 is "new PTE"
@@ -347,9 +344,6 @@ _GLOBAL(__hash_page_4K)
        std     r8,STK_PARM(r8)(r1)
        std     r9,STK_PARM(r9)(r1)
 
-       /* Add _PAGE_PRESENT to access */
-       ori     r4,r4,_PAGE_PRESENT
-
        /* Save non-volatile registers.
         * r31 will hold "old PTE"
         * r30 is "new PTE"
@@ -687,9 +681,6 @@ _GLOBAL(__hash_page_64K)
        std     r8,STK_PARM(r8)(r1)
        std     r9,STK_PARM(r9)(r1)
 
-       /* Add _PAGE_PRESENT to access */
-       ori     r4,r4,_PAGE_PRESENT
-
        /* Save non-volatile registers.
         * r31 will hold "old PTE"
         * r30 is "new PTE"
index 98f262de558526899fa5c58fe6802654bb0a5833..09dffe6efa46aeae84d62a922215f87fe0a8ca2d 100644 (file)
@@ -871,6 +871,18 @@ static inline int subpage_protection(struct mm_struct *mm, unsigned long ea)
 }
 #endif
 
+void hash_failure_debug(unsigned long ea, unsigned long access,
+                       unsigned long vsid, unsigned long trap,
+                       int ssize, int psize, unsigned long pte)
+{
+       if (!printk_ratelimit())
+               return;
+       pr_info("mm: Hashing failure ! EA=0x%lx access=0x%lx current=%s\n",
+               ea, access, current->comm);
+       pr_info("    trap=0x%lx vsid=0x%lx ssize=%d psize=%d pte=0x%lx\n",
+               trap, vsid, ssize, psize, pte);
+}
+
 /* Result code is:
  *  0 - handled
  *  1 - normal page fault
@@ -955,6 +967,17 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
                return 1;
        }
 
+       /* Add _PAGE_PRESENT to the required access perm */
+       access |= _PAGE_PRESENT;
+
+       /* Pre-check access permissions (will be re-checked atomically
+        * in __hash_page_XX but this pre-check is a fast path
+        */
+       if (access & ~pte_val(*ptep)) {
+               DBG_LOW(" no access !\n");
+               return 1;
+       }
+
 #ifdef CONFIG_HUGETLB_PAGE
        if (hugeshift)
                return __hash_page_huge(ea, access, vsid, ptep, trap, local,
@@ -967,14 +990,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
        DBG_LOW(" i-pte: %016lx %016lx\n", pte_val(*ptep),
                pte_val(*(ptep + PTRS_PER_PTE)));
 #endif
-       /* Pre-check access permissions (will be re-checked atomically
-        * in __hash_page_XX but this pre-check is a fast path
-        */
-       if (access & ~pte_val(*ptep)) {
-               DBG_LOW(" no access !\n");
-               return 1;
-       }
-
        /* Do actual hashing */
 #ifdef CONFIG_PPC_64K_PAGES
        /* If _PAGE_4K_PFN is set, make sure this is a 4k segment */
@@ -1033,6 +1048,12 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
                                            local, ssize, spp);
        }
 
+       /* Dump some info in case of hash insertion failure, they should
+        * never happen so it is really useful to know if/when they do
+        */
+       if (rc == -1)
+               hash_failure_debug(ea, access, vsid, trap, ssize, psize,
+                                  pte_val(*ptep));
 #ifndef CONFIG_PPC_64K_PAGES
        DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep));
 #else
@@ -1051,8 +1072,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
        void *pgdir;
        pte_t *ptep;
        unsigned long flags;
-       int local = 0;
-       int ssize;
+       int rc, ssize, local = 0;
 
        BUG_ON(REGION_ID(ea) != USER_REGION_ID);
 
@@ -1098,11 +1118,18 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
        /* Hash it in */
 #ifdef CONFIG_PPC_HAS_HASH_64K
        if (mm->context.user_psize == MMU_PAGE_64K)
-               __hash_page_64K(ea, access, vsid, ptep, trap, local, ssize);
+               rc = __hash_page_64K(ea, access, vsid, ptep, trap, local, ssize);
        else
 #endif /* CONFIG_PPC_HAS_HASH_64K */
-               __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize,
-                              subpage_protection(pgdir, ea));
+               rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize,
+                                   subpage_protection(pgdir, ea));
+
+       /* Dump some info in case of hash insertion failure, they should
+        * never happen so it is really useful to know if/when they do
+        */
+       if (rc == -1)
+               hash_failure_debug(ea, access, vsid, trap, ssize,
+                                  mm->context.user_psize, pte_val(*ptep));
 
        local_irq_restore(flags);
 }
index 199539882f927620d6a435b92241e1f08f9aa4a1..cc5c273086cf833e28bc89a91bb814b09c16a4e4 100644 (file)
@@ -21,21 +21,13 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
        unsigned long old_pte, new_pte;
        unsigned long va, rflags, pa, sz;
        long slot;
-       int err = 1;
 
        BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
 
        /* Search the Linux page table for a match with va */
        va = hpt_va(ea, vsid, ssize);
 
-       /*
-        * Check the user's access rights to the page.  If access should be
-        * prevented then send the problem up to do_page_fault.
-        */
-       if (unlikely(access & ~pte_val(*ptep)))
-               goto out;
-       /*
-        * At this point, we have a pte (old_pte) which can be used to build
+       /* At this point, we have a pte (old_pte) which can be used to build
         * or update an HPTE. There are 2 cases:
         *
         * 1. There is a valid (present) pte with no associated HPTE (this is
@@ -49,9 +41,17 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
 
        do {
                old_pte = pte_val(*ptep);
-               if (old_pte & _PAGE_BUSY)
-                       goto out;
+               /* If PTE busy, retry the access */
+               if (unlikely(old_pte & _PAGE_BUSY))
+                       return 0;
+               /* If PTE permissions don't match, take page fault */
+               if (unlikely(access & ~old_pte))
+                       return 1;
+               /* Try to lock the PTE, add ACCESSED and DIRTY if it was
+                * a write access */
                new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
+               if (access & _PAGE_RW)
+                       new_pte |= _PAGE_DIRTY;
        } while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
                                         old_pte, new_pte));
 
@@ -121,8 +121,16 @@ repeat:
                         }
                }
 
-               if (unlikely(slot == -2))
-                       panic("hash_huge_page: pte_insert failed\n");
+               /*
+                * Hypervisor failure. Restore old pte and return -1
+                * similar to __hash_page_*
+                */
+               if (unlikely(slot == -2)) {
+                       *ptep = __pte(old_pte);
+                       hash_failure_debug(ea, access, vsid, trap, ssize,
+                                          mmu_psize, old_pte);
+                       return -1;
+               }
 
                new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
        }
@@ -131,9 +139,5 @@ repeat:
         * No need to use ldarx/stdcx here
         */
        *ptep = __pte(new_pte & ~_PAGE_BUSY);
-
-       err = 0;
-
- out:
-       return err;
+       return 0;
 }
index f47364585ecd0bce3df61a5397fa3f9d0ccf7feb..aa731af720c04e4816f0e9826d7f05109631bccb 100644 (file)
@@ -398,15 +398,15 @@ static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
 }
 
 /*
- * Retreive and validate the ibm,memblock-size property for drconf memory
+ * Retreive and validate the ibm,lmb-size property for drconf memory
  * from the device tree.
  */
-static u64 of_get_memblock_size(struct device_node *memory)
+static u64 of_get_lmb_size(struct device_node *memory)
 {
        const u32 *prop;
        u32 len;
 
-       prop = of_get_property(memory, "ibm,memblock-size", &len);
+       prop = of_get_property(memory, "ibm,lmb-size", &len);
        if (!prop || len < sizeof(unsigned int))
                return 0;
 
@@ -562,7 +562,7 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
 static inline int __init read_usm_ranges(const u32 **usm)
 {
        /*
-        * For each memblock in ibm,dynamic-memory a corresponding
+        * For each lmb in ibm,dynamic-memory a corresponding
         * entry in linux,drconf-usable-memory property contains
         * a counter followed by that many (base, size) duple.
         * read the counter from linux,drconf-usable-memory
@@ -578,7 +578,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
 {
        const u32 *dm, *usm;
        unsigned int n, rc, ranges, is_kexec_kdump = 0;
-       unsigned long memblock_size, base, size, sz;
+       unsigned long lmb_size, base, size, sz;
        int nid;
        struct assoc_arrays aa;
 
@@ -586,8 +586,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
        if (!n)
                return;
 
-       memblock_size = of_get_memblock_size(memory);
-       if (!memblock_size)
+       lmb_size = of_get_lmb_size(memory);
+       if (!lmb_size)
                return;
 
        rc = of_get_assoc_arrays(memory, &aa);
@@ -611,7 +611,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
                        continue;
 
                base = drmem.base_addr;
-               size = memblock_size;
+               size = lmb_size;
                ranges = 1;
 
                if (is_kexec_kdump) {
@@ -1072,7 +1072,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
 {
        const u32 *dm;
        unsigned int drconf_cell_cnt, rc;
-       unsigned long memblock_size;
+       unsigned long lmb_size;
        struct assoc_arrays aa;
        int nid = -1;
 
@@ -1080,8 +1080,8 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
        if (!drconf_cell_cnt)
                return -1;
 
-       memblock_size = of_get_memblock_size(memory);
-       if (!memblock_size)
+       lmb_size = of_get_lmb_size(memory);
+       if (!lmb_size)
                return -1;
 
        rc = of_get_assoc_arrays(memory, &aa);
@@ -1100,7 +1100,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
                        continue;
 
                if ((scn_addr < drmem.base_addr)
-                   || (scn_addr >= (drmem.base_addr + memblock_size)))
+                   || (scn_addr >= (drmem.base_addr + lmb_size)))
                        continue;
 
                nid = of_drconf_to_nid_single(&drmem, &aa);
index deab5f9460907891a3134a1d7f6bcdb459796dcf..bc88036641406bf283aa96f8c3b4609a3ecef85a 100644 (file)
@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np)
        const char *type;
        const unsigned int *regs;
        unsigned long base;
-       unsigned int memblock_size;
+       unsigned int lmb_size;
        int ret = -EINVAL;
 
        /*
@@ -87,9 +87,9 @@ static int pseries_remove_memory(struct device_node *np)
                return ret;
 
        base = *(unsigned long *)regs;
-       memblock_size = regs[3];
+       lmb_size = regs[3];
 
-       ret = pseries_remove_memblock(base, memblock_size);
+       ret = pseries_remove_memblock(base, lmb_size);
        return ret;
 }
 
@@ -98,7 +98,7 @@ static int pseries_add_memory(struct device_node *np)
        const char *type;
        const unsigned int *regs;
        unsigned long base;
-       unsigned int memblock_size;
+       unsigned int lmb_size;
        int ret = -EINVAL;
 
        /*
@@ -116,36 +116,36 @@ static int pseries_add_memory(struct device_node *np)
                return ret;
 
        base = *(unsigned long *)regs;
-       memblock_size = regs[3];
+       lmb_size = regs[3];
 
        /*
         * Update memory region to represent the memory add
         */
-       ret = memblock_add(base, memblock_size);
+       ret = memblock_add(base, lmb_size);
        return (ret < 0) ? -EINVAL : 0;
 }
 
 static int pseries_drconf_memory(unsigned long *base, unsigned int action)
 {
        struct device_node *np;
-       const unsigned long *memblock_size;
+       const unsigned long *lmb_size;
        int rc;
 
        np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
        if (!np)
                return -EINVAL;
 
-       memblock_size = of_get_property(np, "ibm,memblock-size", NULL);
-       if (!memblock_size) {
+       lmb_size = of_get_property(np, "ibm,lmb-size", NULL);
+       if (!lmb_size) {
                of_node_put(np);
                return -EINVAL;
        }
 
        if (action == PSERIES_DRCONF_MEM_ADD) {
-               rc = memblock_add(*base, *memblock_size);
+               rc = memblock_add(*base, *lmb_size);
                rc = (rc < 0) ? -EINVAL : 0;
        } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
-               rc = pseries_remove_memblock(*base, *memblock_size);
+               rc = pseries_remove_memblock(*base, *lmb_size);
        } else {
                rc = -EINVAL;
        }
index 9630fbdf4e6c210eb09a92f4489bb55f60e3b3a7..9b9d3bd54e3a5359f8f0aa3e833ab5380ea11a47 100644 (file)
@@ -673,7 +673,7 @@ static struct kobject *get_device_parent(struct device *dev,
                 */
                if (parent == NULL)
                        parent_kobj = virtual_device_parent(dev);
-               else if (parent->class)
+               else if (parent->class && !dev->class->ns_type)
                        return &parent->kobj;
                else
                        parent_kobj = &parent->kobj;
index afe7e21dd0ae8a7dce4db7ee1a480ce931c42247..1475ed6b575fd7a9984380b9e0841ac5f019a306 100644 (file)
@@ -164,7 +164,8 @@ int virtqueue_add_buf_gfp(struct virtqueue *_vq,
                          gfp_t gfp)
 {
        struct vring_virtqueue *vq = to_vvq(_vq);
-       unsigned int i, avail, head, uninitialized_var(prev);
+       unsigned int i, avail, uninitialized_var(prev);
+       int head;
 
        START_USE(vq);
 
@@ -174,7 +175,7 @@ int virtqueue_add_buf_gfp(struct virtqueue *_vq,
         * buffers, then go indirect. FIXME: tune this threshold */
        if (vq->indirect && (out + in) > 1 && vq->num_free) {
                head = vring_add_indirect(vq, sg, out, in, gfp);
-               if (head != vq->vring.num)
+               if (likely(head >= 0))
                        goto add_head;
        }
 
index 48c5299cbf26e796e3188f397faa96cd3889a112..030a954ed292a59feae0bbf8437f370127b22bd6 100644 (file)
 /* Align . to a 8 byte boundary equals to maximum function alignment. */
 #define ALIGN_FUNCTION()  . = ALIGN(8)
 
+/*
+ * Align to a 32 byte boundary equal to the
+ * alignment gcc 4.5 uses for a struct
+ */
+#define STRUCT_ALIGN() . = ALIGN(32)
+
 /* The actual configuration determine if the init/exit sections
  * are handled as text/data or they can be discarded (which
  * often happens at runtime)
        LIKELY_PROFILE()                                                \
        BRANCH_PROFILE()                                                \
        TRACE_PRINTKS()                                                 \
+                                                                       \
+       STRUCT_ALIGN();                                                 \
        FTRACE_EVENTS()                                                 \
+                                                                       \
+       STRUCT_ALIGN();                                                 \
        TRACE_SYSCALLS()
 
 /*
  */
 #define INIT_TASK_DATA_SECTION(align)                                  \
        . = ALIGN(align);                                               \
-       .data..init_task : {                                            \
+       .data..init_task :  AT(ADDR(.data..init_task) - LOAD_OFFSET) {  \
                INIT_TASK_DATA(align)                                   \
        }
 
index 115edb437fb1eafaf30101e747b2a97a2e23a5b2..a9d9344e136504781c52b0e59361fea6b10be06b 100644 (file)
@@ -226,7 +226,7 @@ void fill_window(WINDOW *win, const char *text)
                int len = get_line_length(line);
                strncpy(tmp, line, min(len, x));
                tmp[len] = '\0';
-               mvwprintw(win, i, 0, tmp);
+               mvwprintw(win, i, 0, "%s", tmp);
        }
 }
 
index 3a681ef25306ba0a98cfaedf7412c24c9af11adb..d2c29b63addaa04dbd3df94d1adbfa9bc3ff8518 100644 (file)
@@ -44,7 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
        fi
        $(MAKE) clean
        $(PREV) ln -sf $(srctree) $(KERNELPATH)
-       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --scm-only > $(objtree)/.scmversion
+       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
        $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
        $(PREV) rm $(KERNELPATH)
        rm -f $(objtree)/.scmversion
index d6a866ed1835c8f1ee4524c6bb26df554c83c6e1..64a9cb5556cd0f90dab503c6b8cd96e2fa7bff1d 100755 (executable)
 #
 
 usage() {
-       echo "Usage: $0 [--scm-only] [srctree]" >&2
+       echo "Usage: $0 [--save-scmversion] [srctree]" >&2
        exit 1
 }
 
 scm_only=false
 srctree=.
-if test "$1" = "--scm-only"; then
+if test "$1" = "--save-scmversion"; then
        scm_only=true
        shift
 fi
@@ -30,11 +30,12 @@ fi
 
 scm_version()
 {
-       local short=false
+       local short
+       short=false
 
        cd "$srctree"
        if test -e .scmversion; then
-               cat "$_"
+               cat .scmversion
                return
        fi
        if test "$1" = "--short"; then
@@ -131,12 +132,15 @@ collect_files()
 }
 
 if $scm_only; then
-       scm_version
+       if test ! -e .scmversion; then
+               res=$(scm_version)
+               echo "$res" >.scmversion
+       fi
        exit
 fi
 
 if test -e include/config/auto.conf; then
-       source "$_"
+       . include/config/auto.conf
 else
        echo "Error: kernelrelease not valid - run 'make prepare' to update it"
        exit 1
index 3d8f31ed771df18770b1e31361485d39400b5476..d75c28a825f5356d9b0dbe16459111d3b6c5e81a 100644 (file)
@@ -600,30 +600,32 @@ endif
 
 ifdef NO_DEMANGLE
        BASIC_CFLAGS += -DNO_DEMANGLE
-else ifdef HAVE_CPLUS_DEMANGLE
-       EXTLIBS += -liberty
-       BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
 else
-       has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
-
-       ifeq ($(has_bfd),y)
-               EXTLIBS += -lbfd
+       ifdef HAVE_CPLUS_DEMANGLE
+               EXTLIBS += -liberty
+               BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
        else
-               has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
-               ifeq ($(has_bfd_iberty),y)
-                       EXTLIBS += -lbfd -liberty
+               has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
+
+               ifeq ($(has_bfd),y)
+                       EXTLIBS += -lbfd
                else
-                       has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
-                       ifeq ($(has_bfd_iberty_z),y)
-                               EXTLIBS += -lbfd -liberty -lz
+                       has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
+                       ifeq ($(has_bfd_iberty),y)
+                               EXTLIBS += -lbfd -liberty
                        else
-                               has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
-                               ifeq ($(has_cplus_demangle),y)
-                                       EXTLIBS += -liberty
-                                       BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+                               has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
+                               ifeq ($(has_bfd_iberty_z),y)
+                                       EXTLIBS += -lbfd -liberty -lz
                                else
-                                       msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
-                                       BASIC_CFLAGS += -DNO_DEMANGLE
+                                       has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
+                                       ifeq ($(has_cplus_demangle),y)
+                                               EXTLIBS += -liberty
+                                               BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+                                       else
+                                               msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+                                               BASIC_CFLAGS += -DNO_DEMANGLE
+                                       endif
                                endif
                        endif
                endif
index 07f89b66b318e43748f666f495f87b75f6a34462..784ee0bdda7754f329428e40fa790a22dd331568 100644 (file)
@@ -631,9 +631,14 @@ int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
                        u64 session_total)
 {
        char bf[512];
-       hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
-                            show_displacement, displacement,
-                            true, session_total);
+       int ret;
+
+       ret = hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
+                                  show_displacement, displacement,
+                                  true, session_total);
+       if (!ret)
+               return 0;
+
        return fprintf(fp, "%s\n", bf);
 }
 
@@ -762,6 +767,7 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 print_entries:
        for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
                struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+               int cnt;
 
                if (show_displacement) {
                        if (h->pair != NULL)
@@ -771,8 +777,13 @@ print_entries:
                                displacement = 0;
                        ++position;
                }
-               ret += hist_entry__fprintf(h, pair, show_displacement,
-                                          displacement, fp, self->stats.total_period);
+               cnt = hist_entry__fprintf(h, pair, show_displacement,
+                                         displacement, fp, self->stats.total_period);
+               /* Ignore those that didn't match the parent filter */
+               if (!cnt)
+                       continue;
+
+               ret += cnt;
 
                if (symbol_conf.use_callchain)
                        ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period);
@@ -965,13 +976,17 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
                 * Parse hexa addresses followed by ':'
                 */
                line_ip = strtoull(tmp, &tmp2, 16);
-               if (*tmp2 != ':' || tmp == tmp2)
+               if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0')
                        line_ip = -1;
        }
 
        if (line_ip != -1) {
-               u64 start = map__rip_2objdump(self->ms.map, sym->start);
+               u64 start = map__rip_2objdump(self->ms.map, sym->start),
+                   end = map__rip_2objdump(self->ms.map, sym->end);
+
                offset = line_ip - start;
+               if (offset < 0 || (u64)line_ip > end)
+                       offset = -1;
        }
 
        objdump_line = objdump_line__new(offset, line);
index b63e5713849f3abfa25bf8160e8b458e7adf913e..5b276833e2bfea3bae9115f2555b32e3a3b8b628 100644 (file)
@@ -1443,6 +1443,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
 {
        struct dirent *dent;
        DIR *dir = opendir(dir_name);
+       int ret = 0;
 
        if (!dir) {
                pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
@@ -1465,8 +1466,9 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
 
                        snprintf(path, sizeof(path), "%s/%s",
                                 dir_name, dent->d_name);
-                       if (map_groups__set_modules_path_dir(self, path) < 0)
-                               goto failure;
+                       ret = map_groups__set_modules_path_dir(self, path);
+                       if (ret < 0)
+                               goto out;
                } else {
                        char *dot = strrchr(dent->d_name, '.'),
                             dso_name[PATH_MAX];
@@ -1487,17 +1489,18 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
                                 dir_name, dent->d_name);
 
                        long_name = strdup(path);
-                       if (long_name == NULL)
-                               goto failure;
+                       if (long_name == NULL) {
+                               ret = -1;
+                               goto out;
+                       }
                        dso__set_long_name(map->dso, long_name);
                        dso__kernel_module_get_build_id(map->dso, "");
                }
        }
 
-       return 0;
-failure:
+out:
        closedir(dir);
-       return -1;
+       return ret;
 }
 
 static char *get_kernel_version(const char *root_dir)
This page took 0.041114 seconds and 5 git commands to generate.