mailman.alsa-project.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Sound-open-firmware

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
sound-open-firmware@alsa-project.org

  • 4 participants
  • 1568 discussions
[Sound-open-firmware] [PATCH] ASoC: SOF: amd: Enable cache for AMD Rembrandt platform
by V sujith kumar Reddy 27 Dec '22

27 Dec '22
Enable DSP cache for ACP memory Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> --- sound/soc/sof/amd/acp-dsp-offset.h | 4 ++++ sound/soc/sof/amd/acp-loader.c | 7 +++++++ sound/soc/sof/amd/acp.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/sound/soc/sof/amd/acp-dsp-offset.h b/sound/soc/sof/amd/acp-dsp-offset.h index de5726251dc6..920155dee819 100644 --- a/sound/soc/sof/amd/acp-dsp-offset.h +++ b/sound/soc/sof/amd/acp-dsp-offset.h @@ -85,4 +85,8 @@ #define ACP_SCRATCH_REG_0 0x10000 #define ACP6X_DSP_FUSION_RUNSTALL 0x0644 + +/* Cache window registers */ +#define ACP_DSP0_CACHE_OFFSET0 0x0420 +#define ACP_DSP0_CACHE_SIZE0 0x0424 #endif diff --git a/sound/soc/sof/amd/acp-loader.c b/sound/soc/sof/amd/acp-loader.c index 090c8b18c83c..a4bce5a3ae48 100644 --- a/sound/soc/sof/amd/acp-loader.c +++ b/sound/soc/sof/amd/acp-loader.c @@ -151,6 +151,7 @@ static void configure_pte_for_fw_loading(int type, int num_pages, struct acp_dev int acp_dsp_pre_fw_run(struct snd_sof_dev *sdev) { struct pci_dev *pci = to_pci_dev(sdev->dev); + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); struct acp_dev_data *adata; unsigned int src_addr, size_fw; u32 page_count, dma_size; @@ -183,6 +184,12 @@ int acp_dsp_pre_fw_run(struct snd_sof_dev *sdev) if (ret < 0) dev_err(sdev->dev, "acp dma transfer status: %d\n", ret); + if (desc->rev > 3) { + /* Cache Window enable */ + snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_DSP0_CACHE_OFFSET0, desc->sram_pte_offset); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_DSP0_CACHE_SIZE0, SRAM1_SIZE | BIT(31)); + } + /* Free memory once DMA is complete */ dma_size = (PAGE_ALIGN(sdev->basefw.fw->size) >> PAGE_SHIFT) * ACP_PAGE_SIZE; dma_free_coherent(&pci->dev, dma_size, adata->bin_buf, adata->sha_dma_addr); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index 09e16ef8afa0..4314094a97fd 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -72,6 +72,8 @@ #define EXCEPT_MAX_HDR_SIZE 0x400 #define AMD_STACK_DUMP_SIZE 32 +#define SRAM1_SIZE 0x13A000 + enum clock_source { ACP_CLOCK_96M = 0, ACP_CLOCK_48M, -- 2.25.1
2 1
0 0
[Sound-open-firmware] [PATCH 00/15] ASoC: Drop empty platform remove functions
by Uwe Kleine-König 27 Dec '22

27 Dec '22
From: Uwe Kleine-König <uwe(a)kleine-koenig.org> Hello, this patch series removes all platform remove functions that only return zero below sound/soc. There is no reason to have these, as the only caller is platform core code doing: if (drv->remove) { int ret = drv->remove(dev); ... } (in platform_remove()) and so having no remove function is both equivalent and simpler. Best regards Uwe Uwe Kleine-König (15): ASoC: pxa: Drop empty platform remove function ASoC: amd: Drop empty platform remove function ASoC: atmel-classd: Drop empty platform remove function ASoC: atmel-pdmic: Drop empty platform remove function ASoC: 88pm860x: Drop empty platform remove function ASoC: ac97: Drop empty platform remove function ASoC: adau7002: Drop empty platform remove function ASoC: bt-sco: Drop empty platform remove function ASoC: cq93vc: Drop empty platform remove function ASoC: mc13783: Drop empty platform remove function ASoC: wl1273: Drop empty platform remove function ASoC: pxa: e740_wm9705: Drop empty platform remove function ASoC: pxa: e750_wm9705: Drop empty platform remove function ASoC: pxa: e800_wm9712: Drop empty platform remove function ASoC: SOF: nocodec: Drop empty platform remove function sound/soc/amd/raven/acp3x-i2s.c | 8 -------- sound/soc/atmel/atmel-classd.c | 6 ------ sound/soc/atmel/atmel-pdmic.c | 6 ------ sound/soc/codecs/88pm860x-codec.c | 6 ------ sound/soc/codecs/ac97.c | 6 ------ sound/soc/codecs/adau7002.c | 6 ------ sound/soc/codecs/bt-sco.c | 6 ------ sound/soc/codecs/cq93vc.c | 6 ------ sound/soc/codecs/mc13783.c | 6 ------ sound/soc/codecs/wl1273.c | 6 ------ sound/soc/pxa/e740_wm9705.c | 6 ------ sound/soc/pxa/e750_wm9705.c | 6 ------ sound/soc/pxa/e800_wm9712.c | 6 ------ sound/soc/pxa/spitz.c | 6 ------ sound/soc/sof/nocodec.c | 6 ------ 15 files changed, 92 deletions(-) base-commit: 3a28c2c89f4b412b648761430720d40a8dc326ef -- 2.38.1
3 3
0 0
[Sound-open-firmware] [PATCH] ASoC: SOF: mediatek: initialize panic_info to zero
by YC Hung 14 Dec '22

14 Dec '22
Coverity spotted that panic_info is not initialized to zero in mtk_adsp_dump. Using uninitialized value panic_info.linenum when calling snd_sof_get_status. Fix this coverity by initializing panic_info struct as zero. Signed-off-by: YC Hung <yc.hung(a)mediatek.com> --- sound/soc/sof/mediatek/mtk-adsp-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/mediatek/mtk-adsp-common.c b/sound/soc/sof/mediatek/mtk-adsp-common.c index 1e0769c668a7..de8dbe27cd0d 100644 --- a/sound/soc/sof/mediatek/mtk-adsp-common.c +++ b/sound/soc/sof/mediatek/mtk-adsp-common.c @@ -60,7 +60,7 @@ void mtk_adsp_dump(struct snd_sof_dev *sdev, u32 flags) { char *level = (flags & SOF_DBG_DUMP_OPTIONAL) ? KERN_DEBUG : KERN_ERR; struct sof_ipc_dsp_oops_xtensa xoops; - struct sof_ipc_panic_info panic_info; + struct sof_ipc_panic_info panic_info = {}; u32 stack[MTK_ADSP_STACK_DUMP_SIZE]; u32 status; -- 2.18.0
3 2
0 0
Re: [Sound-open-firmware] [PATCH v8 3/3] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Kai Vehmanen 09 Dec '22

09 Dec '22
Hi, On Thu, 1 Dec 2022, Ricardo Ribalda wrote: > On Thu, 1 Dec 2022 at 14:22, 'Oliver Neukum' via Chromeos Kdump <chromeos-kdump(a)google.com> wrote: > > > > On 01.12.22 14:03, Ricardo Ribalda wrote: > > > This patchset does not modify this behaviour. It simply fixes the > > > stall for kexec(). > > > > > > The patch that introduced the stall: > > > 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers > > > in .shutdown") > > > > That patch is problematic. I would go as far as saying that > > it needs to be reverted. > > It fixes a real issue. We have not had any complaints until we tried > to kexec in the platform. > I wont recommend reverting it until we have an alternative implementation. > > kexec is far less common than suspend/reboot. I've posted an alternative to ALSA list that reverts the problematic patch and fixes the problem (the patch was originally addressing) in a different way: https://mailman.alsa-project.org/pipermail/alsa-devel/2022-December/209776.… No changes outside sound/soc/ are needed with this approach. Br, Kai
1 0
0 0
[Sound-open-firmware] [PATCH 2/2] ASoC : SOF: amd: Add support for IPC and DSP dumps
by V sujith kumar Reddy 05 Dec '22

05 Dec '22
Add support for IPC and DSP dumps for AMD platforms. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> --- sound/soc/sof/amd/Kconfig | 1 + sound/soc/sof/amd/acp-common.c | 108 +++++++++++++++++++++++++++++++++ sound/soc/sof/amd/acp-ipc.c | 13 ++++ sound/soc/sof/amd/acp.h | 6 ++ 4 files changed, 128 insertions(+) diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig index a305ea6efea9..1cb92d6030e3 100644 --- a/sound/soc/sof/amd/Kconfig +++ b/sound/soc/sof/amd/Kconfig @@ -20,6 +20,7 @@ config SND_SOC_SOF_AMD_COMMON select SND_SOC_SOF_IPC3 select SND_SOC_SOF_PCI_DEV select SND_AMD_ACP_CONFIG + select SND_SOC_SOF_XTENSA select SND_SOC_ACPI if ACPI help This option is not user-selectable but automatically handled by diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c index 150e042e4039..bd6c1b198736 100644 --- a/sound/soc/sof/amd/acp-common.c +++ b/sound/soc/sof/amd/acp-common.c @@ -16,6 +16,7 @@ #include "../sof-audio.h" #include "acp.h" #include "acp-dsp-offset.h" +#include <sound/sof/xtensa.h> int acp_dai_probe(struct snd_soc_dai *dai) { @@ -33,6 +34,107 @@ int acp_dai_probe(struct snd_soc_dai *dai) } EXPORT_SYMBOL_NS(acp_dai_probe, SND_SOC_SOF_AMD_COMMON); +/** + * amd_sof_ipc_dump() - This function is called when IPC tx times out. + * @sdev: SOF device. + */ +void amd_sof_ipc_dump(struct snd_sof_dev *sdev) +{ + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); + u32 base = desc->dsp_intr_base; + u32 dsp_msg_write = sdev->debug_box.offset + + offsetof(struct scratch_ipc_conf, sof_dsp_msg_write); + u32 dsp_ack_write = sdev->debug_box.offset + + offsetof(struct scratch_ipc_conf, sof_dsp_ack_write); + u32 host_msg_write = sdev->debug_box.offset + + offsetof(struct scratch_ipc_conf, sof_host_msg_write); + u32 host_ack_write = sdev->debug_box.offset + + offsetof(struct scratch_ipc_conf, sof_host_ack_write); + u32 dsp_msg, dsp_ack, host_msg, host_ack, irq_stat; + + dsp_msg = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_msg_write); + dsp_ack = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_ack_write); + host_msg = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + host_msg_write); + host_ack = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + host_ack_write); + irq_stat = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET); + + dev_err(sdev->dev, + "dsp_msg = %#x dsp_ack = %#x host_msg = %#x host_ack = %#x irq_stat = %#x\n", + dsp_msg, dsp_ack, host_msg, host_ack, irq_stat); +} + +/** + * amd_get_registers() - This function is called in case of DSP oops + * in order to gather information about the registers, filename and + * linenumber and stack. + * @sdev: SOF device. + * @xoops: Stores information about registers. + * @panic_info: Stores information about filename and line number. + * @stack: Stores the stack dump. + * @stack_words: Size of the stack dump. + */ +static void amd_get_registers(struct snd_sof_dev *sdev, + struct sof_ipc_dsp_oops_xtensa *xoops, + struct sof_ipc_panic_info *panic_info, + u32 *stack, size_t stack_words) +{ + u32 offset = sdev->dsp_oops_offset; + + /* first read registers */ + acp_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); + + /* then get panic info */ + if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { + dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", + xoops->arch_hdr.totalsize); + return; + } + + offset += xoops->arch_hdr.totalsize; + acp_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); + + /* then get the stack */ + offset += sizeof(*panic_info); + acp_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32)); +} + +/** + * amd_sof_dump() - This function is called when a panic message is + * received from the firmware. + * @sdev: SOF device. + * @flags: parameter not used but required by ops prototype + */ +void amd_sof_dump(struct snd_sof_dev *sdev, u32 flags) +{ + struct sof_ipc_dsp_oops_xtensa xoops; + struct sof_ipc_panic_info panic_info; + u32 stack[AMD_STACK_DUMP_SIZE]; + u32 status; + + /* Get information about the panic status from the debug box area. + * Compute the trace point based on the status. + */ + if (sdev->dsp_oops_offset > sdev->debug_box.offset) { + acp_mailbox_read(sdev, sdev->debug_box.offset, &status, sizeof(u32)); + } else { + /* Read DSP Panic status from dsp_box. + * As window information for exception box offset and size is not available + * before FW_READY + */ + acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(u32)); + sdev->dsp_oops_offset = sdev->dsp_box.offset + sizeof(status); + } + + /* Get information about the registers, the filename and line + * number and the stack. + */ + amd_get_registers(sdev, &xoops, &panic_info, stack, AMD_STACK_DUMP_SIZE); + + /* Print the information to the console */ + sof_print_oops_and_stack(sdev, KERN_ERR, status, status, &xoops, + &panic_info, stack, AMD_STACK_DUMP_SIZE); +} + struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev) { struct snd_sof_pdata *sof_pdata = sdev->pdata; @@ -104,9 +206,15 @@ struct snd_sof_dsp_ops sof_acp_common_ops = { /* PM */ .suspend = amd_sof_acp_suspend, .resume = amd_sof_acp_resume, + + .ipc_dump = amd_sof_ipc_dump, + .dbg_dump = amd_sof_dump, + .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, + .dsp_arch_ops = &sof_xtensa_arch_ops, }; EXPORT_SYMBOL_NS(sof_acp_common_ops, SND_SOC_SOF_AMD_COMMON); MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); +MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); MODULE_DESCRIPTION("ACP SOF COMMON Driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c index dd6e53c63407..5a02753c4610 100644 --- a/sound/soc/sof/amd/acp-ipc.c +++ b/sound/soc/sof/amd/acp-ipc.c @@ -154,8 +154,15 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context) offsetof(struct scratch_ipc_conf, sof_dsp_ack_write); bool ipc_irq = false; int dsp_msg, dsp_ack; + unsigned int status; if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) { + acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(status)); + if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) { + snd_sof_dsp_panic(sdev, sdev->dsp_box.offset + sizeof(status), + true); + return IRQ_HANDLED; + } snd_sof_ipc_msgs_rx(sdev); acp_dsp_ipc_host_done(sdev); return IRQ_HANDLED; @@ -180,6 +187,12 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context) ipc_irq = true; } + acp_mailbox_read(sdev, sdev->debug_box.offset, &status, sizeof(u32)); + if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) { + snd_sof_dsp_panic(sdev, sdev->dsp_oops_offset, true); + return IRQ_HANDLED; + } + if (!ipc_irq) dev_dbg_ratelimited(sdev->dev, "nothing to do in IPC IRQ thread\n"); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index 76ad963faec1..09e16ef8afa0 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -69,6 +69,9 @@ #define BOX_SIZE_512 0x200 #define BOX_SIZE_1024 0x400 +#define EXCEPT_MAX_HDR_SIZE 0x400 +#define AMD_STACK_DUMP_SIZE 32 + enum clock_source { ACP_CLOCK_96M = 0, ACP_CLOCK_48M, @@ -254,6 +257,9 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev); int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state); int amd_sof_acp_resume(struct snd_sof_dev *sdev); +void amd_sof_ipc_dump(struct snd_sof_dev *sdev); +void amd_sof_dump(struct snd_sof_dev *sdev, u32 flags); + static inline const struct sof_amd_acp_desc *get_chip_info(struct snd_sof_pdata *pdata) { const struct sof_dev_desc *desc = pdata->desc; -- 2.25.1
1 0
0 0
[Sound-open-firmware] [PATCH 1/2] ASoC: SOF: amd: Use poll function instead to read ACP_SHA_DSP_FW_QUALIFIER
by V sujith kumar Reddy 05 Dec '22

05 Dec '22
From: Ajye Huang <ajye_huang(a)compal.corp-partner.google.com> The Skyrim project and Whiterun met error when DSP loading during device boot. Ex, error in kernel log, ERR kernel: [ 16.124537] snd_sof_amd_rembrandt 0000:04:00.5: PSP validation failed. Use the snd_sof_dsp_read_poll_timeout function to successfully read the FW_QUALIFIER register Signed-off-by: Ajye Huang <ajye_huang(a)compal.corp-partner.google.com> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> --- sound/soc/sof/amd/acp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 47115a77c92c..6bd2888fbb66 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -255,10 +255,12 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr, if (ret) return ret; - fw_qualifier = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER); - if (!(fw_qualifier & DSP_FW_RUN_ENABLE)) { + ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER, + fw_qualifier, fw_qualifier & DSP_FW_RUN_ENABLE, + ACP_REG_POLL_INTERVAL, ACP_DMA_COMPLETE_TIMEOUT_US); + if (ret < 0) { dev_err(sdev->dev, "PSP validation failed\n"); - return -EINVAL; + return ret; } return 0; -- 2.25.1
1 0
0 0
Re: [Sound-open-firmware] [PATCH v8 2/3] freezer: refactor pm_freezing into a function.
by Ricardo Ribalda 05 Dec '22

05 Dec '22
Hi Rafael On Fri, 2 Dec 2022 at 18:48, Rafael J. Wysocki <rafael(a)kernel.org> wrote: > > On Thu, Dec 1, 2022 at 12:08 PM Ricardo Ribalda <ribalda(a)chromium.org> wrote: > > > > Add a way to let the drivers know if the processes are frozen. > > > > This is needed by drivers that are waiting for processes to end on their > > shutdown path. > > > > Convert pm_freezing into a function and export it, so it can be used by > > drivers that are either built-in or modules. > > > > Cc: stable(a)vger.kernel.org > > Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") > > Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> > > Why can't you export the original pm_freezing variable and why is this > fixing anything? Because then any module will be able to modify the content of the variable. The Fixes: is because the last patch on the set is doing a real fix. If you only cherry-pick the last patch on a stable branch, the build will fail. (Also, the zero-day builder complains) Anyway, I think we can hold this patch for a bit. The snd people are discussing if this the way to handle it, or if we should handle .shutdown in a different way. Thanks! > > > --- > > include/linux/freezer.h | 3 ++- > > kernel/freezer.c | 3 +-- > > kernel/power/process.c | 24 ++++++++++++++++++++---- > > 3 files changed, 23 insertions(+), 7 deletions(-) > > > > diff --git a/include/linux/freezer.h b/include/linux/freezer.h > > index b303472255be..3413c869d68b 100644 > > --- a/include/linux/freezer.h > > +++ b/include/linux/freezer.h > > @@ -13,7 +13,7 @@ > > #ifdef CONFIG_FREEZER > > DECLARE_STATIC_KEY_FALSE(freezer_active); > > > > -extern bool pm_freezing; /* PM freezing in effect */ > > +bool pm_freezing(void); > > extern bool pm_nosig_freezing; /* PM nosig freezing in effect */ > > > > /* > > @@ -80,6 +80,7 @@ static inline int freeze_processes(void) { return -ENOSYS; } > > static inline int freeze_kernel_threads(void) { return -ENOSYS; } > > static inline void thaw_processes(void) {} > > static inline void thaw_kernel_threads(void) {} > > +static inline bool pm_freezing(void) { return false; } > > > > static inline bool try_to_freeze(void) { return false; } > > > > diff --git a/kernel/freezer.c b/kernel/freezer.c > > index 4fad0e6fca64..2d3530ebdb7e 100644 > > --- a/kernel/freezer.c > > +++ b/kernel/freezer.c > > @@ -20,7 +20,6 @@ EXPORT_SYMBOL(freezer_active); > > * indicate whether PM freezing is in effect, protected by > > * system_transition_mutex > > */ > > -bool pm_freezing; > > bool pm_nosig_freezing; > > > > /* protects freezing and frozen transitions */ > > @@ -46,7 +45,7 @@ bool freezing_slow_path(struct task_struct *p) > > if (pm_nosig_freezing || cgroup_freezing(p)) > > return true; > > > > - if (pm_freezing && !(p->flags & PF_KTHREAD)) > > + if (pm_freezing() && !(p->flags & PF_KTHREAD)) > > return true; > > > > return false; > > diff --git a/kernel/power/process.c b/kernel/power/process.c > > index ddd9988327fe..8a4d0e2c8c20 100644 > > --- a/kernel/power/process.c > > +++ b/kernel/power/process.c > > @@ -108,6 +108,22 @@ static int try_to_freeze_tasks(bool user_only) > > return todo ? -EBUSY : 0; > > } > > > > +/* > > + * Indicate whether PM freezing is in effect, protected by > > + * system_transition_mutex. > > + */ > > +static bool pm_freezing_internal; > > + > > +/** > > + * pm_freezing - indicate whether PM freezing is in effect. > > + * > > + */ > > +bool pm_freezing(void) > > +{ > > + return pm_freezing_internal; > > +} > > +EXPORT_SYMBOL(pm_freezing); > > Use EXPORT_SYMBOL_GPL() instead, please. > > > + > > /** > > * freeze_processes - Signal user space processes to enter the refrigerator. > > * The current thread will not be frozen. The same process that calls > > @@ -126,12 +142,12 @@ int freeze_processes(void) > > /* Make sure this task doesn't get frozen */ > > current->flags |= PF_SUSPEND_TASK; > > > > - if (!pm_freezing) > > + if (!pm_freezing()) > > static_branch_inc(&freezer_active); > > > > pm_wakeup_clear(0); > > pr_info("Freezing user space processes ... "); > > - pm_freezing = true; > > + pm_freezing_internal = true; > > error = try_to_freeze_tasks(true); > > if (!error) { > > __usermodehelper_set_disable_depth(UMH_DISABLED); > > @@ -187,9 +203,9 @@ void thaw_processes(void) > > struct task_struct *curr = current; > > > > trace_suspend_resume(TPS("thaw_processes"), 0, true); > > - if (pm_freezing) > > + if (pm_freezing()) > > static_branch_dec(&freezer_active); > > - pm_freezing = false; > > + pm_freezing_internal = false; > > pm_nosig_freezing = false; > > > > oom_killer_enable(); > > > > -- > > -- > You received this message because you are subscribed to the Google Groups "Chromeos Kdump" group. > To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-kdump+unsubscribe(a)google.com. > To view this discussion on the web, visit https://groups.google.com/a/google.com/d/msgid/chromeos-kdump/CAJZ5v0jbKSTQ…. -- Ricardo Ribalda
1 0
0 0
[Sound-open-firmware] [PATCH v7 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 01 Dec '22

01 Dec '22
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> To: Eric Biederman <ebiederm(a)xmission.com> To: Chromeos Kdump <chromeos-kdump(a)google.com> To: Steven Rostedt <rostedt(a)goodmis.org> Cc: stable(a)vger.kernel.org Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org Cc: kexec(a)lists.infradead.org Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- Changes in v7: - Fix commit message (Thanks Pierre-Louis). - Link to v6: https://lore.kernel.org/r/20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08ba0@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 +++++ sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
3 5
0 0
[Sound-open-firmware] [PATCH v6 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 30 Nov '22

30 Nov '22
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> To: Eric Biederman <ebiederm(a)xmission.com> To: Chromeos Kdump <chromeos-kdump(a)google.com> To: Steven Rostedt <rostedt(a)goodmis.org> Cc: stable(a)vger.kernel.org Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org Cc: kexec(a)lists.infradead.org Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08ba0@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 +++++ sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
2 3
0 0
[Sound-open-firmware] [PATCH v4] ALSA: core: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 30 Nov '22

30 Nov '22
During kexec(), the userspace is frozen. Therefore we cannot wait for it to complete. Avoid running snd_sof_machine_unregister during shutdown. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] <TASK> [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] <TASK> [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: stable(a)vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org --- Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- sound/soc/sof/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..9616ba607ded 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -475,19 +475,16 @@ EXPORT_SYMBOL(snd_sof_device_remove); int snd_sof_device_shutdown(struct device *dev) { struct snd_sof_dev *sdev = dev_get_drvdata(dev); - struct snd_sof_pdata *pdata = sdev->pdata; if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) cancel_work_sync(&sdev->probe_work); /* - * make sure clients and machine driver(s) are unregistered to force - * all userspace devices to be closed prior to the DSP shutdown sequence + * make sure clients are unregistered prior to the DSP shutdown + * sequence. */ sof_unregister_clients(sdev); - snd_sof_machine_unregister(sdev, pdata); - if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) return snd_sof_shutdown(sdev); --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
4 7
0 0
  • ← Newer
  • 1
  • ...
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • ...
  • 157
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.