1. 02 9月, 2017 1 次提交
  2. 01 9月, 2017 6 次提交
    • J
      include/linux/compiler.h: don't perform compiletime_assert with -O0 · c03567a8
      Joe Stringer 提交于
      Commit c7acec71 ("kernel.h: handle pointers to arrays better in
      container_of()") made use of __compiletime_assert() from container_of()
      thus increasing the usage of this macro, allowing developers to notice
      type conflicts in usage of container_of() at compile time.
      
      However, the implementation of __compiletime_assert relies on compiler
      optimizations to report an error.  This means that if a developer uses
      "-O0" with any code that performs container_of(), the compiler will always
      report an error regardless of whether there is an actual problem in the
      code.
      
      This patch disables compile_time_assert when optimizations are disabled to
      allow such code to compile with CFLAGS="-O0".
      
      Example compilation failure:
      
      ./include/linux/compiler.h:547:38: error: call to `__compiletime_assert_94' declared with attribute error: pointer type mismatch in container_of()
        _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                            ^
      ./include/linux/compiler.h:530:4: note: in definition of macro `__compiletime_assert'
          prefix ## suffix();    \
          ^~~~~~
      ./include/linux/compiler.h:547:2: note: in expansion of macro `_compiletime_assert'
        _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
        ^~~~~~~~~~~~~~~~~~~
      ./include/linux/build_bug.h:46:37: note: in expansion of macro `compiletime_assert'
       #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                           ^~~~~~~~~~~~~~~~~~
      ./include/linux/kernel.h:860:2: note: in expansion of macro `BUILD_BUG_ON_MSG'
        BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
        ^~~~~~~~~~~~~~~~
      
      [akpm@linux-foundation.org: use do{}while(0), per Michal]
      Link: http://lkml.kernel.org/r/20170829230114.11662-1-joe@ovn.org
      Fixes: c7acec71 ("kernel.h: handle pointers to arrays better in container_of()")
      Signed-off-by: NJoe Stringer <joe@ovn.org>
      Cc: Ian Abbott <abbotti@mev.co.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c03567a8
    • J
      mm/mmu_notifier: kill invalidate_page · 5f32b265
      Jérôme Glisse 提交于
      The invalidate_page callback suffered from two pitfalls.  First it used
      to happen after the page table lock was release and thus a new page
      might have setup before the call to invalidate_page() happened.
      
      This is in a weird way fixed by commit c7ab0d2f ("mm: convert
      try_to_unmap_one() to use page_vma_mapped_walk()") that moved the
      callback under the page table lock but this also broke several existing
      users of the mmu_notifier API that assumed they could sleep inside this
      callback.
      
      The second pitfall was invalidate_page() being the only callback not
      taking a range of address in respect to invalidation but was giving an
      address and a page.  Lots of the callback implementers assumed this
      could never be THP and thus failed to invalidate the appropriate range
      for THP.
      
      By killing this callback we unify the mmu_notifier callback API to
      always take a virtual address range as input.
      
      Finally this also simplifies the end user life as there is now two clear
      choices:
        - invalidate_range_start()/end() callback (which allow you to sleep)
        - invalidate_range() where you can not sleep but happen right after
          page table update under page table lock
      Signed-off-by: NJérôme Glisse <jglisse@redhat.com>
      Cc: Bernhard Held <berny156@gmx.de>
      Cc: Adam Borowski <kilobyte@angband.pl>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Wanpeng Li <kernellwp@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: axie <axie@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5f32b265
    • J
      dax: update to new mmu_notifier semantic · a4d1a885
      Jérôme Glisse 提交于
      Replace all mmu_notifier_invalidate_page() calls by *_invalidate_range()
      and make sure it is bracketed by calls to *_invalidate_range_start()/end().
      
      Note that because we can not presume the pmd value or pte value we have
      to assume the worst and unconditionaly report an invalidation as
      happening.
      Signed-off-by: NJérôme Glisse <jglisse@redhat.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Bernhard Held <berny156@gmx.de>
      Cc: Adam Borowski <kilobyte@angband.pl>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Wanpeng Li <kernellwp@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: axie <axie@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a4d1a885
    • B
      <linux/uaccess.h>: Fix copy_in_user() declaration · f58e76c1
      Bart Van Assche 提交于
      copy_in_user() copies data from user-space address @from to user-
      space address @to. Hence declare both @from and @to as user-space
      pointers.
      
      Fixes: commit d597580d ("generic ...copy_..._user primitives")
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      f58e76c1
    • C
      annotate RWF_... flags · ddef7ed2
      Christoph Hellwig 提交于
      [AV: added missing annotations in syscalls.h/compat.h]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ddef7ed2
    • A
  3. 31 8月, 2017 25 次提交
    • J
      genalloc: Fix an incorrect kerneldoc comment · a27bfcab
      Jonathan Corbet 提交于
      The kerneldoc comment for the genpool_algo_t typedef was incomplete and
      incorrectly formatted, leading to a raft of warnings during the docs build.
      Fix it appropriately.
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      a27bfcab
    • M
      irqchip/gic-v3: Advertise GICv4 support to KVM · 4bdf5025
      Marc Zyngier 提交于
      As KVM needs to know about the availability of GICv4 to enable
      direct injection of interrupts, let's advertise the feature in
      the gic_kvm_info structure.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      4bdf5025
    • M
      irqchip/gic-v4: Enable low-level GICv4 operations · 3d63cb53
      Marc Zyngier 提交于
      Get the show on the road...
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      3d63cb53
    • M
      irqchip/gic-v4: Add VLPI configuration interface · f2eac75d
      Marc Zyngier 提交于
      Add the required interfaces to map, unmap and update a VLPI.
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      f2eac75d
    • M
      irqchip/gic-v4: Add VPE command interface · eab84318
      Marc Zyngier 提交于
      Add the required interfaces to schedule a VPE and perform a
      VINVALL command.
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      eab84318
    • M
      irqchip/gic-v4: Add per-VM VPE domain creation · 7de5c0af
      Marc Zyngier 提交于
      When creating a VM, it is very convenient to have an irq domain
      containing all the doorbell interrupts associated with that VM
      (each interrupt representing a VPE).
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      7de5c0af
    • M
      irqchip/gic-v3-its: Set implementation defined bit to enable VLPIs · d51c4b4d
      Marc Zyngier 提交于
      A long time ago, GITS_CTLR[1] used to be called GITC_CTLR.EnableVLPI.
      It has been subsequently deprecated and is now an "Implementation
      Defined" bit that may ot may not be set for GICv4. Brilliant.
      
      And the current crop of the FastModel requires that bit for VLPIs
      to be enabled. Oh well... Let's set it and find out what breaks.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      d51c4b4d
    • M
      irqchip/gic-v3-its: Add device proxy for VPE management if !DirectLpi · 20b3d54e
      Marc Zyngier 提交于
      When we don't have the DirectLPI feature, we must work around the
      architecture shortcomings to be able to perform the required
      maintenance (interrupt masking, clearing and injection).
      
      For this, we create a fake device whose sole purpose is to
      provide a way to issue commands as if we were dealing with LPIs
      coming from that device (while they actually originate from
      the ITS). This fake device doesn't have LPIs allocated to it,
      but instead uses the VPE LPIs.
      
      Of course, this could be a real bottleneck, and a naive
      implementation would require 6 commands to issue an invalidation.
      
      Instead, let's allocate at least one event per physical CPU
      (rounded up to the next power of 2), and opportunistically
      map the VPE doorbell to an event. This doorbell will be mapped
      until we roll over and need to reallocate this slot.
      
      This ensures that most of the time, we only need 2 commands
      to issue an INV, INT or CLEAR, making the performance a lot
      better, given that we always issue a CLEAR on entry, and
      an INV on each side of a trapped WFI.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      20b3d54e
    • M
      irqchip/gic-v3-its: Add VPE scheduling · e643d803
      Marc Zyngier 提交于
      When a VPE is scheduled to run, the corresponding redistributor must
      be told so, by setting VPROPBASER to the VM's property table, and
      VPENDBASER to the vcpu's pending table.
      
      When scheduled out, we preserve the IDAI and PendingLast bits. The
      latter is specially important, as it tells the hypervisor that
      there are pending interrupts for this vcpu.
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      e643d803
    • M
      irqchip/gic-v3-its: Add VPENDBASER/VPROPBASER accessors · 3ca63f36
      Marc Zyngier 提交于
      V{PEND,PROP}BASER being 64bit registers, they need some ad-hoc
      accessors on 32bit, specially given that VPENDBASER contains
      a Valid bit, making the access a bit convoluted.
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      3ca63f36
    • M
      irqchip/gic-v3-its: Add GICv4 ITS command definitions · d7276b80
      Marc Zyngier 提交于
      Add the new GICv4 ITS command definitions, most of them, being
      defined in terms of their physical counterparts.
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      d7276b80
    • M
      irqchip/gic-v4: Add management structure definitions · de29faa0
      Marc Zyngier 提交于
      Add a bunch of GICv4-specific data structures that will get used in
      subsequent patches.
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      de29faa0
    • M
      IB/core: Assign root to all drivers · 52427112
      Matan Barak 提交于
      In order to use the parsing tree, we need to assign the root
      to all drivers. Currently, we just assign the default parsing
      tree via ib_uverbs_add_one. The driver could override this by
      assigning a parsing tree prior to registering the device.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      52427112
    • M
      IB/core: Add completion queue (cq) object actions · 9ee79fce
      Matan Barak 提交于
      Adding CQ ioctl actions:
      1. create_cq
      2. destroy_cq
      
      This requires adding the following:
      1. A specification describing the method
      	a. Handler
      	b. Attributes specification
      		Each attribute is one of the following:
      		a. PTR_IN - input data
      			    Note: This could be encoded inlined for
      				  data < 64bit
      		b. PTR_OUT - response data
      		c. IDR - idr based object
      		d. FD - fd based object
                      Blobs attributes (clauses a and b) contain their type,
      	        while objects specifications (clauses c and d)
                      contains the expected object type (for example, the
                      given id should be UVERBS_TYPE_PD) and the required
                      access (READ, WRITE, NEW or DESTROY). If a NEW is
                      required, the new object's id will be assigned to this
                      attribute. All attributes could get UA_FLAGS
                      attribute. Currently we support stating that an
      		attribute is mandatory or that the specification size
                      corresponds to a lower bound (and that this attribute
      		could be extended).
      		We currently add both default attributes and the two
      		generic UHW_IN and UHW_OUT driver specific attributes.
      2. Handler
         A handler gets a uverbs_attr_bundle. The handler developer uses
         uverbs_attr_get to fetch an attribute of a given id.
         Each of these attribute groups correspond to the specification
         group defined in the action (clauses 1.b and 1.c respectively).
         The indices of these arrays corresponds to the attribute ids
         declared in the specifications (clause 2).
      
         The handler is quite simple. It assumes the infrastructure fetched
         all objects and locked, created or destroyed them as required by
         the specification. Pointer (or blob) attributes were validated to
         match their required sizes. After the handler finished, the
         infrastructure commits or rollbacks the objects.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      9ee79fce
    • M
      IB/core: Add legacy driver's user-data · d70724f1
      Matan Barak 提交于
      In this phase, we don't want to change all the drivers to use
      flexible driver's specific attributes. Therefore, we add two default
      attributes: UHW_IN and UHW_OUT. These attributes are optional in some
      methods and they encode the driver specific command data. We add
      a function that extract this data and creates the legacy udata over
      it.
      
      Driver's data should start from UVERBS_UDATA_DRIVER_DATA_FLAG. This
      turns on the first bit of the namespace, indicating this attribute
      belongs to the driver's namespace.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      d70724f1
    • M
      IB/core: Export ioctl enum types to user-space · 64b19e13
      Matan Barak 提交于
      Add a new ib_user_ioctl_verbs.h which exports all required ABI
      enums and structs to the user-space.
      Export the default types to user-space through this file.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      64b19e13
    • M
      IB/core: Explicitly destroy an object while keeping uobject · 4da70da2
      Matan Barak 提交于
      When some objects are destroyed, we need to extract their status at
      destruction. After object's destruction, this status
      (e.g. events_reported) relies in the uobject. In order to have the
      latest and correct status, the underlying object should be destroyed,
      but we should keep the uobject alive and read this information off the
      uobject. We introduce a rdma_explicit_destroy function. This function
      destroys the class type object (for example, the IDR class type which
      destroys the underlying object as well) and then convert the uobject
      to be of a null class type. This uobject will then be destroyed as any
      other uobject once uverbs_finalize_object[s] is called.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      4da70da2
    • M
      IB/core: Add macros for declaring methods and attributes · 35410306
      Matan Barak 提交于
      This patch adds macros for declaring objects, methods and
      attributes. These definitions are later used by downstream patches
      to declare some of the default types.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      35410306
    • M
      IB/core: Add uverbs merge trees functionality · 118620d3
      Matan Barak 提交于
      Different drivers support different features and even subset of the
      common uverbs implementation. Currently, this is handled as bitmask
      in every driver that represents which kind of methods it supports, but
      doesn't go down to attributes granularity. Moreover, drivers might
      want to add their specific types, methods and attributes to let
      their user-space counter-parts be exposed to some more efficient
      abstractions. It means that existence of different features is
      validated syntactically via the parsing infrastructure rather than
      using a complex in-handler logic.
      
      In order to do that, we allow defining features and abstractions
      as parsing trees. These per-feature parsing tree could be merged
      to an efficient (perfect-hash based) parsing tree, which is later
      used by the parsing infrastructure.
      
      To sum it up, this makes a parse tree unique for a device and
      represents only the features this particular device supports.
      This is done by having a root specification tree per feature.
      Before a device registers itself as an IB device, it merges
      all these trees into one parsing tree. This parsing tree
      is used to parse all user-space commands.
      
      A future user-space application could read this parse tree. This
      tree represents which objects, methods and attributes are
      supported by this device.
      
      This is based on the idea of
      Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      118620d3
    • M
      IB/core: Add DEVICE object and root tree structure · 09e3ebf8
      Matan Barak 提交于
      This adds the DEVICE object. This object supports creating the context
      that all objects are created from. Moreover, it supports executing
      methods which are related to the device itself, such as QUERY_DEVICE.
      This is a singleton object (per file instance).
      
      All standard objects are put in the root structure. This root will later
      on be used in drivers as the source for their whole parsing tree.
      Later on, when new features are added, these drivers could mix this root
      with other customized objects.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      09e3ebf8
    • M
      IB/core: Declare an object instead of declaring only type attributes · 5009010f
      Matan Barak 提交于
      Switch all uverbs_type_attrs_xxxx with DECLARE_UVERBS_OBJECT
      macros. This will be later used in order to embed the object
      specific methods in the objects as well.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      5009010f
    • M
      IB/core: Add new ioctl interface · fac9658c
      Matan Barak 提交于
      In this ioctl interface, processing the command starts from
      properties of the command and fetching the appropriate user objects
      before calling the handler.
      
      Parsing and validation is done according to a specifier declared by
      the driver's code. In the driver, all supported objects are declared.
      These objects are separated to different object namepsaces. Dividing
      objects to namespaces is done at initialization by using the higher
      bits of the object ids. This initialization can mix objects declared
      in different places to one parsing tree using in this ioctl interface.
      
      For each object we list all supported methods. Similarly to objects,
      methods are separated to method namespaces too. Namespacing is done
      similarly to the objects case. This could be used in order to add
      methods to an existing object.
      
      Each method has a specific handler, which could be either a default
      handler or a driver specific handler.
      Along with the handler, a bunch of attributes are specified as well.
      Similarly to objects and method, attributes are namespaced and hashed
      by their ids at initialization too. All supported attributes are
      subject to automatic fetching and validation. These attributes include
      the command, response and the method's related objects' ids.
      
      When these entities (objects, methods and attributes) are used, the
      high bits of the entities ids are used in order to calculate the hash
      bucket index. Then, these high bits are masked out in order to have a
      zero based index. Since we use these high bits for both bucketing and
      namespacing, we get a compact representation and O(1) array access.
      This is mandatory for efficient dispatching.
      
      Each attribute has a type (PTR_IN, PTR_OUT, IDR and FD) and a length.
      Attributes could be validated through some attributes, like:
      (*) Minimum size / Exact size
      (*) Fops for FD
      (*) Object type for IDR
      
      If an IDR/fd attribute is specified, the kernel also states the object
      type and the required access (NEW, WRITE, READ or DESTROY).
      All uobject/fd management is done automatically by the infrastructure,
      meaning - the infrastructure will fail concurrent commands that at
      least one of them requires concurrent access (WRITE/DESTROY),
      synchronize actions with device removals (dissociate context events)
      and take care of reference counting (increase/decrease) for concurrent
      actions invocation. The reference counts on the actual kernel objects
      shall be handled by the handlers.
      
       objects
      +--------+
      |        |
      |        |   methods                                                                +--------+
      |        |   ns         method      method_spec                           +-----+   |len     |
      +--------+  +------+[d]+-------+   +----------------+[d]+------------+    |attr1+-> |type    |
      | object +> |method+-> | spec  +-> +  attr_buckets  +-> |default_chain+--> +-----+   |idr_type|
      +--------+  +------+   |handler|   |                |   +------------+    |attr2|   |access  |
      |        |  |      |   +-------+   +----------------+   |driver chain|    +-----+   +--------+
      |        |  |      |                                    +------------+
      |        |  +------+
      |        |
      |        |
      |        |
      |        |
      |        |
      |        |
      |        |
      |        |
      |        |
      |        |
      +--------+
      
      [d] = Hash ids to groups using the high order bits
      
      The right types table is also chosen by using the high bits from
      the ids. Currently we have either default or driver specific groups.
      
      Once validation and object fetching (or creation) completed, we call
      the handler:
      int (*handler)(struct ib_device *ib_dev, struct ib_uverbs_file *ufile,
                     struct uverbs_attr_bundle *ctx);
      
      ctx bundles attributes of different namespaces. Each element there
      is an array of attributes which corresponds to one namespaces of
      attributes. For example, in the usually used case:
      
       ctx                               core
      +----------------------------+     +------------+
      | core:                      +---> | valid      |
      +----------------------------+     | cmd_attr   |
      | driver:                    |     +------------+
      |----------------------------+--+  | valid      |
                                      |  | cmd_attr   |
                                      |  +------------+
                                      |  | valid      |
                                      |  | obj_attr   |
                                      |  +------------+
                                      |
                                      |  drivers
                                      |  +------------+
                                      +> | valid      |
                                         | cmd_attr   |
                                         +------------+
                                         | valid      |
                                         | cmd_attr   |
                                         +------------+
                                         | valid      |
                                         | obj_attr   |
                                         +------------+
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      fac9658c
    • A
      RDMA/vmw_pvrdma: Report network header type in WC · 72f9b089
      Aditya Sarwade 提交于
      We should report the network header type in the work completion so that
      the kernel can infer the right RoCE type headers.
      Reviewed-by: NBryan Tan <bryantan@vmware.com>
      Signed-off-by: NAditya Sarwade <asarwade@vmware.com>
      Signed-off-by: NAdit Ranadive <aditr@vmware.com>
      Reviewed-by: NYuval Shaia <yuval.shaia@oracle.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      72f9b089
    • H
      net/mlx5: Remove the flag MLX5_INTERFACE_STATE_SHUTDOWN · 10a8d007
      Huy Nguyen 提交于
      MLX5_INTERFACE_STATE_SHUTDOWN is not used in the code.
      
      Fixes: 5fc7197d ("net/mlx5: Add pci shutdown callback")
      Signed-off-by: NHuy Nguyen <huyn@mellanox.com>
      Reviewed-by: NDaniel Jurgens <danielj@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      10a8d007
    • H
      net/mlx5: Skip mlx5_unload_one if mlx5_load_one fails · b3cb5388
      Huy Nguyen 提交于
      There is an issue where the firmware fails during mlx5_load_one,
      the health_care timer detects the issue and schedules a health_care call.
      Then the mlx5_load_one detects the issue, cleans up and quits. Then
      the health_care starts and calls mlx5_unload_one to clean up the resources
      that no longer exist and causes kernel panic.
      
      The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set
      after mlx5_load_one fails. The solution is removing the bit
      MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the
      bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN
      is redundant and we can use MLX5_INTERFACE_STATE_UP instead.
      
      Fixes: 5fc7197d ("net/mlx5: Add pci shutdown callback")
      Signed-off-by: NHuy Nguyen <huyn@mellanox.com>
      Reviewed-by: NDaniel Jurgens <danielj@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      b3cb5388
  4. 30 8月, 2017 3 次提交
    • M
      IB/core: Add support to finalize objects in one transaction · f43dbebf
      Matan Barak 提交于
      The new ioctl based infrastructure either commits or rollbacks
      all objects of the method as one transaction. In order to do
      that, we introduce a notion of dealing with a collection of
      objects that are related to a specific method.
      
      This also requires adding a notion of a method and attribute.
      A method contains a hash of attributes, where each bucket
      contains several attributes. The attributes are hashed according
      to their namespace which resides in the four upper bits of the id.
      
      For example, an object could be a CQ, which has an action of CREATE_CQ.
      This action has multiple attributes. For example, the CQ's new handle
      and the comp_channel. Each layer in this hierarchy - objects, methods
      and attributes is split into namespaces. The basic example for that is
      one namespace representing the default entities and another one
      representing the driver specific entities.
      
      When declaring these methods and attributes, we actually declare
      their specifications. When a method is executed, we actually
      allocates some space to hold auxiliary information. This auxiliary
      information contains meta-data about the required objects, such
      as pointers to their type information, pointers to the uobjects
      themselves (if exist), etc.
      The specification, along with the auxiliary information we allocated
      and filled is given to the finalize_objects function.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      f43dbebf
    • M
      IB/core: Add a generic way to execute an operation on a uobject · a0aa309c
      Matan Barak 提交于
      The ioctl infrastructure treats all user-objects in the same manner.
      It gets objects ids from the user-space and by using the object type
      and type attributes mentioned in the object specification, it executes
      this required method. Passing an object id from the user-space as
      an attribute is carried out in three stages. The first is carried out
      before the actual handler and the last is carried out afterwards.
      
      The different supported operations are read, write, destroy and create.
      In the first stage, the former three actions just fetches the object
      from the repository (by using its id) and locks it. The last action
      allocates a new uobject. Afterwards, the second stage is carried out
      when the handler itself carries out the required modification of the
      object. The last stage is carried out after the handler finishes and
      commits the result. The former two operations just unlock the object.
      Destroy calls the "free object" operation, taking into account the
      object's type and releases the uobject as well. Creation just adds the
      new uobject to the repository, making the object visible to the
      application.
      
      In order to abstract these details from the ioctl infrastructure
      layer, we add uverbs_get_uobject_from_context and
      uverbs_finalize_object functions which corresponds to the first
      and last stages respectively.
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      a0aa309c
    • C
      nvme: fix the definition of the doorbell buffer config support bit · 223694b9
      Changpeng Liu 提交于
      NVMe 1.3 specification defines the Optional Admin Command Support feature
      flags, bit 8 set to '1' then the controller supports the Doorbell Buffer
      Config command. Bit 7 is used for Virtualization Mangement command.
      Signed-off-by: NChangpeng Liu <changpeng.liu@intel.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: NMax Gurtovoy <maxg@mellanox.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Fixes: f9f38e33 ("nvme: improve performance for virtual NVMe devices")
      Cc: stable@vger.kernel.org
      223694b9
  5. 29 8月, 2017 5 次提交
    • T
      Revert "libata: quirk read log on no-name M.2 SSD" · 2aca3923
      Tejun Heo 提交于
      This reverts commit 35f0b6a7.
      
      We now conditionalize issuing of READ LOG PAGE on the TRUSTED
      COMPUTING SUPPORTED bit in the identity data and this shouldn't be
      necessary.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      2aca3923
    • C
      libata: check for trusted computing in IDENTIFY DEVICE data · e8f11db9
      Christoph Hellwig 提交于
      ATA-8 and later mirrors the TRUSTED COMPUTING SUPPORTED bit in word 48 of
      the IDENTIFY DEVICE data.  Check this before issuing a READ LOG PAGE
      command to avoid issues with buggy devices.  The only downside is that
      we can't support Security Send / Receive for a device with an older
      revision due to the conflicting use of this field in earlier
      specifications.
      
      tj: The reason we need this is because some devices which don't
          support READ LOG PAGE lock up after getting issued that command.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      e8f11db9
    • B
      sched/completion: Avoid unnecessary stack allocation for COMPLETION_INITIALIZER_ONSTACK() · ec81048c
      Boqun Feng 提交于
      In theory, COMPLETION_INITIALIZER_ONSTACK() should never affect the
      stack allocation of the caller. However, on some compilers, a temporary
      structure was allocated for the return value of
      COMPLETION_INITIALIZER_ONSTACK().
      
      For example in write_journal() with LOCKDEP_COMPLETIONS=y (GCC is 7.1.1):
      
      	io_comp.comp = COMPLETION_INITIALIZER_ONSTACK(io_comp.comp);
      	    2462:       e8 00 00 00 00          callq  2467 <write_journal+0x47>
      	    2467:       48 8d 85 80 fd ff ff    lea    -0x280(%rbp),%rax
      	    246e:       48 c7 c6 00 00 00 00    mov    $0x0,%rsi
      	    2475:       48 c7 c2 00 00 00 00    mov    $0x0,%rdx
      		x->done = 0;
      	    247c:       c7 85 90 fd ff ff 00    movl   $0x0,-0x270(%rbp)
      	    2483:       00 00 00
      		init_waitqueue_head(&x->wait);
      	    2486:       48 8d 78 18             lea    0x18(%rax),%rdi
      	    248a:       e8 00 00 00 00          callq  248f <write_journal+0x6f>
      		if (commit_start + commit_sections <= ic->journal_sections) {
      	    248f:       41 8b 87 a8 00 00 00    mov    0xa8(%r15),%eax
      		io_comp.comp = COMPLETION_INITIALIZER_ONSTACK(io_comp.comp);
      	    2496:       48 8d bd e8 f9 ff ff    lea    -0x618(%rbp),%rdi
      	    249d:       48 8d b5 90 fd ff ff    lea    -0x270(%rbp),%rsi
      	    24a4:       b9 17 00 00 00          mov    $0x17,%ecx
      	    24a9:       f3 48 a5                rep movsq %ds:(%rsi),%es:(%rdi)
      		if (commit_start + commit_sections <= ic->journal_sections) {
      	    24ac:       41 39 c6                cmp    %eax,%r14d
      		io_comp.comp = COMPLETION_INITIALIZER_ONSTACK(io_comp.comp);
      	    24af:       48 8d bd 90 fd ff ff    lea    -0x270(%rbp),%rdi
      	    24b6:       48 8d b5 e8 f9 ff ff    lea    -0x618(%rbp),%rsi
      	    24bd:       b9 17 00 00 00          mov    $0x17,%ecx
      	    24c2:       f3 48 a5                rep movsq %ds:(%rsi),%es:(%rdi)
      
      We can obviously see the temporary structure allocated, and the compiler
      also does two meaningless memcpy with "rep movsq".
      
      And according to:
      
      	https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html#Statement-Exprs
      
      The return value of a statement expression is returned by value, so the
      temporary variable is created in COMPLETION_INITIALIZER_ONSTACK(), and
      that's why the temporary structures are allocted.
      
      To fix this, make the brace block in COMPLETION_INITIALIZER_ONSTACK()
      return a pointer and dereference it outside the block rather than return
      the whole structure, in this way, we are able to teach the compiler not
      to do the unnecessary stack allocation.
      
      This could also reduce the stack size even if !LOCKDEP, for example in
      write_journal(), compiled with gcc 7.1.1, the result of command:
      
      	 objdump -d drivers/md/dm-integrity.o | ./scripts/checkstack.pl x86
      
      before:
      
      	0x0000246a write_journal [dm-integrity.o]:              696
      
      after:
      
      	0x00002b7a write_journal [dm-integrity.o]:              296
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NBoqun Feng <boqun.feng@gmail.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: walken@google.com
      Cc: willy@infradead.org
      Link: http://lkml.kernel.org/r/20170823152542.5150-3-boqun.feng@gmail.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      ec81048c
    • Y
      smp: Avoid using two cache lines for struct call_single_data · 966a9671
      Ying Huang 提交于
      struct call_single_data is used in IPIs to transfer information between
      CPUs.  Its size is bigger than sizeof(unsigned long) and less than
      cache line size.  Currently it is not allocated with any explicit alignment
      requirements.  This makes it possible for allocated call_single_data to
      cross two cache lines, which results in double the number of the cache lines
      that need to be transferred among CPUs.
      
      This can be fixed by requiring call_single_data to be aligned with the
      size of call_single_data. Currently the size of call_single_data is the
      power of 2.  If we add new fields to call_single_data, we may need to
      add padding to make sure the size of new definition is the power of 2
      as well.
      
      Fortunately, this is enforced by GCC, which will report bad sizes.
      
      To set alignment requirements of call_single_data to the size of
      call_single_data, a struct definition and a typedef is used.
      
      To test the effect of the patch, I used the vm-scalability multiple
      thread swap test case (swap-w-seq-mt).  The test will create multiple
      threads and each thread will eat memory until all RAM and part of swap
      is used, so that huge number of IPIs are triggered when unmapping
      memory.  In the test, the throughput of memory writing improves ~5%
      compared with misaligned call_single_data, because of faster IPIs.
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NHuang, Ying <ying.huang@intel.com>
      [ Add call_single_data_t and align with size of call_single_data. ]
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Aaron Lu <aaron.lu@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/87bmnqd6lz.fsf@yhuang-mobile.sh.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      966a9671
    • P
      locking/lockdep: Untangle xhlock history save/restore from task independence · f52be570
      Peter Zijlstra 提交于
      Where XHLOCK_{SOFT,HARD} are save/restore points in the xhlocks[] to
      ensure the temporal IRQ events don't interact with task state, the
      XHLOCK_PROC is a fundament different beast that just happens to share
      the interface.
      
      The purpose of XHLOCK_PROC is to annotate independent execution inside
      one task. For example workqueues, each work should appear to run in its
      own 'pristine' 'task'.
      
      Remove XHLOCK_PROC in favour of its own interface to avoid confusion.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: boqun.feng@gmail.com
      Cc: david@fromorbit.com
      Cc: johannes@sipsolutions.net
      Cc: kernel-team@lge.com
      Cc: oleg@redhat.com
      Cc: tj@kernel.org
      Link: http://lkml.kernel.org/r/20170829085939.ggmb6xiohw67micb@hirez.programming.kicks-ass.netSigned-off-by: NIngo Molnar <mingo@kernel.org>
      f52be570