Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wlogical-not-parentheses in drivers/tty/serial/mps2-uart.c #344

Closed
nathanchance opened this issue Jan 31, 2019 · 2 comments
Closed

-Wlogical-not-parentheses in drivers/tty/serial/mps2-uart.c #344

nathanchance opened this issue Jan 31, 2019 · 2 comments
Assignees
Labels
-Wlogical-not-parentheses [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle

Comments

@nathanchance
Copy link
Member

drivers/tty/serial/mps2-uart.c:351:6: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
        if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
            ^                ~
drivers/tty/serial/mps2-uart.c:351:6: note: add parentheses after the '!' to evaluate the bitwise operator first
        if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
            ^
             (                                       )
drivers/tty/serial/mps2-uart.c:351:6: note: add parentheses around left hand side expression to silence this warning
        if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
            ^
            (               )
1 warning generated.

Patch sent: https://lore.kernel.org/lkml/20190131180627.19944-1-natechancellor@gmail.com/

@nathanchance nathanchance added [PATCH] Submitted A patch has been submitted for review -Wlogical-not-parentheses [BUG] linux-next This is an issue only seen in linux-next labels Jan 31, 2019
@nathanchance nathanchance self-assigned this Jan 31, 2019
@nathanchance
Copy link
Member Author

That is officially the fastest I have ever had a patch applied (29 minutes): https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?id=9c6a2583f115acf29a27709ca9ce37714d04fb24

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Jan 31, 2019
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Feb 1, 2019
jic23 pushed a commit to hisilicon/kernel-dev that referenced this issue Feb 4, 2019
GIT f9f83faf3e7e98771a84bfb57c2a56a17ad059f1

commit fa6821cbf1d9724284ef0906c9a01a5fbf13a35c
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Thu Jan 31 19:57:26 2019 +0100

    r8169: improve WoL handling
    
    WoL handling for the RTL8168 family is a little bit tricky because of
    different types of broken BIOS and/or chip quirks.
    
    Two known issues:
    1. Network properly resumes from suspend only if WoL is enabled in the chip.
    2. Some notebooks wake up immediately if system is suspended and network
       device is wakeup-enabled.
    
    Few patches tried to deal with this:
    7edf6d314cd0 ("r8169: disable WOL per default")
    18041b523692 ("r8169: restore previous behavior to accept BIOS WoL
    settings")
    
    Currently we have the situation that the chip WoL settings as set by
    the BIOS are respected (to prevent issue 1), but the device doesn't get
    wakeup-enabled (to prevent issue 2).
    
    This leads to another issue:
    If systemd is told to set WoL it first checks whether the requested
    settings are active already (and does nothing if yes). Due to the chip
    WoL flags being set properly systemd assumes that WoL is configured
    properly in our case. Result is that device doesn't get wakeup-enabled
    and WoL doesn't work (until it's set e.g. by ethtool).
    
    This patch now:
    - leaves the chip WoL settings as is (to prevent issue 1)
    - keeps the behavior to not wakeup-enable the device initially
      (to prevent issue 2)
    - In addition we report WoL as being disabled in get_wol, matching
      that device isn't wakeup-enabled. If systemd is told to enable WoL,
      it will therefore detect that it has to do something and will
      call set_wol.
    
    Of course the user still has the option to override this with
    e.g. ethtool.
    
    v2:
    - Don't just exclude __rtl8169_get_wol() from compiling, remove it.
    v3:
    - adjust commit message
    
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 058fdecc6de7cdecbf4c59b851e80eb2d6c5295f
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:38 2019 +0100

    block, bfq: fix in-service-queue check for queue merging
    
    When a new I/O request arrives for a bfq_queue, say Q, bfq checks
    whether that request is close to
    (a) the head request of some other queue waiting to be served, or
    (b) the last request dispatched for the in-service queue (in case Q
    itself is not the in-service queue)
    
    If a queue, say Q2, is found for which the above condition holds, then
    bfq merges Q and Q2, to hopefully get a more sequential I/O in the
    resulting merged queue, and thus a possibly higher throughput.
    
    Case (b) is checked by comparing the new request for Q with the last
    request dispatched, assuming that the latter necessarily belonged to the
    in-service queue. Unfortunately, this assumption is no longer always
    correct, since commit d0edc2473be9 ("block, bfq: inject other-queue I/O
    into seeky idle queues on NCQ flash").
    
    When the assumption does not hold, queues that must not be merged may be
    merged, causing unexpected loss of control on per-queue service
    guarantees.
    
    This commit solves this problem by adding an extra field, which stores
    the actual last request dispatched for the in-service queue, and by
    using this new field to correctly check case (b).
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 02a6d787f4afc8be2d3d52ab0a1df0c6a2d99e7b
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:37 2019 +0100

    block, bfq: do not overcharge writes in asymmetric scenarios
    
    Writes tend to starve reads. bfq counters this problem by overcharging
    writes with an inflated service w.r.t. the actual service (number of
    sector written) they receive.
    
    Yet his overcharging is useless, and actually causes unfairness in the
    opposite direction, when bfq happens to be enforcing strong I/O control.
    bfq does this enforcing when the scenario is asymmetric, i.e., when some
    bfq_queue or group of bfq_queues is to be granted a different bandwidth
    than some other bfq_queue or group of bfq_queues. So, in such a
    scenario, this commit disables write overcharging.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit b3c3498112ffafa5f613bb482f9723996bfd5e4f
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:36 2019 +0100

    block, bfq: port commit "cfq-iosched: improve hw_tag detection"
    
    The original commit is commit 1a1238a7dd48 ("cfq-iosched: improve hw_tag
    detection") and has the following commit message:
    
    If active queue hasn't enough requests and idle window opens, cfq will
    not dispatch sufficient requests to hardware. In such situation, current
    code will zero hw_tag. But this is because cfq doesn't dispatch enough
    requests instead of hardware queue doesn't work. Don't zero hw_tag in
    such case.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit a3c92560324bd616deaecb6842b2a0337a80ad8b
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:35 2019 +0100

    block, bfq: reduce threshold for detecting command queueing
    
    bfq simple heuristic from cfq for detecting whether the drive performs
    command queueing: check whether the average number of in-flight requests
    is above a given threshold. Unfortunately this heuristic does fail to
    detect queueing (on drives with queueing) if processes doing I/O are few
    and issue I/O with a low depth.
    
    To reduce false negatives, this commit lowers the threshold.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 9dee8b3b057e1da26f85f1842f2aaf3bb200fb94
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:34 2019 +0100

    block, bfq: fix queue removal from weights tree
    
    bfq maintains an ordered list, through a red-black tree, of unique
    weights of active bfq_queues. This list is used to detect whether there
    are active queues with differentiated weights. The weight of a queue is
    removed from the list when both the following two conditions become
    true:
    
    (1) the bfq_queue is flagged as inactive
    (2) the has no in-flight request any longer;
    
    Unfortunately, in the rare cases where condition (2) becomes true before
    condition (1), the removal fails, because the function to remove the
    weight of the queue (bfq_weights_tree_remove) is rightly invoked in the
    path that deactivates the bfq_queue, but mistakenly invoked *before* the
    function that actually performs the deactivation (bfq_deactivate_bfqq).
    
    This commits moves the invocation of bfq_weights_tree_remove for
    condition (1) to after bfq_deactivate_bfqq. As a consequence of this
    move, it is necessary to add a further reference to the queue when the
    weight of a queue is added, because the queue might otherwise be freed
    before bfq_weights_tree_remove is invoked. This commit adds this
    reference and makes all related modifications.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit d87447d84fe194b0e4f5413b5344dc82cc100711
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:33 2019 +0100

    block, bfq: fix sequential rq detection in rate estimation
    
    In bfq_update_peak_rate, to check whether an I/O request rq is
    sequential, only the seek distance of rq w.r.t. the last request
    dispatched is controlled. This is not sufficient for non-rotational
    storage, where the size of rq is at least as relevant. This commit adds
    the missing control.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 530c4cbb3c62f9e42dbf39279fb346f2d2ab4dbb
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:32 2019 +0100

    block, bfq: unconditionally plug I/O in asymmetric scenarios
    
    bfq detects the creation of multiple bfq_queues shortly after each
    other, namely a burst of queue creations in the terminology used in the
    code. If the burst is large, then no queue in the burst is granted
    - either I/O-dispatch plugging when the queue remains temporarily idle
      while in service;
    - or weight raising, because it causes even longer plugging.
    
    In fact, such a plugging tends to lower throughput, while these bursts
    are typically due to applications or services that spawn multiple
    processes, to reach a common goal as soon as possible. Examples are a
    "git grep" or the booting of a system.
    
    Unfortunately, disabling plugging may cause a loss of service guarantees
    in asymmetric scenarios, i.e., if queue weights are differentiated or if
    more than one group is active.
    
    This commit addresses this issue by no longer disabling I/O-dispatch
    plugging for queues in large bursts.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit ac8b0cb415f3aa9162009d39624501d37031533b
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:31 2019 +0100

    block, bfq: do not plug I/O of in-service queue when harmful
    
    If the in-service bfq_queue is sync and remains temporarily idle, then
    I/O dispatching (from other queues) may be plugged. It may be dome for
    two reasons: either to boost throughput, or to preserve the bandwidth
    share of the in-service queue. In the first case, if the I/O of the
    in-service queue, when it finally arrives, consists only of one small
    I/O request, then it makes sense to plug even the I/O of the in-service
    queue. In fact, serving such a small request immediately is likely to
    lower throughput instead of boosting it, whereas waiting a little bit is
    likely to let that request grow, thanks to request merging, and become
    more profitable in terms of throughput (this is likely to happen exactly
    because the I/O of the queue has been detected to boost throughput).
    
    On the opposite end, if I/O dispatching is being plugged only to
    preserve the bandwidth of the in-service queue, then it would be better
    not to plug also the I/O of the in-service queue, because such a
    plugging is likely to cause only loss of bandwidth for the queue.
    
    Unfortunately, no distinction is made between the two cases, and the I/O
    of the in-service queue is always plugged in case just a small I/O
    request arrives. This commit draws this missing distinction and does not
    perform harmful plugging.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 05c2f5c30b3ca2346a5bb7c74b0c9515d8f4fbd2
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:30 2019 +0100

    block, bfq: split function bfq_better_to_idle
    
    This is a preparatory commit for commits that need to check only one of
    the two main reasons for idling. This change should also improve the
    quality of the code a little bit, by splitting a function that contains
    very long, non-trivial and little related comments.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 73d58118498b14e4d2f2391105459b997b586ddc
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:29 2019 +0100

    block, bfq: consider also ioprio classes in symmetry detection
    
    In asymmetric scenarios, i.e., when some bfq_queue or bfq_group needs to
    be guaranteed a different bandwidth than other bfq_queues or bfq_groups,
    these service guaranteed can be provided only by plugging I/O dispatch,
    completely or partially, when the queue in service remains temporarily
    empty. A case where asymmetry is particularly strong is when some active
    bfq_queues belong to a higher-priority class than some other active
    bfq_queues. Unfortunately, this important case is not considered at all
    in the code for detecting asymmetric scenarios. This commit adds the
    missing logic.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 03e565e4204c6cf8687d995de5cafd0341503b4e
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:28 2019 +0100

    block, bfq: remove case of redirected bic from insert_request
    
    Before commit 18e5a57d7987 ("block, bfq: postpone rq preparation to
    insert or merge"), the destination queue for a request was chosen by a
    different hook than the one that then inserted the request. So, between
    the execution of the two hooks, the bic of the process generating the
    request could happen to be redirected to a different bfq_queue. As a
    consequence, the destination bfq_queue stored in the request could be
    wrong. Such an event does not need to ba handled any longer.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit f3218ad8c6acc9b874060814d6d3ddf154463ac9
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:27 2019 +0100

    block, bfq: make sure queue budgets are not below service received
    
    With some unlucky sequences of events, the function bfq_updated_next_req
    updates the current budget of a bfq_queue to a lower value than the
    service received by the queue using such a budget. Unfortunately, if
    this happens, then the return value of the function bfq_bfqq_budget_left
    becomes inconsistent. This commit solves this problem by lower-bounding
    the budget computed in bfq_updated_next_req to the service currently
    charged to the queue.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 218cb897be6940b8d18eec9bcb32eaa28f1ae8ee
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:26 2019 +0100

    block, bfq: avoid selecting a queue w/o budget
    
    To boost throughput on devices with internal queueing and in scenarios
    where device idling is not strictly needed, bfq immediately starts
    serving a new bfq_queue if the in-service bfq_queue remains without
    pending I/O, even if new I/O may arrive soon for the latter queue. Then,
    if such I/O actually arrives soon, bfq preempts the new in-service
    bfq_queue so as to give the previous queue a chance to go on being
    served (in case the previous queue should actually be the one to be
    served, according to its timestamps).
    
    However, the in-service bfq_queue, say Q, may also be without further
    budget when it remains also pending I/O. Since bfq changes budgets
    dynamically to fit the needs of bfq_queues, this happens more often than
    one may expect. If this happens, then there is no point in trying to go
    on serving Q when new I/O arrives for it soon: Q would be expired
    immediately after being selected for service. This would only cause
    useless overhead. This commit avoids such a useless selection.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 20cd32450bcbec37c6d881b84bdddd8ba047ab01
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 29 12:06:25 2019 +0100

    block, bfq: do not consider interactive queues in srt filtering
    
    The speed at which a bfq_queue receives I/O is one of the parameters by
    which bfq decides whether the queue is soft real-time (i.e., whether the
    queue contains the I/O of a soft real-time application). In particular,
    when a bfq_queue remains without outstanding I/O requests, bfq computes
    the minimum time instant, named soft_rt_next_start, at which the next
    request of the queue may arrive for the queue to be deemed as soft real
    time.
    
    Unfortunately this filtering may cause problems with a queue in
    interactive weight raising. In fact, such a queue may be conveying the
    I/O needed to load a soft real-time application. The latter will
    actually exhibit a soft real-time I/O pattern after it finally starts
    doing its job. But, if soft_rt_next_start is updated for an interactive
    bfq_queue, and the queue has received a lot of service before remaining
    with no outstanding request (likely to happen on a fast device), then
    soft_rt_next_start is assigned such a high value that, for a very long
    time, the queue is prevented from being possibly considered as soft real
    time.
    
    This commit removes the updating of soft_rt_next_start for bfq_queues in
    interactive weight raising.
    
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 22cb4e681523b35f1a0eba40c25ddc1b16898801
Author: Christoph Hellwig <hch@lst.de>
Date:   Mon Jan 14 21:23:30 2019 +0100

    mtip32xx: ѕtop abusing the managed resource APIs
    
    The mtip32xx driver uses managed resources for DMA coherent memory
    and irqs, but then always pairs them with free calls anyway, making
    the resource tracking rather pointless.  Given some DMA allocations
    are transient anyway, the irq freeing seems to require ordering vs
    other hardware access the best solution seems to be to stop using
    the managed resource API entirely.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

commit 20a2e0a7a26ded1db52ca50f88499075b38cbcd7
Author: Jerry Snitselaar <jsnitsel@redhat.com>
Date:   Wed Jan 30 15:06:58 2019 -0700

    tpm: don't return bool from update_timeouts
    
    Set tpm_chip->timeouts_adjusted directly in the update_timeouts
    code instead of returning bool. In case of tpm read failing
    print warning that the read failed and continue on.
    
    Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

commit f0ef022c85a899bcc7a1b3a0955c78a3d7109106
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date:   Tue Jan 29 14:00:17 2019 -0200

    media: vim2m: allow setting the default transaction time via parameter
    
    While there's a control to allow setting it at runtime, as the
    control handler is per file handler, only the application setting
    the m2m device can change it. As this is a custom control, it is
    unlikely that existing apps would be able to set it.
    
    Due to that, and due to the fact that v4l2-mem2mem serializes all
    accesses to a m2m device, trying to setup two GStreamer
    v4l2videoconvert instance at the same time will cause frame drops.
    
    So, add an alternate way of setting its default via a modprobe parameter.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

commit b3e64e5b077841f99a0ab27e99a1c4f942e1dd87
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date:   Tue Jan 29 14:00:16 2019 -0200

    media: vim2m: use per-file handler work queue
    
    It doesn't make sense to have a per-device work queue, as the
    scheduler should be called per file handler. Having a single
    one causes failures if multiple streams are filtered by vim2m.
    
    So, move it to be inside the context structure.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

commit 8aa153f103f10807941bd95dda95071380609e05
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date:   Tue Jan 29 14:00:15 2019 -0200

    media: vim2m: fix driver for it to handle different fourcc formats
    
    Despite vim2m is reporting that it supports RGB565BE and YUYV,
    that's not true.
    
    Right now, it just says that it supports both format, but it
    doesn't actually support them.
    
    Also, horizontal flip is not properly implemented. It sounds
    that it was designed to do a pseudo-horizontal flip using 8
    tiles. Yet, as it doesn't do format conversion, the result
    is a mess.
    
    I suspect that it was done this way in order to save CPU time,
    at the time of OMAP2 days.
    
    That's messy and doesn't really help if someone wants to
    use vim2m to test a pipeline.
    
    Worse than that, the unique RGB format it says it supports is
    RGB565BE, with is not supported by Gstreamer. That prevents
    practical usage of it, even for tests.
    
    So, instead, properly implement fourcc format conversions,
    adding a few more RGB formats:
    
            - RGB and BGR with 24 bits
            - RGB565LE (known as RGB16 at gstreamer)
    
    Also allows using any of the 5 supported formats as either
    capture or output.
    
    Note: The YUYV conversion routines are based on the conversion code
    written by Hans de Goede inside libv4lconvert (part of v4l-utils),
    released under LGPGL 2.1 (GPL 2.0 compatible).
    
    Tested all possible format combinations except for RGB565BE,
    as Gstreamer currently doesn't support it.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

commit fedb5760648a291e949f2380d383b5b2d2749b5e
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Jan 31 17:43:16 2019 +0800

    serial: fix race between flush_to_ldisc and tty_open
    
    There still is a race window after the commit b027e2298bd588
    ("tty: fix data race between tty_init_dev and flush of buf"),
    and we encountered this crash issue if receive_buf call comes
    before tty initialization completes in tty_open and
    tty->driver_data may be NULL.
    
    CPU0                                    CPU1
    ----                                    ----
                                      tty_open
                                       tty_init_dev
                                         tty_ldisc_unlock
                                           schedule
    flush_to_ldisc
     receive_buf
      tty_port_default_receive_buf
       tty_ldisc_receive_buf
        n_tty_receive_buf_common
          __receive_buf
           uart_flush_chars
            uart_start
            /*tty->driver_data is NULL*/
                                       tty->ops->open
                                       /*init tty->driver_data*/
    
    it can be fixed by extending ldisc semaphore lock in tty_init_dev
    to driver_data initialized completely after tty->ops->open(), but
    this will lead to get lock on one function and unlock in some other
    function, and hard to maintain, so fix this race only by checking
    tty->driver_data when receiving, and return if tty->driver_data
    is NULL, and n_tty_receive_buf_common maybe calls uart_unthrottle,
    so add the same check.
    
    Because the tty layer knows nothing about the driver associated with the
    device, the tty layer can not do anything here, it is up to the tty
    driver itself to check for this type of race.  Fix up the serial driver
    to correctly check to see if it is finished binding with the device when
    being called, and if not, abort the tty calls.
    
    [Description and problem report and testing from Li RongQing, I rewrote
    the patch to be in the serial layer, not in the tty core - gregkh]
    
    Reported-by: Li RongQing <lirongqing@baidu.com>
    Tested-by: Li RongQing <lirongqing@baidu.com>
    Signed-off-by: Wang Li <wangli39@baidu.com>
    Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
    Signed-off-by: Li RongQing <lirongqing@baidu.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c6a2583f115acf29a27709ca9ce37714d04fb24
Author: Nathan Chancellor <natechancellor@gmail.com>
Date:   Thu Jan 31 11:06:28 2019 -0700

    serial: mps2-uart: Add parentheses around conditional in mps2_uart_shutdown
    
    Clang warns:
    
    drivers/tty/serial/mps2-uart.c:351:6: warning: logical not is only
    applied to the left hand side of this bitwise operator
    [-Wlogical-not-parentheses]
            if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
                ^                ~
    drivers/tty/serial/mps2-uart.c:351:6: note: add parentheses after the
    '!' to evaluate the bitwise operator first
            if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
                ^
                 (                                       )
    drivers/tty/serial/mps2-uart.c:351:6: note: add parentheses around left
    hand side expression to silence this warning
            if (!mps_port->flags & UART_PORT_COMBINED_IRQ) {
                ^
                (               )
    1 warning generated.
    
    As it was intended for this check to be the inverse of the one at the
    bottom of mps2_init_port, add parentheses around the whole conditional.
    
    Fixes: 775ea4ea2fd9 ("serial: mps2-uart: support combined irq")
    Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
    Acked-by: Vladimir Murzin <vladimir.murzin@arm.com>
    Link: https://github.com/ClangBuiltLinux/linux/issues/344
    Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d84b18f5678d3adfdb9375dfb0d968da2dc753d
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Tue Jan 29 13:56:19 2019 +0300

    devres: always use dev_name() in devm_ioremap_resource()
    
    devm_ioremap_resource() prefers calling devm_request_mem_region() with a
    resource name instead of a device name -- this looks pretty iff a resource
    name isn't specified via a device tree with a "reg-names" property (in this
    case, a resource name is set to a device node's full name), but if it is,
    it doesn't really scale since these names are only unique to a given device
    node, not globally; so, looking at the output of 'cat /proc/iomem', you do
    not have an idea which memory region belongs to which device (see "dirmap",
    "regs", and "wbuf" lines below):
    
    08000000-0bffffff : dirmap
    48000000-bfffffff : System RAM
      48000000-48007fff : reserved
      48080000-48b0ffff : Kernel code
      48b10000-48b8ffff : reserved
      48b90000-48c7afff : Kernel data
      bc6a4000-bcbfffff : reserved
      bcc0f000-bebfffff : reserved
      bec0e000-bec0efff : reserved
      bec11000-bec11fff : reserved
      bec12000-bec14fff : reserved
      bec15000-bfffffff : reserved
    e6050000-e605004f : gpio@e6050000
    e6051000-e605104f : gpio@e6051000
    e6052000-e605204f : gpio@e6052000
    e6053000-e605304f : gpio@e6053000
    e6054000-e605404f : gpio@e6054000
    e6055000-e605504f : gpio@e6055000
    e6060000-e606050b : pin-controller@e6060000
    e6e60000-e6e6003f : e6e60000.serial
    e7400000-e7400fff : ethernet@e7400000
    ee200000-ee2001ff : regs
    ee208000-ee2080ff : wbuf
    
    I think that devm_request_mem_region() should be called with dev_name()
    despite the region names won't look as pretty as before (however, we gain
    more consistency with e.g. the serial driver:
    
    08000000-0bffffff : ee200000.rpc
    48000000-bfffffff : System RAM
      48000000-48007fff : reserved
      48080000-48b0ffff : Kernel code
      48b10000-48b8ffff : reserved
      48b90000-48c7afff : Kernel data
      bc6a4000-bcbfffff : reserved
      bcc0f000-bebfffff : reserved
      bec0e000-bec0efff : reserved
      bec11000-bec11fff : reserved
      bec12000-bec14fff : reserved
      bec15000-bfffffff : reserved
    e6050000-e605004f : e6050000.gpio
    e6051000-e605104f : e6051000.gpio
    e6052000-e605204f : e6052000.gpio
    e6053000-e605304f : e6053000.gpio
    e6054000-e605404f : e6054000.gpio
    e6055000-e605504f : e6055000.gpio
    e6060000-e606050b : e6060000.pin-controller
    e6e60000-e6e6003f : e6e60000.serial
    e7400000-e7400fff : e7400000.ethernet
    ee200000-ee2001ff : ee200000.rpc
    ee208000-ee2080ff : ee200000.rpc
    
    Fixes: 72f8c0bfa0de ("lib: devres: add convenience function to remap a resource")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fa548d79d87fd1ad2a2c4e26f829984a106c6ca5
Author: Mathieu Malaterre <malat@debian.org>
Date:   Wed Jan 23 20:42:00 2019 +0100

    drivers: base: Use __printf markup to silence compiler
    
    Silence warnings (triggered at W=1) by adding relevant __printf
    attributes.
    
      drivers/base/cpu.c:432:2: warning: function '__cpu_device_create' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 095ff29d2b882847f608cf7192361dedc22c0623
Author: Richard Gong <richard.gong@intel.com>
Date:   Wed Jan 23 12:06:05 2019 -0600

    firmware: intel_stratix10_service: add hardware dependency
    
    Add a Kconfig dependency to ensure Intel Stratix10 service layer driver
    can be built only on the platform that supports it.
    
    Signed-off-by: Richard Gong <richard.gong@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d60ea31a87314eb7bea0b2dcbd36cf12bdf9ac0d
Author: Sean Paul <seanpaul@chromium.org>
Date:   Tue Jan 29 14:26:29 2019 -0500

    drm/TODO: Add drm_display_mode.hsync/vrefresh removal
    
    Drivers shouldn't be using these values, add a TODO so someone removes
    them.
    
    Changes in v2:
    - Add drm_display_mode.vrefresh removal (Ville)
    - Add Sam's R-b and bonus points
    Changes in v3:
    - Add hsync removal todo item (Daniel)
    - Change vrefresh wording to make removal less optional
    
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Suggested-by: Daniel Vetter <daniel@ffwll.ch>
    Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
    Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
    Bonus-points-awarded-by: Sam Ravnborg <sam@ravnborg.org>
    Signed-off-by: Sean Paul <seanpaul@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190129192637.73296-1-sean@poorly.run

commit 6fa19f5637a6c22bc0999596bcc83bdcac8a4fa6
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Jan 31 08:47:10 2019 -0800

    rds: fix refcount bug in rds_sock_addref
    
    syzbot was able to catch a bug in rds [1]
    
    The issue here is that the socket might be found in a hash table
    but that its refcount has already be set to 0 by another cpu.
    
    We need to use refcount_inc_not_zero() to be safe here.
    
    [1]
    
    refcount_t: increment on 0; use-after-free.
    WARNING: CPU: 1 PID: 23129 at lib/refcount.c:153 refcount_inc_checked lib/refcount.c:153 [inline]
    WARNING: CPU: 1 PID: 23129 at lib/refcount.c:153 refcount_inc_checked+0x61/0x70 lib/refcount.c:151
    Kernel panic - not syncing: panic_on_warn set ...
    CPU: 1 PID: 23129 Comm: syz-executor3 Not tainted 5.0.0-rc4+ #53
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     __dump_stack lib/dump_stack.c:77 [inline]
     dump_stack+0x1db/0x2d0 lib/dump_stack.c:113
     panic+0x2cb/0x65c kernel/panic.c:214
     __warn.cold+0x20/0x48 kernel/panic.c:571
     report_bug+0x263/0x2b0 lib/bug.c:186
     fixup_bug arch/x86/kernel/traps.c:178 [inline]
     fixup_bug arch/x86/kernel/traps.c:173 [inline]
     do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
     do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:290
     invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
    RIP: 0010:refcount_inc_checked lib/refcount.c:153 [inline]
    RIP: 0010:refcount_inc_checked+0x61/0x70 lib/refcount.c:151
    Code: 1d 51 63 c8 06 31 ff 89 de e8 eb 1b f2 fd 84 db 75 dd e8 a2 1a f2 fd 48 c7 c7 60 9f 81 88 c6 05 31 63 c8 06 01 e8 af 65 bb fd <0f> 0b eb c1 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 54 49
    RSP: 0018:ffff8880a0cbf1e8 EFLAGS: 00010282
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc90006113000
    RDX: 000000000001047d RSI: ffffffff81685776 RDI: 0000000000000005
    RBP: ffff8880a0cbf1f8 R08: ffff888097c9e100 R09: ffffed1015ce5021
    R10: ffffed1015ce5020 R11: ffff8880ae728107 R12: ffff8880723c20c0
    R13: ffff8880723c24b0 R14: dffffc0000000000 R15: ffffed1014197e64
     sock_hold include/net/sock.h:647 [inline]
     rds_sock_addref+0x19/0x20 net/rds/af_rds.c:675
     rds_find_bound+0x97c/0x1080 net/rds/bind.c:82
     rds_recv_incoming+0x3be/0x1430 net/rds/recv.c:362
     rds_loop_xmit+0xf3/0x2a0 net/rds/loop.c:96
     rds_send_xmit+0x1355/0x2a10 net/rds/send.c:355
     rds_sendmsg+0x323c/0x44e0 net/rds/send.c:1368
     sock_sendmsg_nosec net/socket.c:621 [inline]
     sock_sendmsg+0xdd/0x130 net/socket.c:631
     __sys_sendto+0x387/0x5f0 net/socket.c:1788
     __do_sys_sendto net/socket.c:1800 [inline]
     __se_sys_sendto net/socket.c:1796 [inline]
     __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1796
     do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x458089
    Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007fc266df8c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000458089
    RDX: 0000000000000000 RSI: 00000000204b3fff RDI: 0000000000000005
    RBP: 000000000073bf00 R08: 00000000202b4000 R09: 0000000000000010
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc266df96d4
    R13: 00000000004c56e4 R14: 00000000004d94a8 R15: 00000000ffffffff
    
    Fixes: cc4dfb7f70a3 ("rds: fix two RCU related problems")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Cc: Sowmini Varadhan <sowmini.varadhan@oracle.com>
    Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>
    Cc: rds-devel@oss.oracle.com
    Cc: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit e2a2e56e40822ab78e304198387f61314af7d7ce
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Jan 22 15:41:11 2019 +0100

    arm64: dump: no need to check return value of debugfs_create functions
    
    When calling debugfs functions, there is no need to ever check the
    return value.  The function can work or not, but the code logic should
    never do something different based on this.
    
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Cc: Peng Donglin <dolinux.peng@gmail.com>
    Cc: <linux-arm-kernel@lists.infradead.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

commit fc42a689c4c097859e5bd37b5ea11b60dc426df6
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Wed Jan 30 10:42:30 2019 -0800

    lib/test_rhashtable: Make test_insert_dup() allocate its hash table dynamically
    
    The test_insert_dup() function from lib/test_rhashtable.c passes a
    pointer to a stack object to rhltable_init(). Allocate the hash table
    dynamically to avoid that the following is reported with object
    debugging enabled:
    
    ODEBUG: object (ptrval) is on stack (ptrval), but NOT annotated.
    WARNING: CPU: 0 PID: 1 at lib/debugobjects.c:368 __debug_object_init+0x312/0x480
    Modules linked in:
    EIP: __debug_object_init+0x312/0x480
    Call Trace:
     ? debug_object_init+0x1a/0x20
     ? __init_work+0x16/0x30
     ? rhashtable_init+0x1e1/0x460
     ? sched_clock_cpu+0x57/0xe0
     ? rhltable_init+0xb/0x20
     ? test_insert_dup+0x32/0x20f
     ? trace_hardirqs_on+0x38/0xf0
     ? ida_dump+0x10/0x10
     ? jhash+0x130/0x130
     ? my_hashfn+0x30/0x30
     ? test_rht_init+0x6aa/0xab4
     ? ida_dump+0x10/0x10
     ? test_rhltable+0xc5c/0xc5c
     ? do_one_initcall+0x67/0x28e
     ? trace_hardirqs_off+0x22/0xe0
     ? restore_all_kernel+0xf/0x70
     ? trace_hardirqs_on_thunk+0xc/0x10
     ? restore_all_kernel+0xf/0x70
     ? kernel_init_freeable+0x142/0x213
     ? rest_init+0x230/0x230
     ? kernel_init+0x10/0x110
     ? schedule_tail_wrapper+0x9/0xc
     ? ret_from_fork+0x19/0x24
    
    Cc: Thomas Graf <tgraf@suug.ch>
    Cc: Herbert Xu <herbert@gondor.apana.org.au>
    Cc: netdev@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 913564fbc2df0b5061c79fc203f8ddb17b30b78b
Author: Julian Wiedmann <jwi@linux.ibm.com>
Date:   Thu Jan 31 10:48:10 2019 +0100

    macvlan: use netif_is_macvlan_port()
    
    Replace the macvlan_port_exists() macro with its twin from netdevice.h
    
    Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 91c524708de6207f59dd3512518d8a1c7b434ee3
Author: Jacob Wen <jian.w.wen@oracle.com>
Date:   Thu Jan 31 15:18:56 2019 +0800

    l2tp: copy 4 more bytes to linear part if necessary
    
    The size of L2TPv2 header with all optional fields is 14 bytes.
    l2tp_udp_recv_core only moves 10 bytes to the linear part of a
    skb. This may lead to l2tp_recv_common read data outside of a skb.
    
    This patch make sure that there is at least 14 bytes in the linear
    part of a skb to meet the maximum need of l2tp_udp_recv_core and
    l2tp_recv_common. The minimum size of both PPP HDLC-like frame and
    Ethernet frame is larger than 14 bytes, so we are safe to do so.
    
    Also remove L2TP_HDR_SIZE_NOSEQ, it is unused now.
    
    Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
    Suggested-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
    Acked-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 2c2008a63e482654ab137c84d3c61c03b75e7df6
Author: Brian Norris <briannorris@chromium.org>
Date:   Tue Jan 29 15:12:01 2019 -0800

    ath10k: correct bus type for WCN3990
    
    WCN3990 is SNOC, not PCI. This prevents probing WCN3990.
    
    Fixes: 367c899f622c ("ath10k: add bus type check in ath10k_init_hw_params")
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

commit 05672636b339c557feb6a98b2f2034be790aa4fb
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Sun Jan 27 12:15:49 2019 +0100

    mt76x0: eeprom: fix chan_vs_power map in mt76x0_get_power_info
    
    Report correct eeprom per channel power value.
    Fix chan_vs_power map in mt76x0_get_power_info routine
    
    Fixes: f2a2e819d672 ("mt76x0: remove eeprom dependency from mt76x0_get_power_info")
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

commit 34aaaac815d166daef361f49529f4c6b77da49f1
Author: Colin Ian King <colin.king@canonical.com>
Date:   Mon Jan 14 15:48:34 2019 +0000

    ieee802154: mcr20a: fix indentation, remove tabs
    
    The are a couple of statments that are one level too deep, fix this by
    removing tabs.
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>

commit bb16c22a780e92d19bfe9c00f8857ca48bec06f1
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date:   Thu Jan 31 14:17:18 2019 +0100

    arm64: KVM: Describe data or unified caches as having 1 set and 1 way
    
    On SMP ARM systems, cache maintenance by set/way should only ever be
    done in the context of onlining or offlining CPUs, which is typically
    done by bare metal firmware and never in a virtual machine. For this
    reason, we trap set/way cache maintenance operations and replace them
    with conditional flushing of the entire guest address space.
    
    Due to this trapping, the set/way arguments passed into the set/way
    ops are completely ignored, and thus irrelevant. This also means that
    the set/way geometry is equally irrelevant, and we can simply report
    it as 1 set and 1 way, so that legacy 32-bit ARM system software (i.e.,
    the kind that only receives odd fixes) doesn't take a performance hit
    due to the trapping when iterating over the cachelines.
    
    Acked-by: Christoffer Dall <christoffer.dall@arm.com>
    Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

commit cc1335365e1ef0a76f10c6e7919a93cd5c9e2088
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date:   Thu Jan 31 14:17:17 2019 +0100

    arm64: KVM: Expose sanitised cache type register to guest
    
    We currently permit CPUs in the same system to deviate in the exact
    topology of the caches, and we subsequently hide this fact from user
    space by exposing a sanitised value of the cache type register CTR_EL0.
    
    However, guests running under KVM see the bare value of CTR_EL0, which
    could potentially result in issues with, e.g., JITs or other pieces of
    code that are sensitive to misreported cache line sizes.
    
    So let's start trapping cache ID instructions if there is a mismatch,
    and expose the sanitised version of CTR_EL0 to guests. Note that CTR_EL0
    is treated as an invariant to KVM user space, so update that part as well.
    
    Acked-by: Christoffer Dall <christoffer.dall@arm.com>
    Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

commit 32a66374487bbd78115747f0084cea5e8fca4c80
Author: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Date:   Sat Jan 26 10:38:29 2019 -0600

    fpga: stratix10-soc: fix wrong of_node_put() in init function
    
    After finding a "firmware" dt node stratix10 tries to match it's
    compatible string with it. To do so it's calling of_find_matching_node()
    which already takes care of decreasing the refcount on the "firmware"
    node. We are then incorrectly decreasing the refcount on that node
    again.
    
    This patch removes the unwarranted call to of_node_put().
    
    Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
    Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
    Acked-by: Alan Tull <atull@kernel.org>
    Acked-by: Moritz Fischer <mdf@kernel.org>
    [atull: remove unnecessary braces]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b3a6a132dfcb88ca88abe90c2bbb7ba0d382b4d
Author: Andrea Parri <andrea.parri@amarulasolutions.com>
Date:   Thu Jan 31 15:22:19 2019 +0100

    MAINTAINERS: Update cgroup entry
    
    Fix wildcard patterns and add cgroup-v2 documentation.
    
    Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>

commit 51bee5abeab2058ea5813c5615d6197a23dbf041
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Mon Jan 28 17:00:13 2019 +0100

    cgroup/pids: turn cgroup_subsys->free() into cgroup_subsys->release() to fix the accounting
    
    The only user of cgroup_subsys->free() callback is pids_cgrp_subsys which
    needs pids_free() to uncharge the pid.
    
    However, ->free() is called from __put_task_struct()->cgroup_free() and this
    is too late. Even the trivial program which does
    
            for (;;) {
                    int pid = fork();
                    assert(pid >= 0);
                    if (pid)
                            wait(NULL);
                    else
                            exit(0);
            }
    
    can run out of limits because release_task()->call_rcu(delayed_put_task_struct)
    implies an RCU gp after the task/pid goes away and before the final put().
    
    Test-case:
    
            mkdir -p /tmp/CG
            mount -t cgroup2 none /tmp/CG
            echo '+pids' > /tmp/CG/cgroup.subtree_control
    
            mkdir /tmp/CG/PID
            echo 2 > /tmp/CG/PID/pids.max
    
            perl -e 'while ($p = fork) { wait; } $p // die "fork failed: $!\n"' &
            echo $! > /tmp/CG/PID/cgroup.procs
    
    Without this patch the forking process fails soon after migration.
    
    Rename cgroup_subsys->free() to cgroup_subsys->release() and move the callsite
    into the new helper, cgroup_release(), called by release_task() which actually
    frees the pid(s).
    
    Reported-by: Herton R. Krzesinski <hkrzesin@redhat.com>
    Reported-by: Jan Stancek <jstancek@redhat.com>
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>

commit 2b34e562361f6e440524272187432c551b57481e
Author: Imre Deak <imre.deak@intel.com>
Date:   Thu Dec 20 17:52:11 2018 +0200

    drm/i915/icl: Work around broken VBTs for port F detection
    
    VBT may include incorrect information about the presence of port F. Work
    around this on SKUs where we know the port is not present.
    
    v2:
    - Fix IS_ICL_WITH_PORT_F, so it's useable from any context.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108915
    Cc: Mika Kahola <mika.kahola@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20181220155211.31456-1-imre.deak@intel.com

commit 828ccb31cf410a1a01e2bdc2a3cf0dd5aabb755d
Author: Imre Deak <imre.deak@intel.com>
Date:   Mon Jan 28 13:42:42 2019 +0200

    drm/i915/icl: Add TypeC ports only if VBT is present
    
    We can't safely probe Type C ports, whether they are a legacy or a
    USB/Thunderbolt DP Alternate Type C port. This would require performing
    the TypeC connect sequence - as described by the specification - but
    that may have unwanted side-effects. These side-effects include at least
    - without completeness - timeouts during AUX power well enabling and
    subsequent PLL enabling errors.
    
    To safely identify these ports we really need VBT, which has the proper
    flag for this (ddi_vbt_port_info::supports_typec_usb, supports_tbt).
    Based on the above disable Type C ports if we can't load VBT for some
    reason.
    
    v2:
    - Notice that we disable TypeC ports completely and simplify accordingly
      (Jose).
    - Add code comment explaining why we disabled the ports. (Jani)
    
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
    Cc: Jose Roberto de Souza <jose.souza@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190128114242.28666-1-imre.deak@intel.com

commit 3864be551405b582ae38fbcdfdbb6e49052f5f6d
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Wed Jan 30 14:38:11 2019 +0200

    iwlwifi: mvm: fix merge damage in iwl_mvm_rx_mpdu_mq()
    
    A call to iwl_mvm_add_rtap_sniffer_config() was missing due to a merge
    damage when I submitted the patch mentioned below.  And this causes
    the following compilation warning:
    
    drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:195:13: warning: 'iwl_mvm_add_rtap_sniffer_config' defined but not used [-Wunused-function]
     static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fix it by adding the if block that calls this function.
    
    Fixes: 9bf13bee2d74 ("iwlwifi: mvm: include configured sniffer AID in radiotap")
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

commit 24d742a3417e0af9de22a80f34b5fa473914c5f7
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Sun May 1 22:29:58 2016 +0200

    KVM: arm/arm64: Move kvm_is_write_fault to header file
    
    Move this little function to the header files for arm/arm64 so other
    code can make use of it directly.
    
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
    Acked-by: Marc Zyngier <marc.zyngier@arm.com>

commit 71a4f2ccedaf36463913890048cca55d5b69a520
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Fri Jan 4 13:31:22 2019 +0100

    KVM: arm/arm64: Rework the timer code to use a timer_map
    
    We are currently emulating two timers in two different ways.  When we
    add support for nested virtualization in the future, we are going to be
    emulating either two timers in two diffferent ways, or four timers in a
    single way.
    
    We need a unified data structure to keep track of how we map virtual
    state to physical state and we need to cleanup some of the timer code to
    operate more independently on a struct arch_timer_context instead of
    trying to consider the global state of the VCPU and recomputing all
    state.
    
    Co-written with Marc Zyngier <marc.zyngier@arm.com>
    
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>

commit 439105437036672f38dbdcd64d04a378d95c5581
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Tue Sep 18 15:19:33 2018 -0700

    KVM: arm/arm64: arch_timer: Assign the phys timer on VHE systems
    
    VHE systems don't have to emulate the physical timer, we can simply
    assigne the EL1 physical timer directly to the VM as the host always
    uses the EL2 timers.
    
    In order to minimize the amount of cruft, AArch32 gets definitions for
    the physical timer too, but is should be generally unused on this
    architecture.
    
    Co-written with Marc Zyngier <marc.zyngier@arm.com>
    
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>

commit b39baf6f432779e7e2cf85aaf1801c4f57872980
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Tue Sep 18 10:08:18 2018 -0700

    KVM: arm/arm64: timer: Rework data structures for multiple timers
    
    Prepare for having 4 timer data structures (2 for now).
    
    Change loaded to an enum so that we know not just whether *some* state
    is loaded on the CPU, but also *which* state is loaded.
    
    Move loaded to the cpu data structure and not the individual timer
    structure, in preparation for assigning the EL1 phys timer as well.
    
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
    Acked-by: Marc Zyngier <marc.zyngier@arm.com>

commit 3b71337b18bb29325c7016e6690f9d39321d955f
Author: Andre Przywara <andre.przywara@arm.com>
Date:   Thu Jul 5 16:48:23 2018 +0100

    KVM: arm/arm64: consolidate arch timer trap handlers
    
    At the moment we have separate system register emulation handlers for
    each timer register. Actually they are quite similar, and we rely on
    kvm_arm_timer_[gs]et_reg() for the actual emulation anyways, so let's
    just merge all of those handlers into one function, which just marshalls
    the arguments and then hands off to a set of common accessors.
    This makes extending the emulation to include EL2 timers much easier.
    
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    [Fixed 32-bit VM breakage and reduced to reworking existing code]
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
    [Fixed 32bit host, general cleanup]
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

commit 835b8502b65e6bae7e91910299baeded35a597a0
Author: Marc Zyngier <marc.zyngier@arm.com>
Date:   Wed Jan 9 19:18:40 2019 +0000

    KVM: arm64: Reuse sys_reg() macro when searching the trap table
    
    Instead of having an open-coded macro, reuse the sys_reg() macro
    that does the exact same thing (the encoding is slightly different,
    but the ordering property is the same).
    
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Acked-by: Christoffer Dall <christoffer.dall@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>

commit 012f253ab8f6d270dff32978c8cd49bf8f9700af
Author: Marc Zyngier <marc.zyngier@arm.com>
Date:   Fri Jan 4 11:33:42 2019 +0100

    KVM: arm64: Fix ICH_ELRSR_EL2 sysreg naming
    
    We previously incorrectly named the define for this system register.
    
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>

commit 5d4a3bd032f1511a2a05f9bafa7f146ca411b630
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Mon Nov 26 18:21:22 2018 +0100

    KVM: arm/arm64: Simplify bg_timer programming
    
    Instead of calling into kvm_timer_[un]schedule from the main kvm
    blocking path, test if the VCPU is on the wait queue from the load/put
    path and perform the background timer setup/cancel in this path.
    
    This has the distinct advantage that we no longer race between load/put
    and schedule/unschedule and programming and canceling of the bg_timer
    always happens when the timer state is not loaded.
    
    Note that we must now remove the checks in kvm_timer_blocking that do
    not schedule a background timer if one of the timers can fire, because
    we no longer have a guarantee that kvm_vcpu_check_block() will be called
    before kvm_timer_blocking.
    
    Reported-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

commit 3e6cb42d0c31b459615bc8f397b87732f8d18d56
Author: Christoffer Dall <christoffer.dall@arm.com>
Date:   Tue Dec 11 15:26:31 2018 +0100

    KVM: arm/arm64: Factor out VMID into struct kvm_vmid
    
    In preparation for nested virtualization where we are going to have more
    than a single VMID per VM, let's factor out the VMID data into a
    separate VMID data structure and change the VMID allocator to operate on
    this new structure instead of using a struct kvm.
    
    This also means that udate_vttbr now becomes update_vmid, and that the
    vttbr itself is generated on the fly based on the stage 2 page table
    base address and the vmid.
    
    We cache the physical address of the pgd when allocating the pgd to
    avoid doing the calculation on every entry to the guest and to avoid
    calling into potentially non-hyp-mapped code from hyp/EL2.
    
    If we wanted to merge the VMID allocator with the arm64 ASID allocator
    at some point in the future, it should actually become easier to do that
    after this patch.
    
    Note that to avoid mapping the kvm_vmid_bits variable into hyp, we
    simply forego the masking of the vmid value in kvm_get_vttbr and rely on
    update_vmid to always assign a valid vmid value (within the supported
    range).
    
    Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
    [maz: minor cleanups]
    Reviewed-by: Julien Thierry <julien.thierry@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>

commit 57ea974fb8717864e8b7ec679363c5a3298a165e
Author: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Date:   Tue Jan 22 10:39:52 2019 -0800

    driver core: Rewrite test_async_driver_probe to cover serialization and NUMA affinity
    
    The current async_probe test code is only testing one device allocated
    prior to driver load and only loading one device afterwards. Instead of
    doing things this way it makes much more sense to load one device per CPU
    in order to actually stress the async infrastructure. By doing this we
    should see delays significantly increase in the event of devices being
    serialized.
    
    In addition I have updated the test to verify that we are trying to place
    the work on the correct NUMA node when we are running in async mode. By
    doing this we can verify the best possible outcome for device and driver
    load times.
    
    I have added a timeout value that is used to disable the sleep and instead
    cause the probe routine to report an error indicating it timed out. By
    doing this we limit the maximum runtime for the test to 20 seconds or less.
    
    The last major change in this set is that I have gone through and tuned it
    for handling the massive number of possible events that will be scheduled.
    Instead of reporting the sleep for each individual device it is moved to
    only being displayed if we enable debugging.
    
    With this patch applied below are what a failing test and a passing test
    should look like. I elided a few hundred lines in the failing test that
    were duplicated since the system I was testing on had a massive number of
    CPU cores:
    
    -- Failing --
    [  243.524697] test_async_driver_probe: registering first set of asynchronous devices...
    [  243.535625] test_async_driver_probe: registering asynchronous driver...
    [  243.543038] test_async_driver_probe: registration took 0 msecs
    [  243.549559] test_async_driver_probe: registering second set of asynchronous devices...
    [  243.568350] platform test_async_driver.447: registration took 9 msecs
    [  243.575544] test_async_driver_probe: registering first synchronous device...
    [  243.583454] test_async_driver_probe: registering synchronous driver...
    [  248.825920] test_async_driver_probe: registration took 5235 msecs
    [  248.825922] test_async_driver_probe: registering second synchronous device...
    [  248.825928] test_async_driver test_async_driver.443: NUMA node mismatch 3 != 1
    [  248.825932] test_async_driver test_async_driver.445: NUMA node mismatch 3 != 1
    [  248.825935] test_async_driver test_async_driver.446: NUMA node mismatch 3 != 1
    [  248.825939] test_async_driver test_async_driver.440: NUMA node mismatch 3 != 1
    [  248.825943] test_async_driver test_async_driver.441: NUMA node mismatch 3 != 1
    ...
    [  248.827150] test_async_driver test_async_driver.229: NUMA node mismatch 0 != 1
    [  248.827158] test_async_driver test_async_driver.228: NUMA node mismatch 0 != 1
    [  248.827220] test_async_driver test_async_driver.281: NUMA node mismatch 2 != 1
    [  248.827229] test_async_driver test_async_driver.282: NUMA node mismatch 2 != 1
    [  248.827240] test_async_driver test_async_driver.280: NUMA node mismatch 2 != 1
    [  253.945834] test_async_driver test_async_driver.1: NUMA node mismatch 0 != 1
    [  253.945878] test_sync_driver test_sync_driver.1: registration took 5119 msecs
    [  253.961693] test_async_driver_probe: async events still pending, forcing timeout and synchronize
    [  259.065839] test_async_driver test_async_driver.2: NUMA node mismatch 0 != 1
    [  259.073786] test_async_driver test_async_driver.3: async probe took too long
    [  259.081669] test_async_driver test_async_driver.3: NUMA node mismatch 0 != 1
    [  259.089569] test_async_driver test_async_driver.4: async probe took too long
    [  259.097451] test_async_driver test_async_driver.4: NUMA node mismatch 0 != 1
    [  259.105338] test_async_driver test_async_driver.5: async probe took too long
    [  259.113204] test_async_driver test_async_driver.5: NUMA node mismatch 0 != 1
    [  259.121089] test_async_driver test_async_driver.6: async probe took too long
    [  259.128961] test_async_driver test_async_driver.6: NUMA node mismatch 0 != 1
    [  259.136850] test_async_driver test_async_driver.7: async probe took too long
    ...
    [  262.124062] test_async_driver test_async_driver.221: async probe took too long
    [  262.132130] test_async_driver test_async_driver.221: NUMA node mismatch 3 != 1
    [  262.140206] test_async_driver test_async_driver.222: async probe took too long
    [  262.148277] test_async_driver test_async_driver.222: NUMA node mismatch 3 != 1
    [  262.156351] test_async_driver test_async_driver.223: async probe took too long
    [  262.164419] test_async_driver test_async_driver.223: NUMA node mismatch 3 != 1
    [  262.172630] test_async_driver_probe: Test failed with 222 errors and 336 warnings
    
    -- Passing --
    [  105.419247] test_async_driver_probe: registering first set of asynchronous devices...
    [  105.432040] test_async_driver_probe: registering asynchronous driver...
    [  105.439718] test_async_driver_probe: registration took 0 msecs
    [  105.446239] test_async_driver_probe: registering second set of asynchronous devices...
    [  105.477986] platform test_async_driver.447: registration took 22 msecs
    [  105.485276] test_async_driver_probe: registering first synchronous device...
    [  105.493169] test_async_driver_probe: registering synchronous driver...
    [  110.597981] test_async_driver_probe: registration took 5097 msecs
    [  110.604806] test_async_driver_probe: registering second synchronous device...
    [  115.707490] test_sync_driver test_sync_driver.1: registration took 5094 msecs
    [  115.715478] test_async_driver_probe: completed successfully
    
    Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af87b9a7863c7bb47f8bd015c0ce4a37d70c5225
Author: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Date:   Tue Jan 22 10:39:47 2019 -0800

    libnvdimm: Schedule device registration on node local to the device
    
    Force the device registration for nvdimm devices to be closer to the actual
    device. This is achieved by using either the NUMA node ID of the region, or
    of the parent. By doing this we can have everything above the region based
    on the region, and everything below the region based on the nvdimm bus.
    
    By guaranteeing NUMA locality I see an improvement of as high as 25% for
    per-node init of a system with 12TB of persistent memory.
    
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8b9ec6b732775849f506aa6c2649e626e82a297c
Author: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Date:   Tue Jan 22 10:39:42 2019 -0800

    PM core: Use new async_schedule_dev command
    
    Use the device specific version of the async_schedule commands to defer
    various tasks related to power management. By doing this we should see a
    slight improvement in performance as any device that is sensitive to
    latency/locality in the setup will now be initializing on the node closest
    to the device.
    
    Reviewed-by: Dan Williams <dan.j.williams@intel.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c37e20eaf4b21125898fd454f3ea6b212865d0a6
Author: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Date:   Tue Jan 22 10:39:37 2019 -0800

    driver core: Attach devices on CPU local to device node
    
    Call the asynchronous probe routines on a CPU local to the device node. By
    doing this we should be able to improve our initialization time
    significantly as we can avoid having to access the device from a remote
    node which may introduce higher latency.
    
    For example, in the case of initializing memory for NVDIMM this can have a
    significant impact as initialing 3TB on remote node can take up to 39
    seconds while initialing it on a local node only takes 23 seconds. It is
    situations like this where we will see the biggest improvement.
    
    Reviewed-by: Dan Williams <dan.j.williams@intel.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6be9238e5cb64741ff95c3ae440b112753ad93de
Author: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Date:   Tue Jan 22 10:39:31 2019 -0800

    async: Add support for queueing on specific NUMA node
    
    Introduce four new variants of the async_schedule_ functions that allow
    scheduling on a specific NUMA node.
    
    The first two functions are async_schedule_near and
    async_schedule_near_domain end up mapping to async_schedule and
    async_schedule_domain, but provide NUMA node specific functionality. They
    replace the original functions which were moved to inline function
    definitions that call the new functions while passing NUMA_NO_NODE.
    
    The second two functions are async_schedule_dev and
    async_schedule_dev_domain which provide NUMA specific functionality when
    passing a device a…
nathanchance pushed a commit that referenced this issue Jul 11, 2019
During a perf session we try to allocate buffers on the "node" associated
with the CPU the event is bound to. If it's not bound to a CPU, we use
the current CPU node, using smp_processor_id(). However this is unsafe
in a pre-emptible context and could generate the splats as below :

 BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743
 caller is alloc_etr_buf.isra.6+0x80/0xa0
 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344
 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb  1 2019
  Call trace:
   dump_backtrace+0x0/0x150
   show_stack+0x14/0x20
   dump_stack+0x9c/0xc4
   debug_smp_processor_id+0x10c/0x110
   alloc_etr_buf.isra.6+0x80/0xa0
   tmc_alloc_etr_buffer+0x12c/0x1f0
   etm_setup_aux+0x1c4/0x230
   rb_alloc_aux+0x1b8/0x2b8
   perf_mmap+0x35c/0x478
   mmap_region+0x34c/0x4f0
   do_mmap+0x2d8/0x418
   vm_mmap_pgoff+0xd0/0xf8
   ksys_mmap_pgoff+0x88/0xf8
   __arm64_sys_mmap+0x28/0x38
   el0_svc_handler+0xd8/0x138
   el0_svc+0x8/0xc

Use NUMA_NO_NODE hint instead of using the current node for events
not bound to CPUs.

Fixes: 855ab61 ("coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20190620221237.3536-2-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
nathanchance pushed a commit that referenced this issue Jul 11, 2019
… preemptible

During a perf session we try to allocate buffers on the "node" associated
with the CPU the event is bound to. If it is not bound to a CPU, we
use the current CPU node, using smp_processor_id(). However this is unsafe
in a pre-emptible context and could generate the splats as below :

 BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743
 caller is tmc_alloc_etr_buffer+0x1bc/0x1f0
 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344
 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb  1 2019
 Call trace:
  dump_backtrace+0x0/0x150
  show_stack+0x14/0x20
  dump_stack+0x9c/0xc4
  debug_smp_processor_id+0x10c/0x110
  tmc_alloc_etr_buffer+0x1bc/0x1f0
  etm_setup_aux+0x1c4/0x230
  rb_alloc_aux+0x1b8/0x2b8
  perf_mmap+0x35c/0x478
  mmap_region+0x34c/0x4f0
  do_mmap+0x2d8/0x418
  vm_mmap_pgoff+0xd0/0xf8
  ksys_mmap_pgoff+0x88/0xf8
  __arm64_sys_mmap+0x28/0x38
  el0_svc_handler+0xd8/0x138
  el0_svc+0x8/0xc

Use NUMA_NO_NODE hint instead of using the current node for events
not bound to CPUs.

Fixes: 22f429f ("coresight: etm-perf: Add support for ETR backend")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: stable <stable@vger.kernel.org> # 4.20+
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20190620221237.3536-3-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
nathanchance pushed a commit that referenced this issue Jul 11, 2019
During a perf session we try to allocate buffers on the "node" associated
with the CPU the event is bound to. If it is not bound to a CPU, we
use the current CPU node, using smp_processor_id(). However this is unsafe
in a pre-emptible context and could generate the splats as below :

 BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544
 caller is tmc_alloc_etf_buffer+0x5c/0x60
 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344
 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb  1 2019
 Call trace:
  dump_backtrace+0x0/0x150
  show_stack+0x14/0x20
  dump_stack+0x9c/0xc4
  debug_smp_processor_id+0x10c/0x110
  tmc_alloc_etf_buffer+0x5c/0x60
  etm_setup_aux+0x1c4/0x230
  rb_alloc_aux+0x1b8/0x2b8
  perf_mmap+0x35c/0x478
  mmap_region+0x34c/0x4f0
  do_mmap+0x2d8/0x418
  vm_mmap_pgoff+0xd0/0xf8
  ksys_mmap_pgoff+0x88/0xf8
  __arm64_sys_mmap+0x28/0x38
  el0_svc_handler+0xd8/0x138
  el0_svc+0x8/0xc

Use NUMA_NO_NODE hint instead of using the current node for events
not bound to CPUs.

Fixes: 2e499bb ("coresight: tmc: implementing TMC-ETF AUX space API")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: stable <stable@vger.kernel.org> # 4.7+
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20190620221237.3536-4-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wlogical-not-parentheses [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle
Projects
None yet
Development

No branches or pull requests

1 participant