1. 03 Jun, 2020 30 commits
  2. 27 May, 2020 10 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.19.125 · 2d16cf48
      Greg Kroah-Hartman authored
      2d16cf48
    • David Howells's avatar
      rxrpc: Fix ack discard · 32eff2f2
      David Howells authored
      [ Upstream commit 441fdee1 ]
      
      The Rx protocol has a "previousPacket" field in it that is not handled in
      the same way by all protocol implementations.  Sometimes it contains the
      serial number of the last DATA packet received, sometimes the sequence
      number of the last DATA packet received and sometimes the highest sequence
      number so far received.
      
      AF_RXRPC is using this to weed out ACKs that are out of date (it's possible
      for ACK packets to get reordered on the wire), but this does not work with
      OpenAFS which will just stick the sequence number of the last packet seen
      into previousPacket.
      
      The issue being seen is that big AFS FS.StoreData RPC (eg. of ~256MiB) are
      timing out when partly sent.  A trace was captured, with an additional
      tracepoint to show ACKs being discarded in rxrpc_input_ack().  Here's an
      excerpt showing the problem.
      
       52873.203230: rxrpc_tx_data: c=000004ae DATA ed1a3584:00000002 0002449c q=00024499 fl=09
      
      A DATA packet with sequence number 00024499 has been transmitted (the "q="
      field).
      
       ...
       52873.243296: rxrpc_rx_ack: c=000004ae 00012a2b DLY r=00024499 f=00024497 p=00024496 n=0
       52873.243376: rxrpc_rx_ack: c=000004ae 00012a2c IDL r=0002449b f=00024499 p=00024498 n=0
       52873.243383: rxrpc_rx_ack: c=000004ae 00012a2d OOS r=0002449d f=00024499 p=0002449a n=2
      
      The Out-Of-Sequence ACK indicates that the server didn't see DATA sequence
      number 00024499, but did see seq 0002449a (previousPacket, shown as "p=",
      skipped the number, but firstPacket, "f=", which shows the bottom of the
      window is set at that point).
      
       52873.252663: rxrpc_retransmit: c=000004ae q=24499 a=02 xp=14581537
       52873.252664: rxrpc_tx_data: c=000004ae DATA ed1a3584:00000002 000244bc q=00024499 fl=0b *RETRANS*
      
      The packet has been retransmitted.  Retransmission recurs until the peer
      says it got the packet.
      
       52873.271013: rxrpc_rx_ack: c=000004ae 00012a31 OOS r=000244a1 f=00024499 p=0002449e n=6
      
      More OOS ACKs indicate that the other packets that are already in the
      transmission pipeline are being received.  The specific-ACK list is up to 6
      ACKs and NAKs.
      
       ...
       52873.284792: rxrpc_rx_ack: c=000004ae 00012a49 OOS r=000244b9 f=00024499 p=000244b6 n=30
       52873.284802: rxrpc_retransmit: c=000004ae q=24499 a=0a xp=63505500
       52873.284804: rxrpc_tx_data: c=000004ae DATA ed1a3584:00000002 000244c2 q=00024499 fl=0b *RETRANS*
       52873.287468: rxrpc_rx_ack: c=000004ae 00012a4a OOS r=000244ba f=00024499 p=000244b7 n=31
       52873.287478: rxrpc_rx_ack: c=000004ae 00012a4b OOS r=000244bb f=00024499 p=000244b8 n=32
      
      At this point, the server's receive window is full (n=32) with presumably 1
      NAK'd packet and 31 ACK'd packets.  We can't transmit any more packets.
      
       52873.287488: rxrpc_retransmit: c=000004ae q=24499 a=0a xp=61327980
       52873.287489: rxrpc_tx_data: c=000004ae DATA ed1a3584:00000002 000244c3 q=00024499 fl=0b *RETRANS*
       52873.293850: rxrpc_rx_ack: c=000004ae 00012a4c DLY r=000244bc f=000244a0 p=00024499 n=25
      
      And now we've received an ACK indicating that a DATA retransmission was
      received.  7 packets have been processed (the occupied part of the window
      moved, as indicated by f= and n=).
      
       52873.293853: rxrpc_rx_discard_ack: c=000004ae r=00012a4c 000244a0<00024499 00024499<000244b8
      
      However, the DLY ACK gets discarded because its previousPacket has gone
      backwards (from p=000244b8, in the ACK at 52873.287478 to p=00024499 in the
      ACK at 52873.293850).
      
      We then end up in a continuous cycle of retransmit/discard.  kafs fails to
      update its window because it's discarding the ACKs and can't transmit an
      extra packet that would clear the issue because the window is full.
      OpenAFS doesn't change the previousPacket value in the ACKs because no new
      DATA packets are received with a different previousPacket number.
      
      Fix this by altering the discard check to only discard an ACK based on
      previousPacket if there was no advance in the firstPacket.  This allows us
      to transmit a new packet which will cause previousPacket to advance in the
      next ACK.
      
      The check, however, needs to allow for the possibility that previousPacket
      may actually have had the serial number placed in it instead - in which
      case it will go outside the window and we should ignore it.
      
      Fixes: 1a2391c3 ("rxrpc: Fix detection of out of order acks")
      Reported-by: default avatarDave Botsch <botsch@cnf.cornell.edu>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      32eff2f2
    • David Howells's avatar
      rxrpc: Trace discarded ACKs · db7a934a
      David Howells authored
      [ Upstream commit d1f12947 ]
      
      Add a tracepoint to track received ACKs that are discarded due to being
      outside of the Tx window.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db7a934a
    • Fabrice Gasnier's avatar
      iio: adc: stm32-dfsdm: fix device used to request dma · d268f8dd
      Fabrice Gasnier authored
      [ Upstream commit b455d06e ]
      
      DMA channel request should use device struct from platform device struct.
      Currently it's using iio device struct. But at this stage when probing,
      device struct isn't yet registered (e.g. device_register is done in
      iio_device_register). Since commit 71723a96 ("dmaengine: Create
      symlinks between DMA channels and slaves"), a warning message is printed
      as the links in sysfs can't be created, due to device isn't yet registered:
      - Cannot create DMA slave symlink
      - Cannot create DMA dma:rx symlink
      
      Fix this by using device struct from platform device to request dma chan.
      
      Fixes: eca94980 ("IIO: ADC: add stm32 DFSDM support for PDM microphone")
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d268f8dd
    • Peter Ujfalusi's avatar
      iio: adc: stm32-dfsdm: Use dma_request_chan() instead dma_request_slave_channel() · ae862e35
      Peter Ujfalusi authored
      [ Upstream commit a9ab624e ]
      
      dma_request_slave_channel() is a wrapper on top of dma_request_chan()
      eating up the error code.
      
      By using dma_request_chan() directly the driver can support deferred
      probing against DMA.
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Acked-by: default avatarOlivier Moysan <olivier.moysan@st.com>
      Acked-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae862e35
    • Fabrice Gasnier's avatar
      iio: adc: stm32-adc: fix device used to request dma · 90af01f6
      Fabrice Gasnier authored
      [ Upstream commit 52cd91c2 ]
      
      DMA channel request should use device struct from platform device struct.
      Currently it's using iio device struct. But at this stage when probing,
      device struct isn't yet registered (e.g. device_register is done in
      iio_device_register). Since commit 71723a96 ("dmaengine: Create
      symlinks between DMA channels and slaves"), a warning message is printed
      as the links in sysfs can't be created, due to device isn't yet registered:
      - Cannot create DMA slave symlink
      - Cannot create DMA dma:rx symlink
      
      Fix this by using device struct from platform device to request dma chan.
      
      Fixes: 2763ea05 ("iio: adc: stm32: add optional dma support")
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      90af01f6
    • Peter Ujfalusi's avatar
      iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() · cdaedaba
      Peter Ujfalusi authored
      [ Upstream commit 735404b8 ]
      
      dma_request_slave_channel() is a wrapper on top of dma_request_chan()
      eating up the error code.
      
      By using dma_request_chan() directly the driver can support deferred
      probing against DMA.
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Acked-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cdaedaba
    • Josh Poimboeuf's avatar
      x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks · 754254da
      Josh Poimboeuf authored
      commit 187b96db upstream.
      
      Normally, show_trace_log_lvl() scans the stack, looking for text
      addresses to print.  In parallel, it unwinds the stack with
      unwind_next_frame().  If the stack address matches the pointer returned
      by unwind_get_return_address_ptr() for the current frame, the text
      address is printed normally without a question mark.  Otherwise it's
      considered a breadcrumb (potentially from a previous call path) and it's
      printed with a question mark to indicate that the address is unreliable
      and typically can be ignored.
      
      Since the following commit:
      
        f1d9a2ab ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
      
      ... for inactive tasks, show_trace_log_lvl() prints *only* unreliable
      addresses (prepended with '?').
      
      That happens because, for the first frame of an inactive task,
      unwind_get_return_address_ptr() returns the wrong return address
      pointer: one word *below* the task stack pointer.  show_trace_log_lvl()
      starts scanning at the stack pointer itself, so it never finds the first
      'reliable' address, causing only guesses to being printed.
      
      The first frame of an inactive task isn't a normal stack frame.  It's
      actually just an instance of 'struct inactive_task_frame' which is left
      behind by __switch_to_asm().  Now that this inactive frame is actually
      exposed to callers, fix unwind_get_return_address_ptr() to interpret it
      properly.
      
      Fixes: f1d9a2ab ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
      Reported-by: default avatarTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200522135435.vbxs7umku5pyrdbk@trebleSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      754254da
    • Qiushi Wu's avatar
      rxrpc: Fix a memory leak in rxkad_verify_response() · e7980748
      Qiushi Wu authored
      commit f45d01f4 upstream.
      
      A ticket was not released after a call of the function
      "rxkad_decrypt_ticket" failed. Thus replace the jump target
      "temporary_error_free_resp" by "temporary_error_free_ticket".
      
      Fixes: 8c2f826d ("rxrpc: Don't put crypto buffers on the stack")
      Signed-off-by: default avatarQiushi Wu <wu000273@umn.edu>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Markus Elfring <Markus.Elfring@web.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7980748
    • John Hubbard's avatar
      rapidio: fix an error in get_user_pages_fast() error handling · 0ce2f76e
      John Hubbard authored
      commit ffca476a upstream.
      
      In the case of get_user_pages_fast() returning fewer pages than
      requested, rio_dma_transfer() does not quite do the right thing.  It
      attempts to release all the pages that were requested, rather than just
      the pages that were pinned.
      
      Fix the error handling so that only the pages that were successfully
      pinned are released.
      
      Fixes: e8de3701 ("rapidio: add mport char device driver")
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Alexandre Bounine <alex.bou9@gmail.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200517235620.205225-2-jhubbard@nvidia.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ce2f76e