1. 01 6月, 2017 1 次提交
  2. 28 4月, 2017 1 次提交
    • K
      pstore: Solve lockdep warning by moving inode locks · 3a7d2fd1
      Kees Cook 提交于
      Lockdep complains about a possible deadlock between mount and unlink
      (which is technically impossible), but fixing this improves possible
      future multiple-backend support, and keeps locking in the right order.
      
      The lockdep warning could be triggered by unlinking a file in the
      pstore filesystem:
      
        -> #1 (&sb->s_type->i_mutex_key#14){++++++}:
               lock_acquire+0xc9/0x220
               down_write+0x3f/0x70
               pstore_mkfile+0x1f4/0x460
               pstore_get_records+0x17a/0x320
               pstore_fill_super+0xa4/0xc0
               mount_single+0x89/0xb0
               pstore_mount+0x13/0x20
               mount_fs+0xf/0x90
               vfs_kern_mount+0x66/0x170
               do_mount+0x190/0xd50
               SyS_mount+0x90/0xd0
               entry_SYSCALL_64_fastpath+0x1c/0xb1
      
        -> #0 (&psinfo->read_mutex){+.+.+.}:
               __lock_acquire+0x1ac0/0x1bb0
               lock_acquire+0xc9/0x220
               __mutex_lock+0x6e/0x990
               mutex_lock_nested+0x16/0x20
               pstore_unlink+0x3f/0xa0
               vfs_unlink+0xb5/0x190
               do_unlinkat+0x24c/0x2a0
               SyS_unlinkat+0x16/0x30
               entry_SYSCALL_64_fastpath+0x1c/0xb1
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&sb->s_type->i_mutex_key#14);
                                      lock(&psinfo->read_mutex);
                                      lock(&sb->s_type->i_mutex_key#14);
         lock(&psinfo->read_mutex);
      Reported-by: NMarta Lofstedt <marta.lofstedt@intel.com>
      Reported-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      3a7d2fd1
  3. 08 3月, 2017 1 次提交
  4. 16 11月, 2016 1 次提交
    • J
      pstore: Add ftrace timestamp counter · fbccdeb8
      Joel Fernandes 提交于
      In preparation for merging the per CPU buffers into one buffer when
      we retrieve the pstore ftrace data, we store the timestamp as a
      counter in the ftrace pstore record.  We store the CPU number as well
      if !PSTORE_CPU_IN_IP, in this case we shift the counter and may lose
      ordering there but we preserve the same record size. The timestamp counter
      is also racy, and not doing any locking or synchronization here results
      in the benefit of lower overhead. Since we don't care much here for exact
      ordering of function traces across CPUs, we don't synchronize and may lose
      some counter updates but I'm ok with that.
      
      Using trace_clock() results in much lower performance so avoid using it
      since we don't want accuracy in timestamp and need a rough ordering to
      perform merge.
      Signed-off-by: NJoel Fernandes <joelaf@google.com>
      [kees: updated commit message, added comments]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      fbccdeb8
  5. 23 10月, 2015 1 次提交
  6. 22 10月, 2015 1 次提交
  7. 17 1月, 2015 1 次提交
  8. 20 8月, 2013 1 次提交
  9. 27 11月, 2012 1 次提交
    • S
      efi_pstore: Add a sequence counter to a variable name · 755d4fe4
      Seiji Aguchi 提交于
      [Issue]
      
      Currently, a variable name, which identifies each entry, consists of type, id and ctime.
      But if multiple events happens in a short time, a second/third event may fail to log because
      efi_pstore can't distinguish each event with current variable name.
      
      [Solution]
      
      A reasonable way to identify all events precisely is introducing a sequence counter to
      the variable name.
      
      The sequence counter has already supported in a pstore layer with "oopscount".
      So, this patch adds it to a variable name.
      Also, it is passed to read/erase callbacks of platform drivers in accordance with
      the modification of the variable name.
      
        <before applying this patch>
       a variable name of first event: dump-type0-1-12345678
       a variable name of second event: dump-type0-1-12345678
      
        type:0
        id:1
        ctime:12345678
      
       If multiple events happen in a short time, efi_pstore can't distinguish them because
       variable names are same among them.
      
        <after applying this patch>
      
       it can be distinguishable by adding a sequence counter as follows.
      
       a variable name of first event: dump-type0-1-1-12345678
       a variable name of Second event: dump-type0-1-2-12345678
      
        type:0
        id:1
        sequence counter: 1(first event), 2(second event)
        ctime:12345678
      
      In case of a write callback executed in pstore_console_write(), "0" is added to
      an argument of the write callback because it just logs all kernel messages and
      doesn't need to care about multiple events.
      Signed-off-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NMike Waychison <mikew@google.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      755d4fe4
  10. 07 9月, 2012 1 次提交
    • A
      pstore/ftrace: Convert to its own enable/disable debugfs knob · 65f8c95e
      Anton Vorontsov 提交于
      With this patch we no longer reuse function tracer infrastructure, now
      we register our own tracer back-end via a debugfs knob.
      
      It's a bit more code, but that is the only downside. On the bright side we
      have:
      
      - Ability to make persistent_ram module removable (when needed, we can
        move ftrace_ops struct into a module). Note that persistent_ram is still
        not removable for other reasons, but with this patch it's just one
        thing less to worry about;
      
      - Pstore part is more isolated from the generic function tracer. We tried
        it already by registering our own tracer in available_tracers, but that
        way we're loosing ability to see the traces while we record them to
        pstore. This solution is somewhere in the middle: we only register
        "internal ftracer" back-end, but not the "front-end";
      
      - When there is only pstore tracing enabled, the kernel will only write
        to the pstore buffer, omitting function tracer buffer (which, of course,
        still can be enabled via 'echo function > current_tracer').
      Suggested-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      65f8c95e
  11. 18 7月, 2012 2 次提交
    • A
      pstore: Headers should include all stuff they use · 67a101f5
      Anton Vorontsov 提交于
      Headers should really include all the needed prototypes, types, defines
      etc. to be self-contained. This is a long-standing issue, but apparently
      the new tracing code unearthed it (SMP=n is also a prerequisite):
      
      In file included from fs/pstore/internal.h:4:0,
                       from fs/pstore/ftrace.c:21:
      include/linux/pstore.h:43:15: error: field ‘read_mutex’ has incomplete type
      
      While at it, I also added the following:
      
      linux/types.h -> size_t, phys_addr_t, uXX and friends
      linux/spinlock.h -> spinlock_t
      linux/errno.h -> Exxxx
      linux/time.h -> struct timespec (struct passed by value)
      struct module and rs_control forward declaration (passed via pointers).
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67a101f5
    • A
      pstore: Add persistent function tracing · 060287b8
      Anton Vorontsov 提交于
      With this support kernel can save function call chain log into a
      persistent ram buffer that can be decoded and dumped after reboot
      through pstore filesystem. It can be used to determine what function
      was last called before a reset or panic.
      
      We store the log in a binary format and then decode it at read time.
      
      p.s.
      Mostly the code comes from trace_persistent.c driver found in the
      Android git tree, written by Colin Cross <ccross@android.com>
      (according to sign-off history). I reworked the driver a little bit,
      and ported it to pstore.
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      060287b8
  12. 17 8月, 2011 1 次提交
    • L
      pstore: defer inserting OOPS entries into pstore · 6dda9266
      Luck, Tony 提交于
      Life is simple for all the kernel terminating types of kmsg_dump
      call backs - pstore just saves the tail end of the console log. But
      for "oops" the situation is more complex - the kernel may carry on
      running (possibly for ever).  So we'd like to make the logged copy
      of the oops appear in the pstore filesystem - so that the user has
      a handle to clear the entry from the persistent backing store (if
      we don't, the store may fill with "oops" entries (that are also
      safely stashed in /var/log/messages) leaving no space for real
      errors.
      
      Current code calls pstore_mkfile() immediately. But this may
      not be safe. The oops could have happened with arbitrary locks
      held, or in interrupt or NMI context. So allocating memory and
      calling into generic filesystem code seems unwise.
      
      This patch defers making the entry appear. At the time
      of the oops, we merely set a flag "pstore_new_entry" noting that
      a new entry has been added. A periodic timer checks once a minute
      to see if the flag is set - if so, it schedules a work queue to
      rescan the backing store and make all new entries appear in the
      pstore filesystem.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      6dda9266
  13. 23 7月, 2011 1 次提交
  14. 22 3月, 2011 1 次提交
  15. 29 12月, 2010 1 次提交
    • T
      pstore: new filesystem interface to platform persistent storage · ca01d6dd
      Tony Luck 提交于
      Some platforms have a small amount of non-volatile storage that
      can be used to store information useful to diagnose the cause of
      a system crash.  This is the generic part of a file system interface
      that presents information from the crash as a series of files in
      /dev/pstore.  Once the information has been seen, the underlying
      storage is freed by deleting the files.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      ca01d6dd