30 Oct, 2017

21 commits

  • There is no point in storing the GPIO alarm settings in their
    own struct so merge this into the main state container.

    Convert the variables from "unsigned" to "unsigned int" to
    make checkpatch happy.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • We are not passing the platform data struct into the driver from the
    outside, there is no point of having it around separately so instead
    of first populating the platform data struct and assigning the result
    into the same variables in the state container (struct gpio_fan_data)
    just assign the configuration from the device tree directly into the
    state container members.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • We have no users of platform data, we made platform data driver-local,
    so cut all #ifdefs for the platform data case, and depend on the
    Kconfig CONFIG_OF_GPIO symbol.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • The driver is storing the struct platform_device *pdev pointer
    but what it is really using and want to pass around is a
    struct device *dev pointer.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • There is not a single user of the platform data header in
    . We can conclude that all current users are
    probing from the device tree, so start simplifying the code by
    pulling the header into the driver.

    Convert "unsigned" to "unsigned int" in the process to make
    checkpatch happy.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • Create local struct device *dev and device_node *np pointers to
    make the code easier to read.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • This moves the GPIO fan bindings to the hwmon bindings. The GPIO
    fan is a hwmon class hardware, not related to GPIO other than being
    a consumer of GPIOs.

    Cc: devicetree@vger.kernel.org
    Signed-off-by: Linus Walleij
    Acked-by: Rob Herring
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • Add device record for Maxim MAX6621 temperature sensor device.

    Signed-off-by: Vadim Pasternak
    Acked-by: Rob Herring
    Signed-off-by: Guenter Roeck

    Vadim Pasternak
     
  • MAX6621 is a PECI-to-I2C translator provides an efficient, low-cost
    solution for PECI-to-SMBus/I2C protocol conversion. It allows reading the
    temperature from the PECI-compliant host directly from up to four
    PECI-enabled CPUs.

    Signed-off-by: Vadim Pasternak
    Signed-off-by: Guenter Roeck

    Vadim Pasternak
     
  • Don't populate const array watchdog_minors on the stack, instead make it
    static. Makes the object code smaller by over 350 bytes:

    Before:
    text data bss dec hex filename
    48019 38144 256 86419 15193 drivers/hwmon/w83793.o

    After:
    text data bss dec hex filename
    47574 38232 256 86062 1502e drivers/hwmon/w83793.o

    (gcc 6.3.0, x86-64)

    Signed-off-by: Colin Ian King
    Signed-off-by: Guenter Roeck

    Colin Ian King
     
  • The previous value reduced the time required to determine
    the fan value, however, it's also used as the final timeout
    mechanism. The prevous value would work for any fan speed
    greater than around 3k RPM. This increased value, lets the fan
    speeds return quickly but will wait longer to handle speeds below 3k
    RPM.

    Testing: this value was determined through experimentation on the ast2400
    on the Quanta-q71l. This configurations runs 8 fans attached to the
    controller.

    Signed-off-by: Patrick Venture
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck

    Patrick Venture
     
  • Add new device tree binding for max1619.

    Signed-off-by: Alan Tull
    Cc: Jean Delvare
    Cc: Guenter Roeck
    Cc: Rob Herring
    Cc: Mark Rutland
    Signed-off-by: Guenter Roeck

    Alan Tull
     
  • Add new device tree bindings document for max1619 device
    including a new compatible string.

    Signed-off-by: Alan Tull
    Cc: Jean Delvare
    Cc: Guenter Roeck
    Cc: Rob Herring
    Cc: Mark Rutland
    Acked-by: Rob Herring
    Signed-off-by: Guenter Roeck

    Alan Tull
     
  • A previous commit removed bit or'ing into to the integer status
    so now status is now always zero. This means that the non-zero check on
    status and the sht15_send_status call will never occur; it is deadcode.
    Clean this up by removing the dead code.

    Detected by: CoverityScan CID#1456835 ("Logically dead code")

    Fixes: aa7ab80c578c ("hwmon: (sht15) Root out platform data")
    Signed-off-by: Colin Ian King
    Signed-off-by: Guenter Roeck

    Colin Ian King
     
  • After finding out there are active users of this sensor I noticed:

    - It has a single PXA27x board file using the platform data
    - The platform data is only used to carry two GPIO pins, all other
    fields are unused
    - The driver does not use GPIO descriptors but the legacy GPIO
    API

    I saw we can swiftly fix this by:

    - Killing off the platform data entirely
    - Define a GPIO descriptor lookup table in the board file
    - Use the standard devm_gpiod_get() to grab the GPIO descriptors
    from either the device tree or the board file table.

    This compiles, but needs testing.

    Cc: arm@kernel.org
    Cc: Marco Franchi
    Cc: Davide Hug
    Cc: Jonathan Cameron
    Signed-off-by: Linus Walleij
    Acked-by: Arnd Bergmann
    Tested-by: Marco Franchi
    Acked-by: Arnd Bergmann
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • Add support for handling temperature offset values for various AMD CPUs,
    similar to the code used in the coretemp driver for Intel CPUs. This is
    primarily for Ryzen CPUs (which has documented temperature offsets),
    but the code is kept generic to simplify adding additional CPUs.

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • Add support for temperature sensors on Family 17h (Ryzen) processors.

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • Introduce a local data structure and determine the temperature read
    function at probe time to reduce runtime complexity.

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • Function snprintf already cares for the terminating NUL at the end of
    the string, the caller doesn't need to do it.

    Signed-off-by: Jean Delvare
    Cc: Andrea Merello
    Cc: Guenter Roeck
    Signed-off-by: Guenter Roeck

    Jean Delvare
     
  • The pmbus core may call read/write word data functions with a page value
    of -1, intending to perform the operation without setting the page.
    However, the read/write word data functions accept only unsigned 8-bit
    page numbers, and therefore cannot check for negative page number to
    avoid setting the page. This results in setting the page number to 0xFF.
    This may result in errors or undefined behavior of some devices
    (specifically the ir35221, which allows the page to be set to 0xFF,
    but some subsequent operations to read registers may fail).

    Switch the pmbus_set_page page parameter to an integer and perform the
    check for negative page there. Make read/write functions consistent in
    accepting an integer page number parameter.

    Signed-off-by: Edward A. James
    Fixes: cbcdec6202c9 ("hwmon: (pmbus): Access word data for STATUS_WORD")
    Signed-off-by: Guenter Roeck

    Edward A. James
     
  • Linus Torvalds
     

29 Oct, 2017

19 commits

  • Pull networking fixes from David Miller:

    1) Fix route leak in xfrm_bundle_create().

    2) In mac80211, validate user rate mask before configuring it. From
    Johannes Berg.

    3) Properly enforce memory limits in fair queueing code, from Toke
    Hoiland-Jorgensen.

    4) Fix lockdep splat in inet_csk_route_req(), from Eric Dumazet.

    5) Fix TSO header allocation and management in mvpp2 driver, from Yan
    Markman.

    6) Don't take socket lock in BH handler in strparser code, from Tom
    Herbert.

    7) Don't show sockets from other namespaces in AF_UNIX code, from
    Andrei Vagin.

    8) Fix double free in error path of tap_open(), from Girish Moodalbail.

    9) Fix TX map failure path in igb and ixgbe, from Jean-Philippe Brucker
    and Alexander Duyck.

    10) Fix DCB mode programming in stmmac driver, from Jose Abreu.

    11) Fix err_count handling in various tunnels (ipip, ip6_gre). From Xin
    Long.

    12) Properly align SKB head before building SKB in tuntap, from Jason
    Wang.

    13) Avoid matching qdiscs with a zero handle during lookups, from Cong
    Wang.

    14) Fix various endianness bugs in sctp, from Xin Long.

    15) Fix tc filter callback races and add selftests which trigger the
    problem, from Cong Wang.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (73 commits)
    selftests: Introduce a new test case to tc testsuite
    selftests: Introduce a new script to generate tc batch file
    net_sched: fix call_rcu() race on act_sample module removal
    net_sched: add rtnl assertion to tcf_exts_destroy()
    net_sched: use tcf_queue_work() in tcindex filter
    net_sched: use tcf_queue_work() in rsvp filter
    net_sched: use tcf_queue_work() in route filter
    net_sched: use tcf_queue_work() in u32 filter
    net_sched: use tcf_queue_work() in matchall filter
    net_sched: use tcf_queue_work() in fw filter
    net_sched: use tcf_queue_work() in flower filter
    net_sched: use tcf_queue_work() in flow filter
    net_sched: use tcf_queue_work() in cgroup filter
    net_sched: use tcf_queue_work() in bpf filter
    net_sched: use tcf_queue_work() in basic filter
    net_sched: introduce a workqueue for RCU callbacks of tc filter
    sctp: fix some type cast warnings introduced since very beginning
    sctp: fix a type cast warnings that causes a_rwnd gets the wrong value
    sctp: fix some type cast warnings introduced by transport rhashtable
    sctp: fix some type cast warnings introduced by stream reconf
    ...

    Linus Torvalds
     
  • Cong Wang says:

    ====================
    net_sched: fix races with RCU callbacks

    Recently, the RCU callbacks used in TC filters and TC actions keep
    drawing my attention, they introduce at least 4 race condition bugs:

    1. A simple one fixed by Daniel:

    commit c78e1746d3ad7d548bdf3fe491898cc453911a49
    Author: Daniel Borkmann
    Date: Wed May 20 17:13:33 2015 +0200

    net: sched: fix call_rcu() race on classifier module unloads

    2. A very nasty one fixed by me:

    commit 1697c4bb5245649a23f06a144cc38c06715e1b65
    Author: Cong Wang
    Date: Mon Sep 11 16:33:32 2017 -0700

    net_sched: carefully handle tcf_block_put()

    3. Two more bugs found by Chris:
    https://patchwork.ozlabs.org/patch/826696/
    https://patchwork.ozlabs.org/patch/826695/

    Usually RCU callbacks are simple, however for TC filters and actions,
    they are complex because at least TC actions could be destroyed
    together with the TC filter in one callback. And RCU callbacks are
    invoked in BH context, without locking they are parallel too. All of
    these contribute to the cause of these nasty bugs.

    Alternatively, we could also:

    a) Introduce a spinlock to serialize these RCU callbacks. But as I
    said in commit 1697c4bb5245 ("net_sched: carefully handle
    tcf_block_put()"), it is very hard to do because of tcf_chain_dump().
    Potentially we need to do a lot of work to make it possible (if not
    impossible).

    b) Just get rid of these RCU callbacks, because they are not
    necessary at all, callers of these call_rcu() are all on slow paths
    and holding RTNL lock, so blocking is allowed in their contexts.
    However, David and Eric dislike adding synchronize_rcu() here.

    As suggested by Paul, we could defer the work to a workqueue and
    gain the permission of holding RTNL again without any performance
    impact, however, in tcf_block_put() we could have a deadlock when
    flushing workqueue while hodling RTNL lock, the trick here is to
    defer the work itself in workqueue and make it queued after all
    other works so that we keep the same ordering to avoid any
    use-after-free. Please see the first patch for details.

    Patch 1 introduces the infrastructure, patch 2~12 move each
    tc filter to the new tc filter workqueue, patch 13 adds
    an assertion to catch potential bugs like this, patch 14
    closes another rcu callback race, patch 15 and patch 16 add
    new test cases.
    ====================

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    David S. Miller
     
  • In this patchset, we fixed a tc bug. This patch adds the test case
    that reproduces the bug. To run this test case, user should specify
    an existing NIC device:
    # sudo ./tdc.py -d enp4s0f0

    This test case belongs to category "flower". If user doesn't specify
    a NIC device, the test cases belong to "flower" will not be run.

    In this test case, we create 1M filters and all filters share the same
    action. When destroying all filters, kernel should not panic. It takes
    about 18s to run it.

    Acked-by: Jamal Hadi Salim
    Acked-by: Lucas Bates
    Signed-off-by: Chris Mi
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Chris Mi
     
  • # ./tdc_batch.py -h
    usage: tdc_batch.py [-h] [-n NUMBER] [-o] [-s] [-p] device file

    TC batch file generator

    positional arguments:
    device device name
    file batch file name

    optional arguments:
    -h, --help show this help message and exit
    -n NUMBER, --number NUMBER
    how many lines in batch file
    -o, --skip_sw skip_sw (offload), by default skip_hw
    -s, --share_action all filters share the same action
    -p, --prio all filters have different prio

    Acked-by: Jamal Hadi Salim
    Acked-by: Lucas Bates
    Signed-off-by: Chris Mi
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Chris Mi
     
  • Similar to commit c78e1746d3ad
    ("net: sched: fix call_rcu() race on classifier module unloads"),
    we need to wait for flying RCU callback tcf_sample_cleanup_rcu().

    Cc: Yotam Gigi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • After previous patches, it is now safe to claim that
    tcf_exts_destroy() is always called with RTNL lock.

    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Defer the tcf_exts_destroy() in RCU callback to
    tc filter workqueue and get RTNL lock.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • This patch introduces a dedicated workqueue for tc filters
    so that each tc filter's RCU callback could defer their
    action destroy work to this workqueue. The helper
    tcf_queue_work() is introduced for them to use.

    Because we hold RTNL lock when calling tcf_block_put(), we
    can not simply flush works inside it, therefore we have to
    defer it again to this workqueue and make sure all flying RCU
    callbacks have already queued their work before this one, in
    other words, to ensure this is the last one to execute to
    prevent any use-after-free.

    On the other hand, this makes tcf_block_put() ugly and
    harder to understand. Since David and Eric strongly dislike
    adding synchronize_rcu(), this is probably the only
    solution that could make everyone happy.

    Please also see the code comments below.

    Reported-by: Chris Mi
    Cc: Daniel Borkmann
    Cc: Jiri Pirko
    Cc: John Fastabend
    Cc: Jamal Hadi Salim
    Cc: "Paul E. McKenney"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • Xin Long says:

    ====================
    sctp: a bunch of fixes for some sparse warnings

    As Eric noticed, when running 'make C=2 M=net/sctp/', a plenty of
    warnings or errors checked by sparse appear. They are all problems
    about Endian and type cast.

    Most of them are just warnings by which no issues could be caused
    while some might be bugs.

    This patchset fixes them with four patches basically according to
    how they are introduced.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller