All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Schneider-Pargmann <msp@baylibre.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	Chandrasekar Ramakrishnan <rcsekar@samsung.com>,
	Wolfgang Grandegger <wg@grandegger.com>
Cc: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>,
	Simon Horman <simon.horman@corigine.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Markus Schneider-Pargmann <msp@baylibre.com>
Subject: [PATCH v3 00/16] can: m_can: Optimizations for m_can/tcan part 2
Date: Wed, 15 Mar 2023 12:05:30 +0100	[thread overview]
Message-ID: <20230315110546.2518305-1-msp@baylibre.com> (raw)

Hi Marc and everyone,

third version part 2, functionally I had to move from spin_lock to
spin_lock_irqsave because of an interrupt that was calling start_xmit,
see attached stack. This is tested on tcan455x but I don't have the
integrated hardware myself so any testing is appreciated.

The series implements many small and bigger throughput improvements and
adds rx/tx coalescing at the end.

Best,
Markus

Changes in v3:
- Remove parenthesis in error messages
- Use memcpy_and_pad for buffer copy in 'can: m_can: Write transmit
  header and data in one transaction'.
- Replace spin_lock with spin_lock_irqsave. I got a report of a
  interrupt that was calling start_xmit just after the netqueue was
  woken up before the locked region was exited. spin_lock_irqsave should
  fix this. I attached the full stack at the end of the mail if someone
  wants to know.
- Rebased to v6.3-rc1.
- Removed tcan4x5x patches from this series.

Changes in v2:
- Rebased on v6.2-rc5
- Fixed missing/broken accounting for non peripheral m_can devices.

part 1:
v1 - https://lore.kernel.org/lkml/20221116205308.2996556-1-msp@baylibre.com
v2 - https://lore.kernel.org/lkml/20221206115728.1056014-1-msp@baylibre.com

part 2:
v1 - https://lore.kernel.org/lkml/20221221152537.751564-1-msp@baylibre.com
v2 - https://lore.kernel.org/lkml/20230125195059.630377-1-msp@baylibre.com

stack of calling start_xmit within locked region:
	[  308.170171]  dump_backtrace+0x0/0x1a0
	[  308.173841]  show_stack+0x18/0x70
	[  308.177158]  sched_show_task+0x154/0x180
	[  308.181084]  dump_cpu_task+0x44/0x54
	[  308.184664]  rcu_dump_cpu_stacks+0xe8/0x12c
	[  308.188846]  rcu_sched_clock_irq+0x9f4/0xd10
	[  308.193118]  update_process_times+0x9c/0xec
	[  308.197304]  tick_sched_handle+0x34/0x60
	[  308.201231]  tick_sched_timer+0x4c/0xa4
	[  308.205071]  __hrtimer_run_queues+0x138/0x1e0
	[  308.209429]  hrtimer_interrupt+0xe8/0x244
	[  308.213440]  arch_timer_handler_phys+0x38/0x50
	[  308.217890]  handle_percpu_devid_irq+0x84/0x130
	[  308.222422]  handle_domain_irq+0x60/0x90
	[  308.226347]  gic_handle_irq+0x54/0x130
	[  308.230099]  do_interrupt_handler+0x34/0x60
	[  308.234286]  el1_interrupt+0x30/0x80
	[  308.237861]  el1h_64_irq_handler+0x18/0x24
	[  308.241958]  el1h_64_irq+0x78/0x7c
	[  308.245360]  queued_spin_lock_slowpath+0xf4/0x390
	[  308.250067]  m_can_start_tx+0x20/0xb0 [m_can]
	[  308.254431]  m_can_start_xmit+0xd8/0x230 [m_can]
	[  308.259054]  dev_hard_start_xmit+0xd4/0x15c
	[  308.263241]  sch_direct_xmit+0xe8/0x370
	[  308.267080]  __qdisc_run+0x118/0x650
	[  308.270660]  net_tx_action+0x118/0x230
	[  308.274409]  _stext+0x124/0x2a0
	[  308.277549]  __irq_exit_rcu+0xe4/0x100
	[  308.281302]  irq_exit+0x10/0x20
	[  308.284444]  handle_domain_irq+0x64/0x90
	[  308.288367]  gic_handle_irq+0x54/0x130
	[  308.292119]  call_on_irq_stack+0x2c/0x54
	[  308.296043]  do_interrupt_handler+0x54/0x60
	[  308.300228]  el1_interrupt+0x30/0x80
	[  308.303804]  el1h_64_irq_handler+0x18/0x24
	[  308.307901]  el1h_64_irq+0x78/0x7c
	[  308.311303]  __netif_schedule+0x78/0xa0
	[  308.315138]  netif_tx_wake_queue+0x50/0x7c
	[  308.319237]  m_can_isr+0x474/0x1710 [m_can]
	[  308.323425]  irq_thread_fn+0x2c/0x9c
	[  308.327005]  irq_thread+0x178/0x2c0
	[  308.330497]  kthread+0x150/0x160
	[  308.333727]  ret_from_fork+0x10/0x20

Markus Schneider-Pargmann (16):
  can: m_can: Remove repeated check for is_peripheral
  can: m_can: Always acknowledge all interrupts
  can: m_can: Remove double interrupt enable
  can: m_can: Disable unused interrupts
  can: m_can: Keep interrupts enabled during peripheral read
  can: m_can: Write transmit header and data in one transaction
  can: m_can: Implement receive coalescing
  can: m_can: Implement transmit coalescing
  can: m_can: Add rx coalescing ethtool support
  can: m_can: Add tx coalescing ethtool support
  can: m_can: Cache tx putidx
  can: m_can: Use the workqueue as queue
  can: m_can: Introduce a tx_fifo_in_flight counter
  can: m_can: Use tx_fifo_in_flight for netif_queue control
  can: m_can: Implement BQL
  can: m_can: Implement transmit submission coalescing

 drivers/net/can/m_can/m_can.c | 503 ++++++++++++++++++++++++++--------
 drivers/net/can/m_can/m_can.h |  35 ++-
 2 files changed, 415 insertions(+), 123 deletions(-)

-- 
2.39.2


             reply	other threads:[~2023-03-15 11:06 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 11:05 Markus Schneider-Pargmann [this message]
2023-03-15 11:05 ` [PATCH v3 01/16] can: m_can: Remove repeated check for is_peripheral Markus Schneider-Pargmann
2023-03-16  9:06   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 02/16] can: m_can: Always acknowledge all interrupts Markus Schneider-Pargmann
2023-03-16  9:08   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 03/16] can: m_can: Remove double interrupt enable Markus Schneider-Pargmann
2023-03-16  9:09   ` Simon Horman
2023-03-16  9:10     ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 04/16] can: m_can: Disable unused interrupts Markus Schneider-Pargmann
2023-03-16  9:15   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 05/16] can: m_can: Keep interrupts enabled during peripheral read Markus Schneider-Pargmann
2023-03-16 10:03   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 06/16] can: m_can: Write transmit header and data in one transaction Markus Schneider-Pargmann
2023-03-16  9:27   ` Simon Horman
2023-06-19 11:46     ` Markus Schneider-Pargmann
2023-03-24 18:32   ` Marc Kleine-Budde
2023-03-15 11:05 ` [PATCH v3 07/16] can: m_can: Implement receive coalescing Markus Schneider-Pargmann
2023-03-16 10:04   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 08/16] can: m_can: Implement transmit coalescing Markus Schneider-Pargmann
2023-03-16 10:05   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 09/16] can: m_can: Add rx coalescing ethtool support Markus Schneider-Pargmann
2023-03-16 10:05   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 10/16] can: m_can: Add tx " Markus Schneider-Pargmann
2023-03-16 10:06   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 11/16] can: m_can: Cache tx putidx Markus Schneider-Pargmann
2023-03-16  9:55   ` Simon Horman
2023-03-16 10:08     ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 12/16] can: m_can: Use the workqueue as queue Markus Schneider-Pargmann
2023-03-17 16:18   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 13/16] can: m_can: Introduce a tx_fifo_in_flight counter Markus Schneider-Pargmann
2023-03-17 16:02   ` Simon Horman
2023-06-20 12:53     ` Markus Schneider-Pargmann
2023-06-21 13:50       ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 14/16] can: m_can: Use tx_fifo_in_flight for netif_queue control Markus Schneider-Pargmann
2023-03-17 16:04   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 15/16] can: m_can: Implement BQL Markus Schneider-Pargmann
2023-03-17 16:05   ` Simon Horman
2023-03-15 11:05 ` [PATCH v3 16/16] can: m_can: Implement transmit submission coalescing Markus Schneider-Pargmann
2023-03-24 18:32 ` [PATCH v3 00/16] can: m_can: Optimizations for m_can/tcan part 2 Marc Kleine-Budde
2023-04-12  8:33   ` Markus Schneider-Pargmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315110546.2518305-1-msp@baylibre.com \
    --to=msp@baylibre.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=rcsekar@samsung.com \
    --cc=simon.horman@corigine.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.