Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no relation between disable_irq()/enable_irq() to request_irq(). The same is echoed by Linus in the thread whose link you have posted. disable_irq() can be called without registering for that particular irq number. I tested this module to verify the behaviour and it works. Below is the module code I used</p> <pre><code>#include &lt;linux/module.h&gt; #include &lt;linux/kernel.h&gt; /* Needed for KERN_INFO */ #include &lt;linux/init.h&gt; #include &lt;linux/interrupt.h&gt; MODULE_LICENSE("GPL"); static int __init initialization_routine(void) { disable_irq(15); return 0; } static void __exit cleanup_routine(void) { enable_irq(15); return; } module_init(initialization_routine); module_exit(cleanup_routine); </code></pre> <p>After loading my module...output of /proc/interrupt</p> <pre><code>15: 68321 0 0 0 IO-APIC-edge ata_piix </code></pre> <p>After removing my module...output of /proc/interrupt</p> <pre><code>15: 68325 0 0 0 IO-APIC-edge ata_piix </code></pre> <p>I also, experimented using cli and sti assembly instructions instead of disable_irq() and enable_irq(). But loading the module resulted in the below output in dmesg..</p> <pre><code>[root@localhost 5]# dmesg ------------[ cut here ]------------ WARNING: CPU: 1 PID: 5989 at init/main.c:699 do_one_initcall+0x13e/0x1a0() initcall initialization_routine+0x0/0x9 [test_module] returned with disabled interrupts Modules linked in: test_module(OF+) rfcomm lp bridge bnep 8021q garp stp llc ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 fuse dm_mirror dm_region_hash dm_log dm_mod uinput ppdev parport_pc parport btusb bluetooth rfkill snd_ens1371 snd_rawmidi snd_ac97_codec ac97_bus snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc e1000 microcode sg pcspkr shpchp i2c_piix4 i2c_core ext4(F) jbd2(F) mbcache(F) floppy(F) sd_mod(F) crc_t10dif(F) sr_mod(F) cdrom(F) mptspi(F) mptscsih(F) mptbase(F) scsi_transport_spi(F) pata_acpi(F) ata_generic(F) ata_piix(F) [last unloaded: test_module] CPU: 1 PID: 5989 Comm: insmod Tainted: GF W O 3.11.0-rc2 #5 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2012 00000000000002bb ffff8800271b3d38 ffffffff8154516d 00000000000002bb ffff8800271b3d88 ffff8800271b3d78 ffffffff8104bf1c ffff8800271b3d68 0000000000000000 ffffffffa0540000 0000000000000000 0000000000000000 Call Trace: [&lt;ffffffff8154516d&gt;] dump_stack+0x49/0x5c [&lt;ffffffff8104bf1c&gt;] warn_slowpath_common+0x8c/0xc0 [&lt;ffffffffa0540000&gt;] ? 0xffffffffa053ffff [&lt;ffffffff8104c006&gt;] warn_slowpath_fmt+0x46/0x50 [&lt;ffffffff8126c329&gt;] ? strlcat+0x69/0x80 [&lt;ffffffffa0540000&gt;] ? 0xffffffffa053ffff [&lt;ffffffff8100030e&gt;] do_one_initcall+0x13e/0x1a0 [&lt;ffffffff81077995&gt;] ? __blocking_notifier_call_chain+0x65/0x80 [&lt;ffffffff810b43b4&gt;] do_init_module+0x44/0x1b0 [&lt;ffffffff810b61d2&gt;] load_module+0x5b2/0x6f0 [&lt;ffffffff810b3b00&gt;] ? __unlink_module+0x30/0x30 [&lt;ffffffff810b3280&gt;] ? module_sect_show+0x30/0x30 [&lt;ffffffff810b64d2&gt;] SyS_init_module+0xd2/0x120 [&lt;ffffffff81551d42&gt;] system_call_fastpath+0x16/0x1b ---[ end trace 456a5393bc94bdcf ]--- </code></pre> <p>This might be due to the fact that I am running Linux on a virtual machine. But none the less, sti and cli instructions should never be used directly inside a kernel module. You should always use kernel API's provided for disabling interrupts on a single core rather than disabling them entirely system wide.</p> <p><strong>Edit 1:</strong></p> <p>I presume you are running on a x86 machine. local_irq_disable() eventually calls the below function which executes assembly instruction cli. As you have already mentioned that cli/sti are not working on your system, local_irq_disable()/local_irq_enable() won't too.</p> <pre><code>static inline void native_irq_disable(void) { asm volatile("cli": : :"memory"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload