Skip to content

ASoC: SOF: Intel: HDA: add a parameter to disable MSI - #1058

Merged
ranj063 merged 1 commit into
thesofproject:topic/sof-devfrom
lyakh:msi
Jul 4, 2019
Merged

ranj063 merged 1 commit into
thesofproject:topic/sof-devfrom
lyakh:msi

Conversation

@lyakh

@lyakh lyakh commented Jun 25, 2019

Copy link
Copy Markdown
Collaborator

Enabling MSI on HDA can fail, in which case the legacy PCI IRQ mode
will be used. To make testing this mode easier add an "enable_msi"
module parameter, which is only enabled if debugging is enabled too.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit-picks below
The code will conflict with upstream with the CONFIG_PCI parts removed recently

Comment thread sound/soc/sof/intel/hda.c Outdated
static bool hda_use_msi = IS_ENABLED(CONFIG_PCI);
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG)
module_param_named(use_msi, hda_use_msi, bool, 0444);
MODULE_PARM_DESC(use_msi, "SOF PCI use MSI mode");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOF HDA use PCI MSI mode? This isn't a generic PCI thing.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart updated

Comment thread sound/soc/sof/intel/hda.c
}
#endif
if (ret < 0) {
if (!sdev->msi_enabled) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't really need a new field that isn't used anywhere else, a local variable would do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart it isn't new at all, I just changed its type. And yes, it is used in multiple functions, so, no, it cannot be a local variable

plbossart
plbossart previously approved these changes Jun 27, 2019
ranj063
ranj063 previously approved these changes Jun 28, 2019
@ranj063

ranj063 commented Jun 28, 2019

Copy link
Copy Markdown
Collaborator

@lyakh the branch needs to be rebased

@lyakh

lyakh commented Jul 1, 2019

Copy link
Copy Markdown
Collaborator Author

minor nit-picks below
The code will conflict with upstream with the CONFIG_PCI parts removed recently

@plbossart Ok, thanks for a heads-up, @ranj063 I'll wait until that code gets pulled then.

Enabling MSI on HDA can fail, in which case the legacy PCI IRQ mode
will be used. To make testing this mode easier add an "enable_msi"
module parameter, which is only enabled if debugging is enabled too.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh
lyakh dismissed stale reviews from ranj063 and plbossart via dd80be8 July 3, 2019 07:03
@lyakh

lyakh commented Jul 3, 2019

Copy link
Copy Markdown
Collaborator Author

@ranj063 @plbossart should be ok now

@ranj063 ranj063 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. need another approval

@wenqingfu
wenqingfu requested review from RanderWang and libinyang July 3, 2019 18:02
@keyonjie

keyonjie commented Jul 4, 2019

Copy link
Copy Markdown

@lyakh with your implementation, once CONFIG_SND_SOC_SOF_DEBUG is selected, we will disable MSI by default(unless we specify it in module param), is my understanding correct?

@ranj063

ranj063 commented Jul 4, 2019

Copy link
Copy Markdown
Collaborator

@lyakh with your implementation, once CONFIG_SND_SOC_SOF_DEBUG is selected, we will disable MSI by default(unless we specify it in module param), is my understanding correct?

@keyonjie the default value will stick even if CONFIG_SND_SOC_SOF_DEBUG is enabled unless something else is written to it

@keyonjie

keyonjie commented Jul 4, 2019

Copy link
Copy Markdown

@lyakh with your implementation, once CONFIG_SND_SOC_SOF_DEBUG is selected, we will disable MSI by default(unless we specify it in module param), is my understanding correct?

@keyonjie the default value will stick even if CONFIG_SND_SOC_SOF_DEBUG is enabled unless something else is written to it

OK, makes sense then. So normally what is the recommended method for this those module params debugging? Adding a .conf in to /etc/modprobe.d/ folder? As our modules are probed automatically at boot.

@ranj063

ranj063 commented Jul 4, 2019

Copy link
Copy Markdown
Collaborator

OK, makes sense then. So normally what is the recommended method for this those module params debugging? Adding a .conf in to /etc/modprobe.d/ folder? As our modules are probed automatically at boot.

Yes, or you should specify the parameter with a value with insmod

@ranj063

ranj063 commented Jul 4, 2019

Copy link
Copy Markdown
Collaborator

@keyonjie please approve if you're OK with this PR

@keyonjie keyonjie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@ranj063
ranj063 merged commit 7fa1499 into thesofproject:topic/sof-dev Jul 4, 2019
@lyakh
lyakh deleted the msi branch July 4, 2019 06:30
oder-chiou pushed a commit to oder-chiou/linux-soundwire that referenced this pull request May 5, 2026
In the cited commit, copy_to_user() got called with the wrong pointer,
instead of passing the actual buffer ptr to copy from, a pointer to
the pointer got passed, which causes a buffer overflow calltrace to pop
up when executing "ethtool -x ethX".

Fix ethtool_rxnfc_copy_to_user() to use the rxnfc pointer as passed
to the function, instead of a pointer to it.

This fixes below call trace:
[   15.533533] ------------[ cut here ]------------
[   15.539007] Buffer overflow detected (8 < 192)!
[   15.544110] WARNING: CPU: 3 PID: 1801 at include/linux/thread_info.h:200 copy_overflow+0x15/0x20
[   15.549308] Modules linked in:
[   15.551449] CPU: 3 PID: 1801 Comm: ethtool Not tainted 5.14.0-rc2+ thesofproject#1058
[   15.553919] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
[   15.558378] RIP: 0010:copy_overflow+0x15/0x20
[   15.560648] Code: e9 7c ff ff ff b8 a1 ff ff ff eb c4 66 0f 1f 84 00 00 00 00 00 55 48 89 f2 89 fe 48 c7 c7 88 55 78 8a 48 89 e5 e8 06 5c 1e 00 <0f> 0b 5d c3 0f 1f 80 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 55
[   15.565114] RSP: 0018:ffffad49c0523bd0 EFLAGS: 00010286
[   15.566231] RAX: 0000000000000000 RBX: 00000000000000c0 RCX: 0000000000000000
[   15.567616] RDX: 0000000000000001 RSI: ffffffff8a7912e7 RDI: 00000000ffffffff
[   15.569050] RBP: ffffad49c0523bd0 R08: ffffffff8ab2ae28 R09: 00000000ffffdfff
[   15.570534] R10: ffffffff8aa4ae40 R11: ffffffff8aa4ae40 R12: 0000000000000000
[   15.571899] R13: 00007ffd4cc2a230 R14: ffffad49c0523c00 R15: 0000000000000000
[   15.573584] FS:  00007f538112f740(0000) GS:ffff96d5bdd80000(0000) knlGS:0000000000000000
[   15.575639] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   15.577092] CR2: 00007f5381226d40 CR3: 0000000013542000 CR4: 00000000001506e0
[   15.578929] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   15.580695] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   15.582441] Call Trace:
[   15.582970]  ethtool_rxnfc_copy_to_user+0x30/0x46
[   15.583815]  ethtool_get_rxnfc.cold+0x23/0x2b
[   15.584584]  dev_ethtool+0x29c/0x25f0
[   15.585286]  ? security_netlbl_sid_to_secattr+0x77/0xd0
[   15.586728]  ? do_set_pte+0xc4/0x110
[   15.587349]  ? _raw_spin_unlock+0x18/0x30
[   15.588118]  ? __might_sleep+0x49/0x80
[   15.588956]  dev_ioctl+0x2c1/0x490
[   15.589616]  sock_ioctl+0x18e/0x330
[   15.591143]  __x64_sys_ioctl+0x41c/0x990
[   15.591823]  ? irqentry_exit_to_user_mode+0x9/0x20
[   15.592657]  ? irqentry_exit+0x33/0x40
[   15.593308]  ? exc_page_fault+0x32f/0x770
[   15.593877]  ? exit_to_user_mode_prepare+0x3c/0x130
[   15.594775]  do_syscall_64+0x35/0x80
[   15.595397]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[   15.596037] RIP: 0033:0x7f5381226d4b
[   15.596492] Code: 0f 1e fa 48 8b 05 3d b1 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 0d b1 0c 00 f7 d8 64 89 01 48
[   15.598743] RSP: 002b:00007ffd4cc2a1f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[   15.599804] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5381226d4b
[   15.600795] RDX: 00007ffd4cc2a350 RSI: 0000000000008946 RDI: 0000000000000003
[   15.601712] RBP: 00007ffd4cc2a340 R08: 00007ffd4cc2a350 R09: 0000000000000001
[   15.602751] R10: 00007f538128a990 R11: 0000000000000246 R12: 0000000000000000
[   15.603882] R13: 00007ffd4cc2a350 R14: 00007ffd4cc2a4b0 R15: 0000000000000000
[   15.605042] ---[ end trace 325cf185e2795048 ]---

Fixes: dd98d28 ("ethtool: improve compat ioctl handling")
Reported-by: Shannon Nelson <snelson@pensando.io>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Christoph Hellwig <hch@lst.de>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Tested-by: Shannon Nelson <snelson@pensando.io>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
oder-chiou pushed a commit to oder-chiou/linux-soundwire that referenced this pull request May 5, 2026
The code in vmd_shutdown() had an indentation issue where spaces were
used instead of tabs. This commit corrects the indentation to use tabs,
adhering to the Linux kernel coding style guidelines.

Issue reported by the checkpatch.pl script:

  ERROR: code indent should use tabs where possible
  thesofproject#1056: FILE: drivers/pci/controller/vmd.c:1056:
  +        struct vmd_dev *vmd = pci_get_drvdata(dev);$

  WARNING: please, no spaces at the start of a line
  thesofproject#1056: FILE: drivers/pci/controller/vmd.c:1056:
  +        struct vmd_dev *vmd = pci_get_drvdata(dev);$

  ERROR: code indent should use tabs where possible
  thesofproject#1058: FILE: drivers/pci/controller/vmd.c:1058:
  +        vmd_remove_irq_domain(vmd);$

  WARNING: please, no spaces at the start of a line
  thesofproject#1058: FILE: drivers/pci/controller/vmd.c:1058:
  +        vmd_remove_irq_domain(vmd);$

No functional changes are intended.

Link: https://lore.kernel.org/linux-pci/20240901092602.17414-1-riyandhiman14@gmail.com
Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants