Re: [PATCH 2/6] bus: mhi: add support to allocate rddm memory during crash time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/28/2024 7:40 AM, Gokul Sriram P wrote:

On 7/18/2024 9:52 PM, Jeffrey Hugo wrote:
On 7/18/2024 12:13 AM, Gokul Sriram Palanisamy wrote:
From: Ram Kumar D <quic_ramd@xxxxxxxxxxx>

Currently, MHI bus pre-allocates the RDDM buffer for crash dump
collection during MHI power up.

To avoid carving out memory for RDDM buffers even if it is unutilized,
add support to allocate memory at runtime during the RDDM download
after target crash.

This feature can be controlled by the client driver registering the MHI
controller by setting the rddm_prealloc flag to false in mhi_cntrl.
By default rddm_prealloc is true, retaining the existing behaviour.

By default, rddm_seg_len will be same as seg_len. The client driver
can override the mhi_cntrl->rddm_seg_len.

Signed-off-by: Ram Kumar D <quic_ramd@xxxxxxxxxxx>
Co-developed-by: Vignesh Viswanathan <quic_viswanat@xxxxxxxxxxx>
Signed-off-by: Vignesh Viswanathan <quic_viswanat@xxxxxxxxxxx>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@xxxxxxxxxxx>
---
  drivers/bus/mhi/host/boot.c     | 149 +++++++++++++++++++++++++++-----
  drivers/bus/mhi/host/init.c     |  19 ++--
  drivers/bus/mhi/host/internal.h |  11 ++-
  drivers/bus/mhi/host/main.c     |   4 +-
  drivers/bus/mhi/host/pm.c       |   2 +-
  include/linux/mhi.h             |   2 +

NACK.  None of this gets used, making it dead code.
I didn't get it. Do you mean to say "mhi_cntrl->rddm_prealloc = true" by default, so its dead code?

For example, this patch adds rddm_prealloc to the mhi_cntrl struct. You do not add a user for this. No MHI controller in the kernel consumes this, and your series doesn't add one, therefore all the code you add in this change is dead because it will never get exercised.

This is not acceptable.


  6 files changed, 156 insertions(+), 31 deletions(-)

diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c
index ca842facf820..1a918e340424 100644
--- a/drivers/bus/mhi/host/boot.c
+++ b/drivers/bus/mhi/host/boot.c
@@ -35,6 +35,16 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
          bhi_vec->size = mhi_buf->len;
      }
  +    if (!mhi_cntrl->rddm_prealloc) {
+        mhi_buf->dma_addr = dma_map_single(mhi_cntrl->cntrl_dev,
+                           mhi_buf->buf, mhi_buf->len,
...
@@ -312,21 +367,31 @@ void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl,
    int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl,
               struct image_info **image_info,
-             size_t alloc_size)
+             size_t alloc_size, enum image_type img_type)
  {
      size_t seg_size = mhi_cntrl->seg_len;
-    int segments = DIV_ROUND_UP(alloc_size, seg_size) + 1;
+    int segments;
      int i;
      struct image_info *img_info;
      struct mhi_buf *mhi_buf;
+    /* Masked __GFP_DIRECT_RECLAIM flag for non-interrupt context
+     * to avoid rcu context sleep issue in kmalloc during kernel panic
+     */

Incorrect comment style.

Will correct this.


Also, why would RDDM be relevant to a Linux kernel panic?  This makes me suspect a lot is wrong with this patch.

When mhi device crashed, kernel also could be in panic, so during panic, its necessary to collect RDDM. This state is already supported in mhi driver.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/bus/mhi/host/boot.c?h=v6.10#n163

That appears to be unused, so I fail to see the connection to a Linux kernel panic.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux