]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_core...
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 14:36:57 +0000 (16:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 14:39:29 +0000 (16:39 +0200)
This reverts commit 7c4030421622e2727304dcb92419755cf3a32f0b as it
causes build problems in linux-next.  It needs to be reintroduced in a
way that can allow the api to evolve and not require a "flag day" to
catch all users.

Link: https://lore.kernel.org/r/20220623160723.7a44b573@canb.auug.org.au
Cc: Duoming Zhou <duoming@zju.edu.cn>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 files changed:
drivers/base/devcoredump.c
drivers/bluetooth/btmrvl_sdio.c
drivers/bluetooth/hci_qca.c
drivers/gpu/drm/etnaviv/etnaviv_dump.c
drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
drivers/gpu/drm/msm/msm_gpu.c
drivers/media/platform/qcom/venus/core.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c
drivers/net/wireless/ath/ath10k/coredump.c
drivers/net/wireless/ath/wil6210/wil_crash_dump.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt7921/mac.c
drivers/net/wireless/realtek/rtw88/main.c
drivers/net/wireless/realtek/rtw89/ser.c
drivers/remoteproc/qcom_q6v5_mss.c
drivers/remoteproc/remoteproc_coredump.c
include/drm/drm_print.h
include/linux/devcoredump.h
sound/soc/intel/avs/apl.c
sound/soc/intel/avs/skl.c
sound/soc/intel/catpt/dsp.c

index 8535f0bd5dfbcd433b68b4d672feae15922afc38..f4d794d6bb859119f8ba617335ee3ecc788b52f1 100644 (file)
@@ -173,13 +173,15 @@ static void devcd_freev(void *data)
  * @dev: the struct device for the crashed device
  * @data: vmalloc data containing the device coredump
  * @datalen: length of the data
+ * @gfp: allocation flags
  *
  * This function takes ownership of the vmalloc'ed data and will free
  * it when it is no longer used. See dev_coredumpm() for more information.
  */
-void dev_coredumpv(struct device *dev, void *data, size_t datalen)
+void dev_coredumpv(struct device *dev, void *data, size_t datalen,
+                  gfp_t gfp)
 {
-       dev_coredumpm(dev, NULL, data, datalen, devcd_readv, devcd_freev);
+       dev_coredumpm(dev, NULL, data, datalen, gfp, devcd_readv, devcd_freev);
 }
 EXPORT_SYMBOL_GPL(dev_coredumpv);
 
@@ -234,6 +236,7 @@ static ssize_t devcd_read_from_sgtable(char *buffer, loff_t offset,
  * @owner: the module that contains the read/free functions, use %THIS_MODULE
  * @data: data cookie for the @read/@free functions
  * @datalen: length of the data
+ * @gfp: allocation flags
  * @read: function to read from the given buffer
  * @free: function to free the given buffer
  *
@@ -243,7 +246,7 @@ static ssize_t devcd_read_from_sgtable(char *buffer, loff_t offset,
  * function will be called to free the data.
  */
 void dev_coredumpm(struct device *dev, struct module *owner,
-                  void *data, size_t datalen,
+                  void *data, size_t datalen, gfp_t gfp,
                   ssize_t (*read)(char *buffer, loff_t offset, size_t count,
                                   void *data, size_t datalen),
                   void (*free)(void *data))
@@ -265,7 +268,7 @@ void dev_coredumpm(struct device *dev, struct module *owner,
        if (!try_module_get(owner))
                goto free;
 
-       devcd = kzalloc(sizeof(*devcd), GFP_KERNEL);
+       devcd = kzalloc(sizeof(*devcd), gfp);
        if (!devcd)
                goto put_module;
 
@@ -315,6 +318,7 @@ EXPORT_SYMBOL_GPL(dev_coredumpm);
  * @dev: the struct device for the crashed device
  * @table: the dump data
  * @datalen: length of the data
+ * @gfp: allocation flags
  *
  * Creates a new device coredump for the given device. If a previous one hasn't
  * been read yet, the new coredump is discarded. The data lifetime is determined
@@ -322,9 +326,9 @@ EXPORT_SYMBOL_GPL(dev_coredumpm);
  * it will free the data.
  */
 void dev_coredumpsg(struct device *dev, struct scatterlist *table,
-                   size_t datalen)
+                   size_t datalen, gfp_t gfp)
 {
-       dev_coredumpm(dev, NULL, table, datalen, devcd_read_from_sgtable,
+       dev_coredumpm(dev, NULL, table, datalen, gfp, devcd_read_from_sgtable,
                      devcd_free_sgtable);
 }
 EXPORT_SYMBOL_GPL(dev_coredumpsg);
index 9b9728719db2ba13944e2d1020a6a7ac02f69618..b8ef66f89fc100f3062270f0590be5e18316c9fa 100644 (file)
@@ -1515,7 +1515,7 @@ done:
        /* fw_dump_data will be free in device coredump release function
         * after 5 min
         */
-       dev_coredumpv(&card->func->dev, fw_dump_data, fw_dump_len);
+       dev_coredumpv(&card->func->dev, fw_dump_data, fw_dump_len, GFP_KERNEL);
        BT_INFO("== btmrvl firmware dump to /sys/class/devcoredump end");
 }
 
index 2e4074211ae90f7c127c26aad29132f4629e69b3..eab34e24d9446580332f01e9d02614717df084f2 100644 (file)
@@ -1120,7 +1120,7 @@ static void qca_controller_memdump(struct work_struct *work)
                                    qca_memdump->ram_dump_size);
                        memdump_buf = qca_memdump->memdump_buf_head;
                        dev_coredumpv(&hu->serdev->dev, memdump_buf,
-                                     qca_memdump->received_dump);
+                                     qca_memdump->received_dump, GFP_KERNEL);
                        cancel_delayed_work(&qca->ctrl_memdump_timeout);
                        kfree(qca->qca_memdump);
                        qca->qca_memdump = NULL;
index 519fcb234b3e49944ca6cce8760617d15afbcc59..f418e0b75772e25ef4deda04e78be837218303b2 100644 (file)
@@ -225,5 +225,5 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
 
        etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
 
-       dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start);
+       dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
 }
index f057d294c30b09c7e7f62d7061cab12c76f83356..e75b97127c0d18b2cbb9ee34c00d981eb73e6e3f 100644 (file)
@@ -74,8 +74,8 @@ static void _msm_disp_snapshot_work(struct kthread_work *work)
         * If there is a codedump pending for the device, the dev_coredumpm()
         * will also free new coredump state.
         */
-       dev_coredumpm(disp_state->dev, THIS_MODULE, disp_state, 0,
-                     disp_devcoredump_read, msm_disp_state_free);
+       dev_coredumpm(disp_state->dev, THIS_MODULE, disp_state, 0, GFP_KERNEL,
+                       disp_devcoredump_read, msm_disp_state_free);
 }
 
 void msm_disp_snapshot_state(struct drm_device *drm_dev)
index 30576ced0a0ad132a842bb47459de1e0b7ded608..eb8a6663f309f49326b3eeb317b41de316e3e2ad 100644 (file)
@@ -317,8 +317,8 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
        gpu->crashstate = state;
 
        /* FIXME: Release the crashstate if this errors out? */
-       dev_coredumpm(gpu->dev->dev, THIS_MODULE, gpu, 0,
-                     msm_gpu_devcoredump_read, msm_gpu_devcoredump_free);
+       dev_coredumpm(gpu->dev->dev, THIS_MODULE, gpu, 0, GFP_KERNEL,
+               msm_gpu_devcoredump_read, msm_gpu_devcoredump_free);
 }
 #else
 static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
index db84dfb3fb11926eae912ff9b70b655295035456..877eca12580376851ee8f892a9857ef486e4dbca 100644 (file)
@@ -49,7 +49,7 @@ static void venus_coredump(struct venus_core *core)
 
        memcpy(data, mem_va, mem_size);
        memunmap(mem_va);
-       dev_coredumpv(dev, data, mem_size);
+       dev_coredumpv(dev, data, mem_size, GFP_KERNEL);
 }
 
 static void venus_event_notify(struct venus_core *core, u32 event)
index fa520ab7c9603c5735a942f492a09f5f9671818a..c991b30bc9f05957e49927ef38b71b43a2673c94 100644 (file)
@@ -281,5 +281,5 @@ void mcp251xfd_dump(const struct mcp251xfd_priv *priv)
        mcp251xfd_dump_end(priv, &iter);
 
        dev_coredumpv(&priv->spi->dev, iter.start,
-                     iter.data - iter.start);
+                     iter.data - iter.start, GFP_KERNEL);
 }
index dc923706992146e9a6a34810d88d995918ad369b..fe6b6f97a91631005acad93b6dc195003e508e54 100644 (file)
@@ -1607,7 +1607,7 @@ int ath10k_coredump_submit(struct ath10k *ar)
                return -ENODATA;
        }
 
-       dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len));
+       dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL);
 
        return 0;
 }
index 79299609dd62c45251a254aa3e137f96a8b18050..89c12cb2aaab2b3a576559c271a5604050f70543 100644 (file)
@@ -117,6 +117,6 @@ void wil_fw_core_dump(struct wil6210_priv *wil)
        /* fw_dump_data will be free in device coredump release function
         * after 5 min
         */
-       dev_coredumpv(wil_to_dev(wil), fw_dump_data, fw_dump_size);
+       dev_coredumpv(wil_to_dev(wil), fw_dump_data, fw_dump_size, GFP_KERNEL);
        wil_info(wil, "fw core dumped, size %d bytes\n", fw_dump_size);
 }
index 87f3652ef3bd35d2bc529456f1f76c2935311806..eecf8a38d94aa43c502083ad3464b29dfbb98563 100644 (file)
@@ -37,7 +37,7 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
                return err;
        }
 
-       dev_coredumpv(bus->dev, dump, len + ramsize);
+       dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
 
        return 0;
 }
index f2f7cf494a8caea452dd3f588bd3331cb5fff1bd..abf49022edbe414e3d8f20bf53ee9f3f4496abe5 100644 (file)
@@ -2601,7 +2601,8 @@ static void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,
                                             fw_error_dump.trans_ptr->data,
                                             fw_error_dump.trans_ptr->len,
                                             fw_error_dump.fwrt_len);
-               dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len);
+               dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len,
+                              GFP_KERNEL);
        }
        vfree(fw_error_dump.fwrt_ptr);
        vfree(fw_error_dump.trans_ptr);
@@ -2646,7 +2647,8 @@ static void iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt,
                                             entry->data, entry->size, offs);
                        offs += entry->size;
                }
-               dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len);
+               dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len,
+                              GFP_KERNEL);
        }
        iwl_dump_ini_list_free(&dump_list);
 }
index 26fef0ab1b0d295661d7b311af2688727da4fd62..ace7371c477394b396994ceb4b02a1cc1c92f0df 100644 (file)
@@ -1115,7 +1115,8 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter)
         */
        mwifiex_dbg(adapter, MSG,
                    "== mwifiex dump information to /sys/class/devcoredump start\n");
-       dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len);
+       dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len,
+                     GFP_KERNEL);
        mwifiex_dbg(adapter, MSG,
                    "== mwifiex dump information to /sys/class/devcoredump end\n");
 
index 5336fe8c668daec3c812e0e9ee70d14abf67b89c..bd687f7de628934e380e81e798ae98703e6f28ff 100644 (file)
@@ -2421,5 +2421,6 @@ void mt7615_coredump_work(struct work_struct *work)
 
                dev_kfree_skb(skb);
        }
-       dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ);
+       dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ,
+                     GFP_KERNEL);
 }
index cac284f95ce0f06dae1f88f8aaf065a89585dbb5..a630ddbf19e541f65e899f76ee2454c59755f796 100644 (file)
@@ -1630,7 +1630,8 @@ void mt7921_coredump_work(struct work_struct *work)
        }
 
        if (dump)
-               dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ);
+               dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ,
+                             GFP_KERNEL);
 
        mt7921_reset(&dev->mt76);
 }
index a276544cecdd05b035bb062ec3c94cdb4ac8a631..efabd5b1bf5b683fcb9db96be8f1346e2c30878f 100644 (file)
@@ -414,7 +414,7 @@ static void rtw_fwcd_dump(struct rtw_dev *rtwdev)
         * framework. Note that a new dump will be discarded if a previous one
         * hasn't been released yet.
         */
-       dev_coredumpv(rtwdev->dev, desc->data, desc->size);
+       dev_coredumpv(rtwdev->dev, desc->data, desc->size, GFP_KERNEL);
 }
 
 static void rtw_fwcd_free(struct rtw_dev *rtwdev, bool free_self)
index d28fe01ad729919fd1a38b12efe4a507a645eb9f..9e95ed9727108e35bfa589dae7a0a6db23aa00d2 100644 (file)
@@ -127,7 +127,7 @@ static void rtw89_ser_cd_send(struct rtw89_dev *rtwdev,
         * will be discarded if a previous one hasn't been released by
         * framework yet.
         */
-       dev_coredumpv(rtwdev->dev, buf, sizeof(*buf));
+       dev_coredumpv(rtwdev->dev, buf, sizeof(*buf), GFP_KERNEL);
 }
 
 static void rtw89_ser_cd_free(struct rtw89_dev *rtwdev,
index 813d87faef6cd62131c2db2451aaa37173b7c746..af217de75e4d9179ed73ab3319e7642b33262f84 100644 (file)
@@ -597,7 +597,7 @@ static void q6v5_dump_mba_logs(struct q6v5 *qproc)
        data = vmalloc(MBA_LOG_SIZE);
        if (data) {
                memcpy(data, mba_region, MBA_LOG_SIZE);
-               dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE);
+               dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE, GFP_KERNEL);
        }
        memunmap(mba_region);
 }
index cd55c2abd2270f8851c7dfa2231f077ffa2879eb..4b093420d98aa9544e1420d48b5142036e0537f3 100644 (file)
@@ -309,7 +309,7 @@ void rproc_coredump(struct rproc *rproc)
                phdr += elf_size_of_phdr(class);
        }
        if (dump_conf == RPROC_COREDUMP_ENABLED) {
-               dev_coredumpv(&rproc->dev, data, data_size);
+               dev_coredumpv(&rproc->dev, data, data_size, GFP_KERNEL);
                return;
        }
 
@@ -318,7 +318,7 @@ void rproc_coredump(struct rproc *rproc)
        dump_state.header = data;
        init_completion(&dump_state.dump_done);
 
-       dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size,
+       dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size, GFP_KERNEL,
                      rproc_coredump_read, rproc_coredump_free);
 
        /*
@@ -449,7 +449,7 @@ void rproc_coredump_using_sections(struct rproc *rproc)
        }
 
        if (dump_conf == RPROC_COREDUMP_ENABLED) {
-               dev_coredumpv(&rproc->dev, data, data_size);
+               dev_coredumpv(&rproc->dev, data, data_size, GFP_KERNEL);
                return;
        }
 
@@ -458,7 +458,7 @@ void rproc_coredump_using_sections(struct rproc *rproc)
        dump_state.header = data;
        init_completion(&dump_state.dump_done);
 
-       dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size,
+       dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size, GFP_KERNEL,
                      rproc_coredump_read, rproc_coredump_free);
 
        /* Wait until the dump is read and free is called. Data is freed
index b41850366bcce6686a22211e6323680e636690ce..22fabdeed2973d303835ee76d3f574929afc4414 100644 (file)
@@ -162,7 +162,7 @@ struct drm_print_iterator {
  *     void makecoredump(...)
  *     {
  *             ...
- *             dev_coredumpm(dev, THIS_MODULE, data, 0,
+ *             dev_coredumpm(dev, THIS_MODULE, data, 0, GFP_KERNEL,
  *                     coredump_read, ...)
  *     }
  *
index c7d840d824c3e79dcde444aa7dce16f33e684a28..c008169ed2c6fa4c7c98725fb18f650ebe87feb8 100644 (file)
@@ -52,26 +52,27 @@ static inline void _devcd_free_sgtable(struct scatterlist *table)
 
 
 #ifdef CONFIG_DEV_COREDUMP
-void dev_coredumpv(struct device *dev, void *data, size_t datalen);
+void dev_coredumpv(struct device *dev, void *data, size_t datalen,
+                  gfp_t gfp);
 
 void dev_coredumpm(struct device *dev, struct module *owner,
-                  void *data, size_t datalen,
+                  void *data, size_t datalen, gfp_t gfp,
                   ssize_t (*read)(char *buffer, loff_t offset, size_t count,
                                   void *data, size_t datalen),
                   void (*free)(void *data));
 
 void dev_coredumpsg(struct device *dev, struct scatterlist *table,
-                   size_t datalen);
+                   size_t datalen, gfp_t gfp);
 #else
 static inline void dev_coredumpv(struct device *dev, void *data,
-                                size_t datalen)
+                                size_t datalen, gfp_t gfp)
 {
        vfree(data);
 }
 
 static inline void
 dev_coredumpm(struct device *dev, struct module *owner,
-             void *data, size_t datalen,
+             void *data, size_t datalen, gfp_t gfp,
              ssize_t (*read)(char *buffer, loff_t offset, size_t count,
                              void *data, size_t datalen),
              void (*free)(void *data))
@@ -80,7 +81,7 @@ dev_coredumpm(struct device *dev, struct module *owner,
 }
 
 static inline void dev_coredumpsg(struct device *dev, struct scatterlist *table,
-                                 size_t datalen)
+                                 size_t datalen, gfp_t gfp)
 {
        _devcd_free_sgtable(table);
 }
index 1ff57f1a483d58a8e203110de18634ebf452265b..b8e2b23c9f6423798d688506fa891f822e7e0956 100644 (file)
@@ -164,7 +164,7 @@ static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg)
        } while (offset < msg->ext.coredump.stack_dump_size);
 
 exit:
-       dev_coredumpv(adev->dev, dump, dump_size);
+       dev_coredumpv(adev->dev, dump, dump_size, GFP_KERNEL);
 
        return 0;
 }
index 3413162768dc404746ea0d0a9627bf5e4ffd1be7..bda5ec7510feb45d61b149938be5fec377ec1835 100644 (file)
@@ -88,7 +88,7 @@ static int skl_coredump(struct avs_dev *adev, union avs_notify_msg *msg)
                return -ENOMEM;
 
        memcpy_fromio(dump, avs_sram_addr(adev, AVS_FW_REGS_WINDOW), AVS_FW_REGS_SIZE);
-       dev_coredumpv(adev->dev, dump, AVS_FW_REGS_SIZE);
+       dev_coredumpv(adev->dev, dump, AVS_FW_REGS_SIZE, GFP_KERNEL);
 
        return 0;
 }
index d2afe9ff1e3af203d8becd6e6826426d088f1131..346bec000306691a717a0981b6e7b8a521498bb0 100644 (file)
@@ -539,7 +539,7 @@ int catpt_coredump(struct catpt_dev *cdev)
                pos += CATPT_DMA_REGS_SIZE;
        }
 
-       dev_coredumpv(cdev->dev, dump, dump_size);
+       dev_coredumpv(cdev->dev, dump, dump_size, GFP_KERNEL);
 
        return 0;
 }