Tuesday, January 7, 2014

linux.kernel - 26 new messages in 13 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* leds: s3c24xx: Fix build failure - 2 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/9e23ac5fd7e70adf?hl=en
* mmc: sdhci-acpi: convert to use GPIO descriptor API - 3 messages, 1 author
http://groups.google.com/group/linux.kernel/t/6c9c75b326e32788?hl=en
* sysfs warnings since kernel 3.13-rc1: "WARNING: ... at fs/sysfs/group.c:214
sysfs_remove_group" - 2 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/a38fa27af05ff8f6?hl=en
* Regression (ARM) arch/arm/mm/init.c doesn't build without CONFIG_ARM_PATCH_
PHYS_VIRT. - 2 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/4b9ee9123d2204c8?hl=en
* checkpatch: Only flag FSF address, not gnu.org URL - 2 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/ce2c23b367d91ff7?hl=en
* futex: Avoid taking hb lock if nothing to wakeup - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/af4a2848ad48ded5?hl=en
* x86: Add check for number of available vectors before CPU down [v6] - 1
messages, 1 author
http://groups.google.com/group/linux.kernel/t/3ccfd69cb2196147?hl=en
* gpio: davinci: reuse for keystone arch - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/85206239619a73b5?hl=en
* staging/media: fix sn9c102 dependencies - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/e208d36ae1172b68?hl=en
* lib/vsprintf: add %pT[C012] format specifier - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/40f2db64b3df6ee9?hl=en
* kernfs: remove KERNFS_REMOVED - 8 messages, 1 author
http://groups.google.com/group/linux.kernel/t/b72ccc5edcdfb313?hl=en
* kobject: provide kobject_put_wait to fix module unload race - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/f1e8d59a892ab84a?hl=en
* OMAPDSS: DISPC: horizontal timing too tight errors - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/f2b09789ae626fc0?hl=en

==============================================================================
TOPIC: leds: s3c24xx: Fix build failure
http://groups.google.com/group/linux.kernel/t/9e23ac5fd7e70adf?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Linus Walleij


On Fri, Jan 3, 2014 at 7:19 AM, Bryan Wu <cooloney@gmail.com> wrote:
> On Thu, Jan 2, 2014 at 9:25 PM, Tushar Behera <tushar.behera@linaro.org> wrote:
>> Commit c67d0f29262b ("ARM: s3c24xx: get rid of custom <mach/gpio.h>")
>> removed the usage of mach/gpio.h file, but we need to include
>> plat/gpio-cfg.h to avoid following build error.
>>
>> Fixes following build error.
>> drivers/leds/leds-s3c24xx.c: In function �s3c24xx_led_probe�:
>> drivers/leds/leds-s3c24xx.c:100:2: error: implicit declaration of
>> function �s3c_gpio_setpull� [-Werror=implicit-function-declaration]
>>
>
> I think this patch should go with Linus's patchset.

Patch applied to the GPIO tree. I added your ACK Bryan since
that seems to be implied above ...

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Bryan Wu


On Tue, Jan 7, 2014 at 9:41 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Jan 3, 2014 at 7:19 AM, Bryan Wu <cooloney@gmail.com> wrote:
>> On Thu, Jan 2, 2014 at 9:25 PM, Tushar Behera <tushar.behera@linaro.org> wrote:
>>> Commit c67d0f29262b ("ARM: s3c24xx: get rid of custom <mach/gpio.h>")
>>> removed the usage of mach/gpio.h file, but we need to include
>>> plat/gpio-cfg.h to avoid following build error.
>>>
>>> Fixes following build error.
>>> drivers/leds/leds-s3c24xx.c: In function �s3c24xx_led_probe�:
>>> drivers/leds/leds-s3c24xx.c:100:2: error: implicit declaration of
>>> function �s3c_gpio_setpull� [-Werror=implicit-function-declaration]
>>>
>>
>> I think this patch should go with Linus's patchset.
>
> Patch applied to the GPIO tree. I added your ACK Bryan since
> that seems to be implied above ...
>
Sure, thanks.
-Bryan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: mmc: sdhci-acpi: convert to use GPIO descriptor API
http://groups.google.com/group/linux.kernel/t/6c9c75b326e32788?hl=en
==============================================================================

== 1 of 3 ==
Date: Tues, Jan 7 2014 9:50 am
From: Linus Walleij


On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> The new descriptor based GPIO interface is now the recommended and safer
> way of using GPIOs from device drivers. Convert the ACPI SDHCI driver to
> use that interface.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> Acked-by: Alexandre Courbot <acourbot@nvidia.com>

Chris, can I have your ACK on this patch?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 3 ==
Date: Tues, Jan 7 2014 9:50 am
From: Linus Walleij


On Mon, Dec 23, 2013 at 10:14 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2013-12-23 at 12:54 +0200, Mika Westerberg wrote:
>> On Wed, Dec 11, 2013 at 01:00:18PM +0100, Linus Walleij wrote:
>> > On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
>> > <mika.westerberg@linux.intel.com> wrote:
>> >
>> > > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> > >
>> > > Convert to the safer gpiod_* family of API functions.
>> > >
>> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> > > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> > > Tested-by: Stephen Warren <swarren@nvidia.com>
>>
>> Johannes B, David M,
>>
>> Are you fine with this patch? If yes, could you ack it so that we could get
>> it merged for 3.14.
>
> I have no objection to this particular patch. I can't really comment on
> it, but I never really delved too deeply into the rfkill-gpio thing - I
> guess it works for whoever needed it :)

I take that as an ACK ;-)

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 3 of 3 ==
Date: Tues, Jan 7 2014 10:00 am
From: Linus Walleij


On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:

> Instead of asking each driver to register to ACPI events we can just call
> acpi_gpiochip_register_interrupts() for each chip that has an ACPI handle.
> The function checks chip->to_irq and if it is set to NULL (a GPIO driver
> that doesn't do interrupts) the function does nothing.
>
> We also add the a new header drivers/gpio/gpiolib.h that is used for
> functions internal to gpiolib and add ACPI GPIO chip registering functions
> to that header.
>
> Once that is done we can remove call to acpi_gpiochip_register_interrupts()
> from its only user, pinctrl-baytrail.c
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Two questions:

- Can you please rebase patches 3-6 on my GPIO tree "devel" branch?

- Can this patch be placed first? It does not seem to depend on the
others, to to push dependent patches to the end of the series.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: sysfs warnings since kernel 3.13-rc1: "WARNING: ... at fs/sysfs/group.c:
214 sysfs_remove_group"
http://groups.google.com/group/linux.kernel/t/a38fa27af05ff8f6?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Frank Schäfer


Hi,

since

commit bcdde7e221a8750f9b62b6d0bd31b72ea4ad9309
Author: Tejun Heo <tj@kernel.org>
Date: Wed Sep 18 17:15:37 2013 -0400

sysfs: make __sysfs_remove_dir() recursive

Currently, sysfs directory removal is inconsistent in that it would
remove any files directly under it but wouldn't recurse into
directories. Thanks to group subdirectories, this doesn't even match
with kobject boundaries. sysfs is in the process of being separated
out so that it can be used by multiple subsystems and we want to have
a consistent behavior - either removal of a sysfs_dirent should remove
every descendant entries or none instead of something inbetween.

This patch implements proper recursive removal in
__sysfs_remove_dir(). The function now walks its subtree in a
post-order walk to remove all descendants.

This is a behavior change but kobject / driver layer, which currently
is the only consumer, has already been updated to handle duplicate
removal attempts, so nothing should be broken after this change.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>



I'm getting several sysfs related warnings when closing disconnected
em28xx USB devices:

[ 447.408658] ------------[ cut here ]------------
[ 447.408676] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 447.408681] sysfs group c0a10100 not found for kobject 'vbi1'
[ 447.408685] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 447.408842] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
3.13.0-rc7-0.1-desktop+ #76
[ 447.408848] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 447.408852] 00000000 00000000 e7205e38 c077985c e7205e78 e7205e68
c02401df c092bedc
[ 447.408866] e7205e94 000009b9 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 447.408876] e81a180c e7205e80 c024027e 00000009 e7205e78 c092bedc
e7205e94 e7205ea8
[ 447.408887] Call Trace:
[ 447.408901] [<c077985c>] dump_stack+0x48/0x69
[ 447.408911] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 447.408920] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.408927] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.408934] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 447.408942] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 447.408951] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 447.408959] [<c05940ac>] device_del+0x2c/0x150
[ 447.408965] [<c05941ec>] device_unregister+0x1c/0x60
[ 447.408972] [<c077644a>] ? printk+0x48/0x4a
[ 447.408998] [<f8b576e8>] video_unregister_device+0x38/0x40 [videodev]
[ 447.409092] [<f9a028a4>] em28xx_release_analog_resources+0xc4/0x100
[em28xx]
[ 447.409122] [<f9a0572b>] em28xx_release_resources+0xb/0x70 [em28xx]
[ 447.409132] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
[ 447.409141] [<c0360ce5>] ? dput+0x15/0xe0
[ 447.409160] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
[ 447.409170] [<c034df2b>] __fput+0xab/0x1d0
[ 447.409177] [<c034e088>] ____fput+0x8/0x10
[ 447.409186] [<c025a709>] task_work_run+0x79/0x90
[ 447.409193] [<c0202141>] do_notify_resume+0x51/0x80
[ 447.409201] [<c077fffb>] work_notifysig+0x24/0x29
[ 447.409206] ---[ end trace 1e95e1c9d6c9c835 ]---
[ 447.411141] em2882/3 #0: V4L2 device video1 deregistered
[ 447.411145] ------------[ cut here ]------------
[ 447.411152] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 447.411154] sysfs group c0a10100 not found for kobject 'video1'
[ 447.411202] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 447.411243] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
3.13.0-rc7-0.1-desktop+ #76
[ 447.411246] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 447.411253] 00000000 00000000 e7205e38 c077985c e7205e78 e7205e68
c02401df c092bedc
[ 447.411260] e7205e94 000009b9 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 447.411266] f526780c e7205e80 c024027e 00000009 e7205e78 c092bedc
e7205e94 e7205ea8
[ 447.411267] Call Trace:
[ 447.411273] [<c077985c>] dump_stack+0x48/0x69
[ 447.411278] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 447.411284] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.411289] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.411293] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 447.411298] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 447.411303] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 447.411307] [<c05940ac>] device_del+0x2c/0x150
[ 447.411311] [<c05941ec>] device_unregister+0x1c/0x60
[ 447.411315] [<c077644a>] ? printk+0x48/0x4a
[ 447.411334] [<f8b576e8>] video_unregister_device+0x38/0x40 [videodev]
[ 447.411344] [<f9a02867>] em28xx_release_analog_resources+0x87/0x100
[em28xx]
[ 447.411353] [<f9a0572b>] em28xx_release_resources+0xb/0x70 [em28xx]
[ 447.411360] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
[ 447.411365] [<c0360ce5>] ? dput+0x15/0xe0
[ 447.411380] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
[ 447.411385] [<c034df2b>] __fput+0xab/0x1d0
[ 447.411391] [<c034e088>] ____fput+0x8/0x10
[ 447.411397] [<c025a709>] task_work_run+0x79/0x90
[ 447.411401] [<c0202141>] do_notify_resume+0x51/0x80
[ 447.411406] [<c077fffb>] work_notifysig+0x24/0x29
[ 447.411408] ---[ end trace 1e95e1c9d6c9c836 ]---
[ 447.411730] ------------[ cut here ]------------
[ 447.411737] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 447.411739] sysfs group c0a10100 not found for kobject '10-005c'
[ 447.411787] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 447.411826] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
3.13.0-rc7-0.1-desktop+ #76
[ 447.411828] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 447.411836] 00000000 00000000 e7205de8 c077985c e7205e28 e7205e18
c02401df c092bedc
[ 447.411842] e7205e44 000009b9 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 447.411848] e4ccce24 e7205e30 c024027e 00000009 e7205e28 c092bedc
e7205e44 e7205e58
[ 447.411849] Call Trace:
[ 447.411855] [<c077985c>] dump_stack+0x48/0x69
[ 447.411860] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 447.411865] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.411870] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.411874] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 447.411880] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 447.411885] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 447.411889] [<c05940ac>] device_del+0x2c/0x150
[ 447.411895] [<c064b8f0>] ? __unregister_dummy+0x30/0x30
[ 447.411899] [<c05941ec>] device_unregister+0x1c/0x60
[ 447.411903] [<c064b60b>] i2c_unregister_device+0xb/0x10
[ 447.411908] [<c064b923>] __unregister_client+0x33/0x40
[ 447.411912] [<c05936bc>] device_for_each_child+0x2c/0x60
[ 447.411917] [<c064cba8>] i2c_del_adapter+0x158/0x2c0
[ 447.411921] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
[ 447.411925] [<c077644a>] ? printk+0x48/0x4a
[ 447.411936] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
[ 447.411944] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
[ 447.411952] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
[ 447.411956] [<c0360ce5>] ? dput+0x15/0xe0
[ 447.411974] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
[ 447.411979] [<c034df2b>] __fput+0xab/0x1d0
[ 447.411984] [<c034e088>] ____fput+0x8/0x10
[ 447.411990] [<c025a709>] task_work_run+0x79/0x90
[ 447.411994] [<c0202141>] do_notify_resume+0x51/0x80
[ 447.411999] [<c077fffb>] work_notifysig+0x24/0x29
[ 447.412029] ---[ end trace 1e95e1c9d6c9c837 ]---
[ 447.412076] ------------[ cut here ]------------
[ 447.412083] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 447.412085] sysfs group c0a10100 not found for kobject '10-0061'
[ 447.412130] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 447.412168] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
3.13.0-rc7-0.1-desktop+ #76
[ 447.412170] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 447.412177] 00000000 00000000 e7205de8 c077985c e7205e28 e7205e18
c02401df c092bedc
[ 447.412184] e7205e44 000009b9 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 447.412190] e8314224 e7205e30 c024027e 00000009 e7205e28 c092bedc
e7205e44 e7205e58
[ 447.412191] Call Trace:
[ 447.412197] [<c077985c>] dump_stack+0x48/0x69
[ 447.412201] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 447.412207] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.412212] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.412216] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 447.412221] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 447.412226] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 447.412230] [<c05940ac>] device_del+0x2c/0x150
[ 447.412235] [<c064b8f0>] ? __unregister_dummy+0x30/0x30
[ 447.412238] [<c05941ec>] device_unregister+0x1c/0x60
[ 447.412242] [<c05933ff>] ? put_device+0xf/0x20
[ 447.412246] [<c059341b>] ? klist_children_put+0xb/0x10
[ 447.412250] [<c064b60b>] i2c_unregister_device+0xb/0x10
[ 447.412254] [<c064b923>] __unregister_client+0x33/0x40
[ 447.412258] [<c05936bc>] device_for_each_child+0x2c/0x60
[ 447.412263] [<c064cba8>] i2c_del_adapter+0x158/0x2c0
[ 447.412267] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
[ 447.412271] [<c077644a>] ? printk+0x48/0x4a
[ 447.412281] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
[ 447.412290] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
[ 447.412297] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
[ 447.412301] [<c0360ce5>] ? dput+0x15/0xe0
[ 447.412318] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
[ 447.412324] [<c034df2b>] __fput+0xab/0x1d0
[ 447.412329] [<c034e088>] ____fput+0x8/0x10
[ 447.412334] [<c025a709>] task_work_run+0x79/0x90
[ 447.412338] [<c0202141>] do_notify_resume+0x51/0x80
[ 447.412343] [<c077fffb>] work_notifysig+0x24/0x29
[ 447.412346] ---[ end trace 1e95e1c9d6c9c838 ]---
[ 447.412367] xc2028 10-0061: destroying instance
[ 447.412391] ------------[ cut here ]------------
[ 447.412398] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 447.412399] sysfs group c0a10100 not found for kobject 'i2c-10'
[ 447.412444] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 447.412482] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
3.13.0-rc7-0.1-desktop+ #76
[ 447.412484] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 447.412491] 00000000 00000000 e7205e18 c077985c e7205e58 e7205e48
c02401df c092bedc
[ 447.412498] e7205e74 000009b9 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 447.412504] e8073220 e7205e60 c024027e 00000009 e7205e58 c092bedc
e7205e74 e7205e88
[ 447.412505] Call Trace:
[ 447.412511] [<c077985c>] dump_stack+0x48/0x69
[ 447.412515] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 447.412521] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.412525] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 447.412530] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 447.412535] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 447.412540] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 447.412544] [<c05940ac>] device_del+0x2c/0x150
[ 447.412548] [<c05941ec>] device_unregister+0x1c/0x60
[ 447.412553] [<c03af3b1>] ? sysfs_remove_link+0x11/0x30
[ 447.412558] [<c0597c5f>] ? class_compat_remove_link+0x2f/0x50
[ 447.412563] [<c064cc04>] i2c_del_adapter+0x1b4/0x2c0
[ 447.412567] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
[ 447.412571] [<c077644a>] ? printk+0x48/0x4a
[ 447.412581] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
[ 447.412590] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
[ 447.412597] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
[ 447.412601] [<c0360ce5>] ? dput+0x15/0xe0
[ 447.412618] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
[ 447.412623] [<c034df2b>] __fput+0xab/0x1d0
[ 447.412628] [<c034e088>] ____fput+0x8/0x10
[ 447.412634] [<c025a709>] task_work_run+0x79/0x90
[ 447.412638] [<c0202141>] do_notify_resume+0x51/0x80
[ 447.412643] [<c077fffb>] work_notifysig+0x24/0x29
[ 447.412645] ---[ end trace 1e95e1c9d6c9c839 ]---



I'm also getting this error when unmounting a disconnecting a USB mass
storage device:

[ 180.527140] WARNING: CPU: 0 PID: 2145 at fs/sysfs/group.c:214
sysfs_remove_group+0xc9/0xd0()
[ 180.527142] sysfs group c0a10100 not found for kobject 'target11:0:0'
[ 180.527144] Modules linked in: nls_iso8859_1 nls_cp437 vfat fat
xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit ip6t_REJECT
nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT iptable_raw
xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
[ 180.527204] CPU: 0 PID: 2145 Comm: bash Not tainted
3.13.0-rc7-0.1-desktop+ #76
[ 180.527206] Hardware name: System manufacturer System Product
Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
[ 180.527208] 00000000 00000000 f6531bcc c077985c f6531c0c f6531bfc
c02401df c092bedc
[ 180.527213] f6531c28 00000861 c0935e02 000000d6 c03afe89 c03afe89
00000000 c0a10100
[ 180.527217] f527761c f6531c14 c024027e 00000009 f6531c0c c092bedc
f6531c28 f6531c3c
[ 180.527221] Call Trace:
[ 180.527227] [<c077985c>] dump_stack+0x48/0x69
[ 180.527231] [<c02401df>] warn_slowpath_common+0x7f/0xa0
[ 180.527234] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 180.527237] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
[ 180.527240] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
[ 180.527243] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
[ 180.527246] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
[ 180.527249] [<c05940ac>] device_del+0x2c/0x150
[ 180.527253] [<c05cb0d6>] scsi_target_reap_usercontext+0x26/0x40
[ 180.527257] [<c0256d44>] execute_in_process_context+0x44/0x50
[ 180.527260] [<c05cc6ec>] scsi_target_reap+0x8c/0xb0
[ 180.527263] [<c05ce372>] scsi_device_dev_release_usercontext+0x122/0x150
[ 180.527266] [<c0256d44>] execute_in_process_context+0x44/0x50
[ 180.527268] [<c05cdf13>] scsi_device_dev_release+0x13/0x20
[ 180.527271] [<c059362c>] device_release+0x2c/0x90
[ 180.527273] [<c0593633>] ? device_release+0x33/0x90
[ 180.527276] [<c04a8058>] kobject_cleanup+0x78/0x1b0
[ 180.527279] [<c04a8070>] ? kobject_cleanup+0x90/0x1b0
[ 180.527282] [<c04915f4>] ? part_release+0x24/0x30
[ 180.527286] [<c0317097>] ? free_percpu+0x77/0x100
[ 180.527290] [<c04a81c5>] kobject_put+0x25/0x60
[ 180.527293] [<c05c18b7>] ? scsi_device_put+0x47/0x50
[ 180.527296] [<c05933ff>] put_device+0xf/0x20
[ 180.527299] [<c05c189f>] scsi_device_put+0x2f/0x50
[ 180.527302] [<c05d138a>] scsi_disk_put+0x2a/0x40
[ 180.527305] [<c05d1c7f>] sd_release+0x3f/0xd0
[ 180.527308] [<c037e574>] __blkdev_put+0x124/0x170
[ 180.527311] [<c037e547>] __blkdev_put+0xf7/0x170
[ 180.527313] [<c037e604>] blkdev_put+0x44/0x110
[ 180.527318] [<c034f23c>] kill_block_super+0x3c/0x70
[ 180.527321] [<c034e81a>] deactivate_locked_super+0x3a/0x60
[ 180.527323] [<c034f4f2>] deactivate_super+0x42/0x60
[ 180.527326] [<c036779d>] mntput_no_expire+0xad/0x120
[ 180.527329] [<c0367828>] mntput+0x18/0x30
[ 180.527332] [<c0355085>] path_put+0x15/0x20
[ 180.527335] [<c0376756>] free_fs_struct+0x16/0x30
[ 180.527338] [<c03767df>] exit_fs+0x6f/0x80
[ 180.527341] [<c024203a>] do_exit+0x24a/0x980
[ 180.527344] [<c024d558>] ? dequeue_signal+0x78/0x180
[ 180.527347] [<c024285f>] do_group_exit+0x2f/0x90
[ 180.527350] [<c024fb39>] get_signal_to_deliver+0x239/0x5e0
[ 180.527354] [<c0202033>] do_signal+0x33/0xf0
[ 180.527357] [<c02017c5>] ? restore_sigcontext+0xe5/0x110
[ 180.527359] [<c0202397>] ? sys_sigreturn+0x97/0xa0
[ 180.527362] [<c0202155>] do_notify_resume+0x65/0x80
[ 180.527365] [<c077fffb>] work_notifysig+0x24/0x29
[ 180.527367] ---[ end trace 1e95e1c9d6c9c834 ]---


Both are 100% reproducable.

I assume the warning means that something unexpected happened.
So how can these warnings be fixed ?

Regards,
Frank Sch�fer



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 2 ==
Date: Tues, Jan 7 2014 10:00 am
From: Tejun Heo


Hello,

cc'ing Mauro and quoting whole body for him.

So, ummm, the sysfs rule was that any group below a device should be
removed before the device itself is removed; however, nothing really
checked whether this actually was the case. We didn't care whether
the order was reversed and if somebody forgot to remove the group
afterwards, we just leaked it. After this commit, sysfs now whines if
the order is reversed, so the warning.

While this should probably be fixed from the v4l side, I'm really
skeptical we're gaining anything by requiring users to explicitly
remove groups during device removal. In most cases, this is a
completely unnecessary task. Maybe we should just hunt down all
remove_group calls and remove all the unnecessary ones.

Thanks.

On Tue, Jan 07, 2014 at 06:44:58PM +0100, Frank Sch�fer wrote:
> Hi,
>
> since
>
> commit bcdde7e221a8750f9b62b6d0bd31b72ea4ad9309
> Author: Tejun Heo <tj@kernel.org>
> Date: Wed Sep 18 17:15:37 2013 -0400
>
> sysfs: make __sysfs_remove_dir() recursive
>
> Currently, sysfs directory removal is inconsistent in that it would
> remove any files directly under it but wouldn't recurse into
> directories. Thanks to group subdirectories, this doesn't even match
> with kobject boundaries. sysfs is in the process of being separated
> out so that it can be used by multiple subsystems and we want to have
> a consistent behavior - either removal of a sysfs_dirent should remove
> every descendant entries or none instead of something inbetween.
>
> This patch implements proper recursive removal in
> __sysfs_remove_dir(). The function now walks its subtree in a
> post-order walk to remove all descendants.
>
> This is a behavior change but kobject / driver layer, which currently
> is the only consumer, has already been updated to handle duplicate
> removal attempts, so nothing should be broken after this change.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
>
>
> I'm getting several sysfs related warnings when closing disconnected
> em28xx USB devices:
>
> [ 447.408658] ------------[ cut here ]------------
> [ 447.408676] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 447.408681] sysfs group c0a10100 not found for kobject 'vbi1'
> [ 447.408685] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
> snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
> videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
> nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
> ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
> iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 447.408842] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
> 3.13.0-rc7-0.1-desktop+ #76
> [ 447.408848] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 447.408852] 00000000 00000000 e7205e38 c077985c e7205e78 e7205e68
> c02401df c092bedc
> [ 447.408866] e7205e94 000009b9 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 447.408876] e81a180c e7205e80 c024027e 00000009 e7205e78 c092bedc
> e7205e94 e7205ea8
> [ 447.408887] Call Trace:
> [ 447.408901] [<c077985c>] dump_stack+0x48/0x69
> [ 447.408911] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 447.408920] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.408927] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.408934] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 447.408942] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 447.408951] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 447.408959] [<c05940ac>] device_del+0x2c/0x150
> [ 447.408965] [<c05941ec>] device_unregister+0x1c/0x60
> [ 447.408972] [<c077644a>] ? printk+0x48/0x4a
> [ 447.408998] [<f8b576e8>] video_unregister_device+0x38/0x40 [videodev]
> [ 447.409092] [<f9a028a4>] em28xx_release_analog_resources+0xc4/0x100
> [em28xx]
> [ 447.409122] [<f9a0572b>] em28xx_release_resources+0xb/0x70 [em28xx]
> [ 447.409132] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
> [ 447.409141] [<c0360ce5>] ? dput+0x15/0xe0
> [ 447.409160] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
> [ 447.409170] [<c034df2b>] __fput+0xab/0x1d0
> [ 447.409177] [<c034e088>] ____fput+0x8/0x10
> [ 447.409186] [<c025a709>] task_work_run+0x79/0x90
> [ 447.409193] [<c0202141>] do_notify_resume+0x51/0x80
> [ 447.409201] [<c077fffb>] work_notifysig+0x24/0x29
> [ 447.409206] ---[ end trace 1e95e1c9d6c9c835 ]---
> [ 447.411141] em2882/3 #0: V4L2 device video1 deregistered
> [ 447.411145] ------------[ cut here ]------------
> [ 447.411152] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 447.411154] sysfs group c0a10100 not found for kobject 'video1'
> [ 447.411202] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
> snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
> videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
> nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
> ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
> iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 447.411243] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
> 3.13.0-rc7-0.1-desktop+ #76
> [ 447.411246] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 447.411253] 00000000 00000000 e7205e38 c077985c e7205e78 e7205e68
> c02401df c092bedc
> [ 447.411260] e7205e94 000009b9 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 447.411266] f526780c e7205e80 c024027e 00000009 e7205e78 c092bedc
> e7205e94 e7205ea8
> [ 447.411267] Call Trace:
> [ 447.411273] [<c077985c>] dump_stack+0x48/0x69
> [ 447.411278] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 447.411284] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.411289] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.411293] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 447.411298] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 447.411303] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 447.411307] [<c05940ac>] device_del+0x2c/0x150
> [ 447.411311] [<c05941ec>] device_unregister+0x1c/0x60
> [ 447.411315] [<c077644a>] ? printk+0x48/0x4a
> [ 447.411334] [<f8b576e8>] video_unregister_device+0x38/0x40 [videodev]
> [ 447.411344] [<f9a02867>] em28xx_release_analog_resources+0x87/0x100
> [em28xx]
> [ 447.411353] [<f9a0572b>] em28xx_release_resources+0xb/0x70 [em28xx]
> [ 447.411360] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
> [ 447.411365] [<c0360ce5>] ? dput+0x15/0xe0
> [ 447.411380] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
> [ 447.411385] [<c034df2b>] __fput+0xab/0x1d0
> [ 447.411391] [<c034e088>] ____fput+0x8/0x10
> [ 447.411397] [<c025a709>] task_work_run+0x79/0x90
> [ 447.411401] [<c0202141>] do_notify_resume+0x51/0x80
> [ 447.411406] [<c077fffb>] work_notifysig+0x24/0x29
> [ 447.411408] ---[ end trace 1e95e1c9d6c9c836 ]---
> [ 447.411730] ------------[ cut here ]------------
> [ 447.411737] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 447.411739] sysfs group c0a10100 not found for kobject '10-005c'
> [ 447.411787] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
> snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
> videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
> nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
> ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
> iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 447.411826] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
> 3.13.0-rc7-0.1-desktop+ #76
> [ 447.411828] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 447.411836] 00000000 00000000 e7205de8 c077985c e7205e28 e7205e18
> c02401df c092bedc
> [ 447.411842] e7205e44 000009b9 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 447.411848] e4ccce24 e7205e30 c024027e 00000009 e7205e28 c092bedc
> e7205e44 e7205e58
> [ 447.411849] Call Trace:
> [ 447.411855] [<c077985c>] dump_stack+0x48/0x69
> [ 447.411860] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 447.411865] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.411870] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.411874] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 447.411880] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 447.411885] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 447.411889] [<c05940ac>] device_del+0x2c/0x150
> [ 447.411895] [<c064b8f0>] ? __unregister_dummy+0x30/0x30
> [ 447.411899] [<c05941ec>] device_unregister+0x1c/0x60
> [ 447.411903] [<c064b60b>] i2c_unregister_device+0xb/0x10
> [ 447.411908] [<c064b923>] __unregister_client+0x33/0x40
> [ 447.411912] [<c05936bc>] device_for_each_child+0x2c/0x60
> [ 447.411917] [<c064cba8>] i2c_del_adapter+0x158/0x2c0
> [ 447.411921] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
> [ 447.411925] [<c077644a>] ? printk+0x48/0x4a
> [ 447.411936] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
> [ 447.411944] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
> [ 447.411952] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
> [ 447.411956] [<c0360ce5>] ? dput+0x15/0xe0
> [ 447.411974] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
> [ 447.411979] [<c034df2b>] __fput+0xab/0x1d0
> [ 447.411984] [<c034e088>] ____fput+0x8/0x10
> [ 447.411990] [<c025a709>] task_work_run+0x79/0x90
> [ 447.411994] [<c0202141>] do_notify_resume+0x51/0x80
> [ 447.411999] [<c077fffb>] work_notifysig+0x24/0x29
> [ 447.412029] ---[ end trace 1e95e1c9d6c9c837 ]---
> [ 447.412076] ------------[ cut here ]------------
> [ 447.412083] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 447.412085] sysfs group c0a10100 not found for kobject '10-0061'
> [ 447.412130] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
> snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
> videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
> nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
> ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
> iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 447.412168] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
> 3.13.0-rc7-0.1-desktop+ #76
> [ 447.412170] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 447.412177] 00000000 00000000 e7205de8 c077985c e7205e28 e7205e18
> c02401df c092bedc
> [ 447.412184] e7205e44 000009b9 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 447.412190] e8314224 e7205e30 c024027e 00000009 e7205e28 c092bedc
> e7205e44 e7205e58
> [ 447.412191] Call Trace:
> [ 447.412197] [<c077985c>] dump_stack+0x48/0x69
> [ 447.412201] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 447.412207] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.412212] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.412216] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 447.412221] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 447.412226] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 447.412230] [<c05940ac>] device_del+0x2c/0x150
> [ 447.412235] [<c064b8f0>] ? __unregister_dummy+0x30/0x30
> [ 447.412238] [<c05941ec>] device_unregister+0x1c/0x60
> [ 447.412242] [<c05933ff>] ? put_device+0xf/0x20
> [ 447.412246] [<c059341b>] ? klist_children_put+0xb/0x10
> [ 447.412250] [<c064b60b>] i2c_unregister_device+0xb/0x10
> [ 447.412254] [<c064b923>] __unregister_client+0x33/0x40
> [ 447.412258] [<c05936bc>] device_for_each_child+0x2c/0x60
> [ 447.412263] [<c064cba8>] i2c_del_adapter+0x158/0x2c0
> [ 447.412267] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
> [ 447.412271] [<c077644a>] ? printk+0x48/0x4a
> [ 447.412281] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
> [ 447.412290] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
> [ 447.412297] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
> [ 447.412301] [<c0360ce5>] ? dput+0x15/0xe0
> [ 447.412318] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
> [ 447.412324] [<c034df2b>] __fput+0xab/0x1d0
> [ 447.412329] [<c034e088>] ____fput+0x8/0x10
> [ 447.412334] [<c025a709>] task_work_run+0x79/0x90
> [ 447.412338] [<c0202141>] do_notify_resume+0x51/0x80
> [ 447.412343] [<c077fffb>] work_notifysig+0x24/0x29
> [ 447.412346] ---[ end trace 1e95e1c9d6c9c838 ]---
> [ 447.412367] xc2028 10-0061: destroying instance
> [ 447.412391] ------------[ cut here ]------------
> [ 447.412398] WARNING: CPU: 1 PID: 2489 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 447.412399] sysfs group c0a10100 not found for kobject 'i2c-10'
> [ 447.412444] Modules linked in: em28xx_rc zl10353 em28xx_dvb dvb_core
> snd_usb_audio snd_usbmidi_lib snd_rawmidi tuner_xc2028 tvp5150 em28xx
> videobuf2_core videobuf2_vmalloc videobuf2_memops nls_iso8859_1
> nls_cp437 vfat fat xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit
> ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT
> iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 447.412482] CPU: 1 PID: 2489 Comm: qv4l2 Tainted: G W
> 3.13.0-rc7-0.1-desktop+ #76
> [ 447.412484] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 447.412491] 00000000 00000000 e7205e18 c077985c e7205e58 e7205e48
> c02401df c092bedc
> [ 447.412498] e7205e74 000009b9 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 447.412504] e8073220 e7205e60 c024027e 00000009 e7205e58 c092bedc
> e7205e74 e7205e88
> [ 447.412505] Call Trace:
> [ 447.412511] [<c077985c>] dump_stack+0x48/0x69
> [ 447.412515] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 447.412521] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.412525] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 447.412530] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 447.412535] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 447.412540] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 447.412544] [<c05940ac>] device_del+0x2c/0x150
> [ 447.412548] [<c05941ec>] device_unregister+0x1c/0x60
> [ 447.412553] [<c03af3b1>] ? sysfs_remove_link+0x11/0x30
> [ 447.412558] [<c0597c5f>] ? class_compat_remove_link+0x2f/0x50
> [ 447.412563] [<c064cc04>] i2c_del_adapter+0x1b4/0x2c0
> [ 447.412567] [<c064b8b0>] ? __process_removed_driver+0x30/0x30
> [ 447.412571] [<c077644a>] ? printk+0x48/0x4a
> [ 447.412581] [<f9a042b7>] em28xx_i2c_unregister+0x17/0x30 [em28xx]
> [ 447.412590] [<f9a0573e>] em28xx_release_resources+0x1e/0x70 [em28xx]
> [ 447.412597] [<f9a00c6f>] em28xx_v4l2_close+0xcf/0x150 [em28xx]
> [ 447.412601] [<c0360ce5>] ? dput+0x15/0xe0
> [ 447.412618] [<f8b5802e>] v4l2_release+0x2e/0x70 [videodev]
> [ 447.412623] [<c034df2b>] __fput+0xab/0x1d0
> [ 447.412628] [<c034e088>] ____fput+0x8/0x10
> [ 447.412634] [<c025a709>] task_work_run+0x79/0x90
> [ 447.412638] [<c0202141>] do_notify_resume+0x51/0x80
> [ 447.412643] [<c077fffb>] work_notifysig+0x24/0x29
> [ 447.412645] ---[ end trace 1e95e1c9d6c9c839 ]---
>
>
>
> I'm also getting this error when unmounting a disconnecting a USB mass
> storage device:
>
> [ 180.527140] WARNING: CPU: 0 PID: 2145 at fs/sysfs/group.c:214
> sysfs_remove_group+0xc9/0xd0()
> [ 180.527142] sysfs group c0a10100 not found for kobject 'target11:0:0'
> [ 180.527144] Modules linked in: nls_iso8859_1 nls_cp437 vfat fat
> xt_tcpudp af_packet xt_pkttype xt_LOG xt_limit ip6t_REJECT
> nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT iptable_raw
> xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables fuse
> snd_hda_codec_hdmi arc4 snd_hda_codec_analog rtl8187 mac80211
> snd_hda_intel snd_hda_codec snd_hwdep snd_pcm rc_hauppauge ir_kbd_i2c
> snd_seq tuner_simple tuner_types cfg80211 tda9887 tda8290 tuner msp3400
> bttv v4l2_common videodev snd_timer snd_seq_device videobuf_dma_sg
> videobuf_core usb_storage btcx_risc rc_core snd tveeprom usblp rfkill
> forcedeth sg soundcore i2c_nforce2 shpchp eeprom_93cx6 firewire_ohci
> firewire_core crc_itu_t ppdev k8temp sr_mod cdrom powernow_k8 kvm_amd
> button asus_atk0110 floppy parport_pc parport pcspkr snd_page_alloc kvm
> serio_raw autofs4 radeon ttm drm_kms_helper drm i2c_algo_bit fan thermal
> processor thermal_sys scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
> scsi_dh_rdac scsi_dh ata_generic pata_amd pata_jmicron sata_nv
> [ 180.527204] CPU: 0 PID: 2145 Comm: bash Not tainted
> 3.13.0-rc7-0.1-desktop+ #76
> [ 180.527206] Hardware name: System manufacturer System Product
> Name/M2N-VM DH, BIOS ASUS M2N-VM DH ACPI BIOS Revision 1503 09/16/2010
> [ 180.527208] 00000000 00000000 f6531bcc c077985c f6531c0c f6531bfc
> c02401df c092bedc
> [ 180.527213] f6531c28 00000861 c0935e02 000000d6 c03afe89 c03afe89
> 00000000 c0a10100
> [ 180.527217] f527761c f6531c14 c024027e 00000009 f6531c0c c092bedc
> f6531c28 f6531c3c
> [ 180.527221] Call Trace:
> [ 180.527227] [<c077985c>] dump_stack+0x48/0x69
> [ 180.527231] [<c02401df>] warn_slowpath_common+0x7f/0xa0
> [ 180.527234] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 180.527237] [<c03afe89>] ? sysfs_remove_group+0xc9/0xd0
> [ 180.527240] [<c024027e>] warn_slowpath_fmt+0x2e/0x30
> [ 180.527243] [<c03afe89>] sysfs_remove_group+0xc9/0xd0
> [ 180.527246] [<c059c32d>] dpm_sysfs_remove+0x2d/0x30
> [ 180.527249] [<c05940ac>] device_del+0x2c/0x150
> [ 180.527253] [<c05cb0d6>] scsi_target_reap_usercontext+0x26/0x40
> [ 180.527257] [<c0256d44>] execute_in_process_context+0x44/0x50
> [ 180.527260] [<c05cc6ec>] scsi_target_reap+0x8c/0xb0
> [ 180.527263] [<c05ce372>] scsi_device_dev_release_usercontext+0x122/0x150
> [ 180.527266] [<c0256d44>] execute_in_process_context+0x44/0x50
> [ 180.527268] [<c05cdf13>] scsi_device_dev_release+0x13/0x20
> [ 180.527271] [<c059362c>] device_release+0x2c/0x90
> [ 180.527273] [<c0593633>] ? device_release+0x33/0x90
> [ 180.527276] [<c04a8058>] kobject_cleanup+0x78/0x1b0
> [ 180.527279] [<c04a8070>] ? kobject_cleanup+0x90/0x1b0
> [ 180.527282] [<c04915f4>] ? part_release+0x24/0x30
> [ 180.527286] [<c0317097>] ? free_percpu+0x77/0x100
> [ 180.527290] [<c04a81c5>] kobject_put+0x25/0x60
> [ 180.527293] [<c05c18b7>] ? scsi_device_put+0x47/0x50
> [ 180.527296] [<c05933ff>] put_device+0xf/0x20
> [ 180.527299] [<c05c189f>] scsi_device_put+0x2f/0x50
> [ 180.527302] [<c05d138a>] scsi_disk_put+0x2a/0x40
> [ 180.527305] [<c05d1c7f>] sd_release+0x3f/0xd0
> [ 180.527308] [<c037e574>] __blkdev_put+0x124/0x170
> [ 180.527311] [<c037e547>] __blkdev_put+0xf7/0x170
> [ 180.527313] [<c037e604>] blkdev_put+0x44/0x110
> [ 180.527318] [<c034f23c>] kill_block_super+0x3c/0x70
> [ 180.527321] [<c034e81a>] deactivate_locked_super+0x3a/0x60
> [ 180.527323] [<c034f4f2>] deactivate_super+0x42/0x60
> [ 180.527326] [<c036779d>] mntput_no_expire+0xad/0x120
> [ 180.527329] [<c0367828>] mntput+0x18/0x30
> [ 180.527332] [<c0355085>] path_put+0x15/0x20
> [ 180.527335] [<c0376756>] free_fs_struct+0x16/0x30
> [ 180.527338] [<c03767df>] exit_fs+0x6f/0x80
> [ 180.527341] [<c024203a>] do_exit+0x24a/0x980
> [ 180.527344] [<c024d558>] ? dequeue_signal+0x78/0x180
> [ 180.527347] [<c024285f>] do_group_exit+0x2f/0x90
> [ 180.527350] [<c024fb39>] get_signal_to_deliver+0x239/0x5e0
> [ 180.527354] [<c0202033>] do_signal+0x33/0xf0
> [ 180.527357] [<c02017c5>] ? restore_sigcontext+0xe5/0x110
> [ 180.527359] [<c0202397>] ? sys_sigreturn+0x97/0xa0
> [ 180.527362] [<c0202155>] do_notify_resume+0x65/0x80
> [ 180.527365] [<c077fffb>] work_notifysig+0x24/0x29
> [ 180.527367] ---[ end trace 1e95e1c9d6c9c834 ]---
>
>
> Both are 100% reproducable.
>
> I assume the warning means that something unexpected happened.
> So how can these warnings be fixed ?
>
> Regards,
> Frank Sch�fer
>
>
>

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: Regression (ARM) arch/arm/mm/init.c doesn't build without CONFIG_ARM_
PATCH_PHYS_VIRT.
http://groups.google.com/group/linux.kernel/t/4b9ee9123d2204c8?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Santosh Shilimkar


On Monday 06 January 2014 08:11 PM, Russell King - ARM Linux wrote:
> On Mon, Jan 06, 2014 at 06:42:13PM -0500, Santosh Shilimkar wrote:
>> On Monday 06 January 2014 05:39 PM, Russell King - ARM Linux wrote:
>>> On Mon, Jan 06, 2014 at 08:28:20PM +0100, Krzysztof Hałasa wrote:
>>>> Russell, Santosh,
>>>>
>>>> the unneeded commit causing regression is still in place. Please try to
>>>> compile an ARM kernel without CONFIG_ARM_PATCH_PHYS_VIRT and with
>>>> CONFIG_ZONE_DMA and see for yourself, if you don't believe me.
>>>>
>>>> Please be aware that this commit fixes nothing, its only function is
>>>> causing the regression - so we don't lose anything by reverting it.
>>>>
>>>> If the attached wasn't clear, what the defective commit presently does
>>>> is changing a perfectly valid code into a code referencing a variable
>>>> which (without CONFIG_ARM_PATCH_PHYS_VIRT set) doesn't at all exist.
>>>>
>>>> With CONFIG_ARM_PATCH_PHYS_VIRT set, this commit does precisely nothing.
>>>
>
> /--------------------------------------------------------------
> | > > Right, so, with Assabet, which has CONFIG_DMA_ZONE=y and
> | > > CONFIG_ARM_PATCH_PHYS_VIRT=y:
> | > >
> | > > $ make O=../build/assabet arch/arm/mm/init.i
> | > >
> | > > gives:
> | > > arm_dma_limit = __pv_phys_offset + arm_dma_zone_size - 1;
> | > >
> | > > with or without Santosh's patch.
> \--------------------------------------------------------------
>
>> May be I missed your point but I ended up creating the patch because
>> the CMA reservation was failing on Keystone since the arm_dma_limit
>> wasn't right since it wasn't considering the actual __pv_phys_offset.
>>
>> Isn't that an issue ?
>
> See the above. Your patch has _no_ effect what so ever when
> CONFIG_ARM_PATCH_PHYS_VIRT=y - which you have on the Keystone, right?
>
> If you don't believe me, ask make to produce arch/arm/mm/init.i, which
> is the output from the preprocessor, comparing the resulting generated
> file both with and without your patch applied.
>
Looks like you are right. I did two fixes to have right arm_dma_limit in
below order.

1. 787b0d5 {ARM: 7908/1: mm: Fix the arm_dma_limit calculation}
2. 7c92732 {ARM: 7909/1: mm: Call setup_dma_zone() post early_paging_init()}

But with 2 alone the issue gets fixed since with ARM_PATCH_PHYS_VIRT and
below pre-processor, the PHYS_OFFSET also gets an updated value. I never
realised that 1 becomes redundant after second patch while creating them.

#define PHYS_OFFSET __pv_phys_offset

So indeed, 787b0d5{ARM: 7908/1: mm: Fix the arm_dma_limit calculation}
won't be needed anymore and can be reverted. Sorry it took some time
for me to reach to your conclusion.

Regards,
Santosh



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 2 ==
Date: Tues, Jan 7 2014 10:00 am
From: Russell King - ARM Linux


On Tue, Jan 07, 2014 at 12:45:42PM -0500, Santosh Shilimkar wrote:
> On Monday 06 January 2014 08:11 PM, Russell King - ARM Linux wrote:
> > /--------------------------------------------------------------
> > | > > Right, so, with Assabet, which has CONFIG_DMA_ZONE=y and
> > | > > CONFIG_ARM_PATCH_PHYS_VIRT=y:
> > | > >
> > | > > $ make O=../build/assabet arch/arm/mm/init.i
> > | > >
> > | > > gives:
> > | > > arm_dma_limit = __pv_phys_offset + arm_dma_zone_size - 1;
> > | > >
> > | > > with or without Santosh's patch.
> > \--------------------------------------------------------------
> >
> >> May be I missed your point but I ended up creating the patch because
> >> the CMA reservation was failing on Keystone since the arm_dma_limit
> >> wasn't right since it wasn't considering the actual __pv_phys_offset.
> >>
> >> Isn't that an issue ?
> >
> > See the above. Your patch has _no_ effect what so ever when
> > CONFIG_ARM_PATCH_PHYS_VIRT=y - which you have on the Keystone, right?
> >
> > If you don't believe me, ask make to produce arch/arm/mm/init.i, which
> > is the output from the preprocessor, comparing the resulting generated
> > file both with and without your patch applied.
> >
> Looks like you are right. I did two fixes to have right arm_dma_limit in
> below order.
>
> 1. 787b0d5 {ARM: 7908/1: mm: Fix the arm_dma_limit calculation}
> 2. 7c92732 {ARM: 7909/1: mm: Call setup_dma_zone() post early_paging_init()}
>
> But with 2 alone the issue gets fixed since with ARM_PATCH_PHYS_VIRT and
> below pre-processor, the PHYS_OFFSET also gets an updated value. I never
> realised that 1 becomes redundant after second patch while creating them.
>
> #define PHYS_OFFSET __pv_phys_offset
>
> So indeed, 787b0d5{ARM: 7908/1: mm: Fix the arm_dma_limit calculation}
> won't be needed anymore and can be reverted. Sorry it took some time
> for me to reach to your conclusion.

Okay, reverted.

--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: checkpatch: Only flag FSF address, not gnu.org URL
http://groups.google.com/group/linux.kernel/t/ce2c23b367d91ff7?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Joe Perches


On Tue, 2014-01-07 at 09:41 -0800, Alexander Duyck wrote:
> This change restricts the check for the for the FSF address in the GPL
> copyright statement so that it only flags the address, not the references to
> the gnu.org/licenses URL which appears to be used in numerous drivers. The
> idea is to still allow some reference to an external copy of the GPL in the
> event that files are copied out of the kernel tree without the COPYING file.

Looks OK to me.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 2 ==
Date: Tues, Jan 7 2014 9:50 am
From: Alexander Duyck


This change restricts the check for the for the FSF address in the GPL
copyright statement so that it only flags the address, not the references to
the gnu.org/licenses URL which appears to be used in numerous drivers. The
idea is to still allow some reference to an external copy of the GPL in the
event that files are copied out of the kernel tree without the COPYING file.

So for example this statement will still return an error:
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

However, this statement will not return an error after this patch:
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---

v2: Rebased patch off of linux-next tree.
Updated patch description to include motivation behind change.

scripts/checkpatch.pl | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 07331d6..e7f2c65 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1970,14 +1970,12 @@ sub process {
}

# Check for FSF mailing addresses.
- if ($rawline =~ /\bYou should have received a copy/i ||
- $rawline =~ /\bwrite to the Free/i ||
+ if ($rawline =~ /\bwrite to the Free/i ||
$rawline =~ /\b59\s+Temple\s+Pl/i ||
$rawline =~ /\b51\s+Franklin\s+St/i) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
my $msg_type = \&ERROR;
$msg_type = \&CHK if ($file);
- $msg_type = \&CHK if ($rawline =~ /\bYou should have received a copy/i);
&{$msg_type}("FSF_MAILING_ADDRESS",
"Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: futex: Avoid taking hb lock if nothing to wakeup
http://groups.google.com/group/linux.kernel/t/af4a2848ad48ded5?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 9:50 am
From: Darren Hart


On Mon, 2014-01-06 at 19:29 -0800, Davidlohr Bueso wrote:
> On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote:
> > On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote:


> > I thought someone, Peter Z?, had commented on these CONFIG_SMP bits. Are
> > they really necessary? Does smp_mb__after_atomic_inc() and smp_rmb() not
> > already just do the right thing as far as we're concerned here?
>
> I don't think so. Thomas and I agreed that this was in fact the way to
> go. I rechecked old email and didn't notice any objections to
> CONFIG_SMP. Also for things like hb_waiters_pending we definitely need
> it.

I'll happily defer to Thomas here.

> >
> > Given the subtlety of the implementation - I think it would be good to
> > explicitly annotate the get_futex_key() call site in futex_wake() as
> > providing the MB (B).
> >
> > Similar comment for futex_wait() and futex_requeue() for MB (A).
> >
> > These will also raise the appropriate red flags for people looking to
> > optimize or modify these paths in the future. It would be good to have
> > it in the top level futex_* function to make the MB placement and
> > relationship explicitly clear.
> >
>
> Something quite similar was already there for v2 but PeterZ's feedback
> made me update the main documentation at the top of futex.c to as it is
> now...

I don't want to block this any longer - but as complicated and
non-obvious as this is, I would *MUCH* prefer we document the memory
barrier point in the top level algorithm. If Peter/Thomas/Linus/Ingo
object, so be it, but otherwise let's err on the side of overly explicit
documentation.

Peter/Thomas/Linus/Ingo: Do any of you object to adding the three memory
barrier comments to the high level functions? futex_wait, futex_wake,
futex_requeue?

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: x86: Add check for number of available vectors before CPU down [v6]
http://groups.google.com/group/linux.kernel/t/3ccfd69cb2196147?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:00 am
From: "Luck, Tony"


+ for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+ irq = __this_cpu_read(vector_irq[vector]);
+ if (irq >= 0) {
+ desc = irq_to_desc(irq);
+ data = irq_desc_get_irq_data(desc);
+ cpumask_copy(&affinity_new, data->affinity);
+ cpu_clear(this_cpu, affinity_new);
+ /*
+ * The check below determines if this irq requires
+ * an empty vector_irq[irq] entry on an online
+ * cpu.
+ *
+ * The code only counts active non-percpu irqs, and
+ * those irqs that are not linked to on an online cpu.
+ * The first test is trivial, the second is not.
+ *
+ * The second test takes into account the
+ * account that a single irq may be mapped to multiple
+ * cpu's vector_irq[] (for example IOAPIC cluster
+ * mode). In this case we have two
+ * possibilities:
+ *
+ * 1) the resulting affinity mask is empty; that is
+ * this the down'd cpu is the last cpu in the irq's
+ * affinity mask, and
Code says "||" - so I think comment should say "or".
+ *
+ * 2) the resulting affinity mask is no longer
+ * a subset of the online cpus but the affinity
+ * mask is not zero; that is the down'd cpu is the
+ * last online cpu in a user set affinity mask.
+ *
+ * In both possibilities, we need to remap the irq
+ * to a new vector_irq[].
+ *
+ */
+ if (irq_has_action(irq) && !irqd_is_per_cpu(data) &&
+ (cpumask_empty(&affinity_new) ||
+ !cpumask_subset(&affinity_new, &online_new)))
+ this_count++;
+ }

That's an impressive 6:1 ratio of lines-of-comment to lines-of-code!

Perhaps it would be less scary if the test were broken up into the easy/obvious part
and the one that has taken all these revisions to work out? E.g.

/* no need to count inactive or per-cpu irqs */
if (!irq_has_action(irq) || irqd_is_per_cpu(data))
continue;

/*
* We need to look for a new home for this irq if:
... paste in 1), 2) from above here ... (but s/and/or/ to match code)
*/
if (cpumask_empty(&affinity_new) ||
!cpumask_subset(&affinity_new, &online_new))
this_count++;

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: gpio: davinci: reuse for keystone arch
http://groups.google.com/group/linux.kernel/t/85206239619a73b5?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:00 am
From: Santosh Shilimkar


Sekhar,

On Tuesday 24 December 2013 06:41 AM, Grygorii Strashko wrote:
> This series is intended to update Davinci GPIO driver and reuse
> it for Keystone SoCs, because Keystone uses the similar GPIO IP like Davinci.
> Keystone GPIO IP: supports:
> - up to 32 GPIO lines;
> - only unbanked irqs;
>
> See Documentation:
> Keystone - http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf
>
> This series based on:
> https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.14/gpio
>
> Changes in v3:
> - fixed code, changed by mistake; fixed sparse warning
> Changes in v2:
> - minor comments applied, no functional changes
>
> v2: https://lkml.org/lkml/2013/12/18/135
> v1: https://lkml.org/lkml/2013/12/12/366
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>
> Grygorii Strashko (2):
> gpio: davinci: don't create irq_domain in case of unbanked irqs
> gpio: davinci: reuse for Keystone SoC
>
> .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +-
> drivers/gpio/gpio-davinci.c | 82 ++++++++++++++------
> 2 files changed, 61 insertions(+), 25 deletions(-)
>
Have you picked up the $subject series in your queue ?

Regards,
Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: staging/media: fix sn9c102 dependencies
http://groups.google.com/group/linux.kernel/t/e208d36ae1172b68?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:00 am
From: Randy Dunlap


From: Randy Dunlap <rdunlap@infradead.org>

Fix numerous build errors when USB is not enabled. Examples:

drivers/built-in.o: In function `sn9c102_stop_transfer':
sn9c102_core.c:(.text+0xccbd0a): undefined reference to `usb_kill_urb'
sn9c102_core.c:(.text+0xccbd15): undefined reference to `usb_free_urb'
sn9c102_core.c:(.text+0xccbd4c): undefined reference to `usb_set_interface'
drivers/built-in.o: In function `sn9c102_urb_complete':
sn9c102_core.c:(.text+0xccdca5): undefined reference to `usb_submit_urb'
drivers/built-in.o: In function `sn9c102_release_resources':
sn9c102_core.c:(.text+0xcce62b): undefined reference to `usb_put_dev'
drivers/built-in.o: In function `sn9c102_match_id':
(.text+0xcce9d7): undefined reference to `usb_ifnum_to_if'
drivers/built-in.o: In function `sn9c102_match_id':
(.text+0xcce9de): undefined reference to `usb_match_id'
drivers/built-in.o: In function `sn9c102_write_regs':
(.text+0xccea7a): undefined reference to `usb_control_msg'
drivers/built-in.o: In function `sn9c102_open':
sn9c102_core.c:(.text+0xcd17b4): undefined reference to `usb_altnum_to_altsetting'
sn9c102_core.c:(.text+0xcd1851): undefined reference to `usb_alloc_urb'
drivers/built-in.o: In function `sn9c102_read_reg':
(.text+0xcd1fdf): undefined reference to `usb_control_msg'
drivers/built-in.o: In function `sn9c102_usb_probe':
sn9c102_core.c:(.text+0xcd275d): undefined reference to `usb_get_dev'
drivers/built-in.o: In function `sn9c102_usb_driver_init':
sn9c102_core.c:(.init.text+0x3e4eb): undefined reference to `usb_register_driver'
drivers/built-in.o: In function `sn9c102_usb_driver_exit':
sn9c102_core.c:(.exit.text+0x7226): undefined reference to `usb_deregister'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Luca Risolia <luca.risolia@studio.unibo.it>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
drivers/staging/media/sn9c102/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20140107.orig/drivers/staging/media/sn9c102/Kconfig
+++ linux-next-20140107/drivers/staging/media/sn9c102/Kconfig
@@ -1,6 +1,6 @@
config USB_SN9C102
tristate "USB SN9C1xx PC Camera Controller support (DEPRECATED)"
- depends on VIDEO_V4L2
+ depends on VIDEO_V4L2 && USB
---help---
This driver is DEPRECATED, please use the gspca sonixb and
sonixj modules instead.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: lib/vsprintf: add %pT[C012] format specifier
http://groups.google.com/group/linux.kernel/t/40f2db64b3df6ee9?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:00 am
From: Pavel Machek



> > > I'm not nacking this, just stating my view.
> >
> > And I believe Andrew clearly stated his view, on the very topic you
> > asked him on.
>
> I believe Andrew's view:
>
> On Sat, 2013-12-28 at 12:08 -0800, Andrew Morton wrote:
> > On Sat, 28 Dec 2013 11:53:25 -0800 Joe Perches <joe@perches.com> wrote:
> > > Tell me again, what's wrong with using p or current?
> > > printk("%pt", current);
> >
> > Nothing much. It's just that all these callsites are generating the
> > code to pass an argument which the callee already has access to.
> > Optimizing that will reduce text size a bit.
>
> was that the argument passing was the primary issue.

Yes. He dislikes passing argument callee has already access
to. "current". This patch does not do this, it just passes the NULL as
a marker... and to keep printf() checkers happy.

I believe this is way better than alternatives.

> Now that that's not done, this code actually uses a
> different concept, that "NULL" is special when using
> %pT. If the argument isn't eliminated all together,
> I think that new concept should be avoided.
>
> The additional cost of using current vs NULL is ~zero.

The additional cost of current vs NULL is cca 8 bytes per caller. Test
for NULL is cca 4 bytes, maybe 20 bytes total. I believe it is worth
it.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: kernfs: remove KERNFS_REMOVED
http://groups.google.com/group/linux.kernel/t/b72ccc5edcdfb313?hl=en
==============================================================================

== 1 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


KERNFS_REMOVED is used to mark half-initialized and dying nodes so
that they don't show up in lookups and deny adding new nodes under or
renaming it. Marking half-initialized nodes is unnecessary as linking
to the hierarchy is always atomic w.r.t. kernfs_mutex as are the
lookups.

It's necessary at least to deny addition of new children while removal
is in progress; however, this role considerably intersects with
deactivation - KERNFS_REMOVED prevents new children while deactivation
prevents new file operations. There's no reason to have them separate
making things more complex than necessary. This patch removes
KERNFS_REMOVED and gives its function to deactivation.

* KERNFS_REMOVED diddling in the addition path removed.

* A new helper kernfs_active() which tests whether kn->active >= 0 is
added for convenience and lockdep annotation. All KERNFS_REMOVED
tests are replaced with negated kernfs_active() tests.

* __kernfs_remove() is updated to deactivate, but not drain, all nodes
in the subtree instead of setting KERNFS_REMOVED. This removes
deactivation from kernfs_deactivate(), which is now renamed to
kernfs_drain().

* Sanity check on KERNFS_REMOVED in kernfs_put() is replaced with
checks on the active ref.

* Some comment style updates in the affected area.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/kernfs/dir.c | 66 +++++++++++++++++++++++++-------------------------
include/linux/kernfs.h | 1 -
2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 8abdf07..71faef9 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -22,6 +22,12 @@ DEFINE_MUTEX(kernfs_mutex);

#define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)

+static bool kernfs_active(struct kernfs_node *kn)
+{
+ lockdep_assert_held(&kernfs_mutex);
+ return atomic_read(&kn->active) >= 0;
+}
+
static bool kernfs_lockdep(struct kernfs_node *kn)
{
#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -183,25 +189,20 @@ void kernfs_put_active(struct kernfs_node *kn)
}

/**
- * kernfs_deactivate - deactivate kernfs_node
- * @kn: kernfs_node to deactivate
+ * kernfs_drain - drain kernfs_node
+ * @kn: kernfs_node to drain
*
- * Deny new active references, drain existing ones and nuke all
- * existing mmaps. Mutiple removers may invoke this function
- * concurrently on @kn and all will return after deactivation and
- * draining are complete.
+ * Drain existing usages and nuke all existing mmaps of @kn. Mutiple
+ * removers may invoke this function concurrently on @kn and all will
+ * return after draining is complete.
*/
-static void kernfs_deactivate(struct kernfs_node *kn)
+static void kernfs_drain(struct kernfs_node *kn)
__releases(&kernfs_mutex) __acquires(&kernfs_mutex)
{
struct kernfs_root *root = kernfs_root(kn);

lockdep_assert_held(&kernfs_mutex);
- BUG_ON(!(kn->flags & KERNFS_REMOVED));
-
- /* only the first invocation on @kn should deactivate it */
- if (atomic_read(&kn->active) >= 0)
- atomic_add(KN_DEACTIVATED_BIAS, &kn->active);
+ WARN_ON_ONCE(kernfs_active(kn));

mutex_unlock(&kernfs_mutex);

@@ -253,13 +254,16 @@ void kernfs_put(struct kernfs_node *kn)
return;
root = kernfs_root(kn);
repeat:
- /* Moving/renaming is always done while holding reference.
+ /*
+ * Moving/renaming is always done while holding reference.
* kn->parent won't change beneath us.
*/
parent = kn->parent;

- WARN(!(kn->flags & KERNFS_REMOVED), "kernfs: free using entry: %s/%s\n",
- parent ? parent->name : "", kn->name);
+ WARN_ONCE(atomic_read(&kn->active) != 0 &&
+ atomic_read(&kn->active) != KN_DEACTIVATED_BIAS,
+ "kernfs_put: %s/%s: released with incorrect active_ref %d\n",
+ parent ? parent->name : "", kn->name, atomic_read(&kn->active));

if (kernfs_type(kn) == KERNFS_LINK)
kernfs_put(kn->symlink.target_kn);
@@ -301,8 +305,8 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
kn = dentry->d_fsdata;
mutex_lock(&kernfs_mutex);

- /* The kernfs node has been deleted */
- if (kn->flags & KERNFS_REMOVED)
+ /* The kernfs node has been deactivated */
+ if (!kernfs_active(kn))
goto out_bad;

/* The kernfs node has been moved? */
@@ -375,7 +379,7 @@ struct kernfs_node *kernfs_new_node(struct kernfs_root *root, const char *name,

kn->name = name;
kn->mode = mode;
- kn->flags = flags | KERNFS_REMOVED;
+ kn->flags = flags;

return kn;

@@ -417,7 +421,7 @@ int kernfs_add_one(struct kernfs_node *kn, struct kernfs_node *parent)
goto out_unlock;

ret = -ENOENT;
- if (parent->flags & KERNFS_REMOVED)
+ if (!kernfs_active(parent))
goto out_unlock;

kn->hash = kernfs_name_hash(kn->name, kn->ns);
@@ -434,9 +438,6 @@ int kernfs_add_one(struct kernfs_node *kn, struct kernfs_node *parent)
struct iattr *ps_iattrs = &ps_iattr->ia_iattr;
ps_iattrs->ia_ctime = ps_iattrs->ia_mtime = CURRENT_TIME;
}
-
- /* Mark the entry added into directory tree */
- kn->flags &= ~KERNFS_REMOVED;
ret = 0;
out_unlock:
mutex_unlock(&kernfs_mutex);
@@ -535,7 +536,6 @@ struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv)
return ERR_PTR(-ENOMEM);
}

- kn->flags &= ~KERNFS_REMOVED;
kn->priv = priv;
kn->dir.root = root;

@@ -750,13 +750,13 @@ static void __kernfs_remove(struct kernfs_node *kn)

pr_debug("kernfs %s: removing\n", kn->name);

- /* disable lookup and node creation under @kn */
+ /* prevent any new usage under @kn by deactivating all nodes */
next = NULL;
do {
pos = next;
next = kernfs_next_descendant_post(pos, kn);
- if (pos)
- pos->flags |= KERNFS_REMOVED;
+ if (pos && kernfs_active(pos))
+ atomic_add(KN_DEACTIVATED_BIAS, &pos->active);
} while (next);

/* deactivate and unlink the subtree node-by-node */
@@ -764,14 +764,14 @@ static void __kernfs_remove(struct kernfs_node *kn)
pos = kernfs_leftmost_descendant(kn);

/*
- * kernfs_deactivate() drops kernfs_mutex temporarily and
- * @pos's base ref could have been put by someone else by
- * the time the function returns. Make sure it doesn't go
- * away underneath us.
+ * kernfs_drain() drops kernfs_mutex temporarily and @pos's
+ * base ref could have been put by someone else by the time
+ * the function returns. Make sure it doesn't go away
+ * underneath us.
*/
kernfs_get(pos);

- kernfs_deactivate(pos);
+ kernfs_drain(pos);

/*
* kernfs_unlink_sibling() succeeds once per node. Use it
@@ -855,7 +855,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
mutex_lock(&kernfs_mutex);

error = -ENOENT;
- if ((kn->flags | new_parent->flags) & KERNFS_REMOVED)
+ if (!kernfs_active(kn) || !kernfs_active(new_parent))
goto out;

error = 0;
@@ -915,7 +915,7 @@ static struct kernfs_node *kernfs_dir_pos(const void *ns,
struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos)
{
if (pos) {
- int valid = !(pos->flags & KERNFS_REMOVED) &&
+ int valid = kernfs_active(pos) &&
pos->parent == parent && hash == pos->hash;
kernfs_put(pos);
if (!valid)
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index bff6e08..1238a66 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -37,7 +37,6 @@ enum kernfs_node_type {
#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK

enum kernfs_node_flag {
- KERNFS_REMOVED = 0x0010,
KERNFS_NS = 0x0020,
KERNFS_HAS_SEQ_SHOW = 0x0040,
KERNFS_HAS_MMAP = 0x0080,
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 2 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


driver-core now supports synchrnous self-deletion of attributes and
the asynchrnous removal mechanism is scheduled for removal. Use it
instead of device_schedule_callback().

* Conversions in arch/s390/pci/pci_sysfs.c and
drivers/s390/block/dcssblk.c are straightforward.

* drivers/s390/cio/ccwgroup.c is a bit more tricky because
ccwgroup_notifier() was (ab)using device_schedule_callback() to
purely obtain a process context to kick off ungroup operation which
may block from a notifier callback.

Rename ccwgroup_ungroup_callback() to ccwgroup_ungroup() and make it
take ccwgroup_device * instead. The new function is now called
directly from ccwgroup_ungroup_store().

ccwgroup_notifier() chain is updated to explicitly bounce through
ccwgroup_device->ungroup_work. This also removes possible failure
from memory pressure.

Only compile-tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
arch/s390/include/asm/ccwgroup.h | 1 +
arch/s390/pci/pci_sysfs.c | 18 ++++++++----------
drivers/s390/block/dcssblk.c | 14 +++++++-------
drivers/s390/cio/ccwgroup.c | 26 ++++++++++++++++----------
4 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/arch/s390/include/asm/ccwgroup.h b/arch/s390/include/asm/ccwgroup.h
index 23723ce..6e670f8 100644
--- a/arch/s390/include/asm/ccwgroup.h
+++ b/arch/s390/include/asm/ccwgroup.h
@@ -23,6 +23,7 @@ struct ccwgroup_device {
unsigned int count;
struct device dev;
struct ccw_device *cdev[0];
+ struct work_struct ungroup_work;
};

/**
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index cf8a12f..ab4a913 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -48,29 +48,27 @@ static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL);

-static void recover_callback(struct device *dev)
+static ssize_t store_recover(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev);
int ret;

+ if (!device_remove_file_self(dev, attr))
+ return count;
+
pci_stop_and_remove_bus_device(pdev);
ret = zpci_disable_device(zdev);
if (ret)
- return;
+ return ret;

ret = zpci_enable_device(zdev);
if (ret)
- return;
+ return ret;

pci_rescan_bus(zdev->bus);
-}
-
-static ssize_t store_recover(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
-{
- int rc = device_schedule_callback(dev, recover_callback);
- return rc ? rc : count;
+ return count;
}
static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover);

diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 6eca019..2e2f454 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -304,12 +304,6 @@ dcssblk_load_segment(char *name, struct segment_info **seg_info)
return rc;
}

-static void dcssblk_unregister_callback(struct device *dev)
-{
- device_unregister(dev);
- put_device(dev);
-}
-
/*
* device attribute for switching shared/nonshared (exclusive)
* operation (show + store)
@@ -397,7 +391,13 @@ removeseg:
blk_cleanup_queue(dev_info->dcssblk_queue);
dev_info->gd->queue = NULL;
put_disk(dev_info->gd);
- rc = device_schedule_callback(dev, dcssblk_unregister_callback);
+ up_write(&dcssblk_devices_sem);
+
+ if (device_remove_file_self(dev, attr)) {
+ device_unregister(dev);
+ put_device(dev);
+ }
+ return rc;
out:
up_write(&dcssblk_devices_sem);
return rc;
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 959135a..67b9dc9 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -168,14 +168,12 @@ static ssize_t ccwgroup_online_show(struct device *dev,
* Provide an 'ungroup' attribute so the user can remove group devices no
* longer needed or accidentially created. Saves memory :)
*/
-static void ccwgroup_ungroup_callback(struct device *dev)
+static void ccwgroup_ungroup(struct ccwgroup_device *gdev)
{
- struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
-
mutex_lock(&gdev->reg_mutex);
if (device_is_registered(&gdev->dev)) {
__ccwgroup_remove_symlinks(gdev);
- device_unregister(dev);
+ device_unregister(&gdev->dev);
__ccwgroup_remove_cdev_refs(gdev);
}
mutex_unlock(&gdev->reg_mutex);
@@ -195,10 +193,9 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev,
rc = -EINVAL;
goto out;
}
- /* Note that we cannot unregister the device from one of its
- * attribute methods, so we have to use this roundabout approach.
- */
- rc = device_schedule_callback(dev, ccwgroup_ungroup_callback);
+
+ if (device_remove_file_self(dev, attr))
+ ccwgroup_ungroup(gdev);
out:
if (rc) {
if (rc != -EAGAIN)
@@ -224,6 +221,14 @@ static const struct attribute_group *ccwgroup_attr_groups[] = {
NULL,
};

+static void ccwgroup_ungroup_workfn(struct work_struct *work)
+{
+ struct ccwgroup_device *gdev =
+ container_of(work, struct ccwgroup_device, ungroup_work);
+
+ ccwgroup_ungroup(gdev);
+}
+
static void ccwgroup_release(struct device *dev)
{
kfree(to_ccwgroupdev(dev));
@@ -323,6 +328,7 @@ int ccwgroup_create_dev(struct device *parent, struct ccwgroup_driver *gdrv,
atomic_set(&gdev->onoff, 0);
mutex_init(&gdev->reg_mutex);
mutex_lock(&gdev->reg_mutex);
+ INIT_WORK(&gdev->ungroup_work, ccwgroup_ungroup_workfn);
gdev->count = num_devices;
gdev->dev.bus = &ccwgroup_bus_type;
gdev->dev.parent = parent;
@@ -404,10 +410,10 @@ EXPORT_SYMBOL(ccwgroup_create_dev);
static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action,
void *data)
{
- struct device *dev = data;
+ struct ccwgroup_device *gdev = to_ccwgroupdev(data);

if (action == BUS_NOTIFY_UNBIND_DRIVER)
- device_schedule_callback(dev, ccwgroup_ungroup_callback);
+ schedule_work(&gdev->ungroup_work);

return NOTIFY_OK;
}
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 3 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


sysfs, driver-core: remove unused {sysfs|device}_schedule_callback_owner()

All device_schedule_callback_owner() users are converted to use
device_remove_file_self(). Remove now unused
{sysfs|device}_schedule_callback_owner().

Signed-off-by: Tejun Heo <tj@kernel.org>
---
drivers/base/core.c | 33 ------------------
fs/sysfs/file.c | 92 --------------------------------------------------
include/linux/device.h | 11 +-----
include/linux/sysfs.h | 9 -----
4 files changed, 1 insertion(+), 144 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9db57af..4195364 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -615,39 +615,6 @@ void device_remove_bin_file(struct device *dev,
}
EXPORT_SYMBOL_GPL(device_remove_bin_file);

-/**
- * device_schedule_callback_owner - helper to schedule a callback for a device
- * @dev: device.
- * @func: callback function to invoke later.
- * @owner: module owning the callback routine
- *
- * Attribute methods must not unregister themselves or their parent device
- * (which would amount to the same thing). Attempts to do so will deadlock,
- * since unregistration is mutually exclusive with driver callbacks.
- *
- * Instead methods can call this routine, which will attempt to allocate
- * and schedule a workqueue request to call back @func with @dev as its
- * argument in the workqueue's process context. @dev will be pinned until
- * @func returns.
- *
- * This routine is usually called via the inline device_schedule_callback(),
- * which automatically sets @owner to THIS_MODULE.
- *
- * Returns 0 if the request was submitted, -ENOMEM if storage could not
- * be allocated, -ENODEV if a reference to @owner isn't available.
- *
- * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an
- * underlying sysfs routine (since it is intended for use by attribute
- * methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
- */
-int device_schedule_callback_owner(struct device *dev,
- void (*func)(struct device *), struct module *owner)
-{
- return sysfs_schedule_callback(&dev->kobj,
- (void (*)(void *)) func, dev, owner);
-}
-EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
-
static void klist_children_get(struct klist_node *n)
{
struct device_private *p = to_device_private_parent(n);
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 1b8b91b..28cc1acd 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -453,95 +453,3 @@ void sysfs_remove_bin_file(struct kobject *kobj,
kernfs_remove_by_name(kobj->sd, attr->attr.name);
}
EXPORT_SYMBOL_GPL(sysfs_remove_bin_file);
-
-struct sysfs_schedule_callback_struct {
- struct list_head workq_list;
- struct kobject *kobj;
- void (*func)(void *);
- void *data;
- struct module *owner;
- struct work_struct work;
-};
-
-static struct workqueue_struct *sysfs_workqueue;
-static DEFINE_MUTEX(sysfs_workq_mutex);
-static LIST_HEAD(sysfs_workq);
-static void sysfs_schedule_callback_work(struct work_struct *work)
-{
- struct sysfs_schedule_callback_struct *ss = container_of(work,
- struct sysfs_schedule_callback_struct, work);
-
- (ss->func)(ss->data);
- kobject_put(ss->kobj);
- module_put(ss->owner);
- mutex_lock(&sysfs_workq_mutex);
- list_del(&ss->workq_list);
- mutex_unlock(&sysfs_workq_mutex);
- kfree(ss);
-}
-
-/**
- * sysfs_schedule_callback - helper to schedule a callback for a kobject
- * @kobj: object we're acting for.
- * @func: callback function to invoke later.
- * @data: argument to pass to @func.
- * @owner: module owning the callback code
- *
- * sysfs attribute methods must not unregister themselves or their parent
- * kobject (which would amount to the same thing). Attempts to do so will
- * deadlock, since unregistration is mutually exclusive with driver
- * callbacks.
- *
- * Instead methods can call this routine, which will attempt to allocate
- * and schedule a workqueue request to call back @func with @data as its
- * argument in the workqueue's process context. @kobj will be pinned
- * until @func returns.
- *
- * Returns 0 if the request was submitted, -ENOMEM if storage could not
- * be allocated, -ENODEV if a reference to @owner isn't available,
- * -EAGAIN if a callback has already been scheduled for @kobj.
- */
-int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
- void *data, struct module *owner)
-{
- struct sysfs_schedule_callback_struct *ss, *tmp;
-
- if (!try_module_get(owner))
- return -ENODEV;
-
- mutex_lock(&sysfs_workq_mutex);
- list_for_each_entry_safe(ss, tmp, &sysfs_workq, workq_list)
- if (ss->kobj == kobj) {
- module_put(owner);
- mutex_unlock(&sysfs_workq_mutex);
- return -EAGAIN;
- }
- mutex_unlock(&sysfs_workq_mutex);
-
- if (sysfs_workqueue == NULL) {
- sysfs_workqueue = create_singlethread_workqueue("sysfsd");
- if (sysfs_workqueue == NULL) {
- module_put(owner);
- return -ENOMEM;
- }
- }
-
- ss = kmalloc(sizeof(*ss), GFP_KERNEL);
- if (!ss) {
- module_put(owner);
- return -ENOMEM;
- }
- kobject_get(kobj);
- ss->kobj = kobj;
- ss->func = func;
- ss->data = data;
- ss->owner = owner;
- INIT_WORK(&ss->work, sysfs_schedule_callback_work);
- INIT_LIST_HEAD(&ss->workq_list);
- mutex_lock(&sysfs_workq_mutex);
- list_add_tail(&ss->workq_list, &sysfs_workq);
- mutex_unlock(&sysfs_workq_mutex);
- queue_work(sysfs_workqueue, &ss->work);
- return 0;
-}
-EXPORT_SYMBOL_GPL(sysfs_schedule_callback);
diff --git a/include/linux/device.h b/include/linux/device.h
index 1ff3f16..fb1ba13 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -566,12 +566,6 @@ extern int __must_check device_create_bin_file(struct device *dev,
const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr);
-extern int device_schedule_callback_owner(struct device *dev,
- void (*func)(struct device *dev), struct module *owner);
-
-/* This is a macro to avoid include problems with THIS_MODULE */
-#define device_schedule_callback(dev, func) \
- device_schedule_callback_owner(dev, func, THIS_MODULE)

/* device resource management */
typedef void (*dr_release_t)(struct device *dev, void *res);
@@ -931,10 +925,7 @@ extern int device_online(struct device *dev);
extern struct device *__root_device_register(const char *name,
struct module *owner);

-/*
- * This is a macro to avoid include problems with THIS_MODULE,
- * just as per what is done for device_schedule_callback() above.
- */
+/* This is a macro to avoid include problems with THIS_MODULE */
#define root_device_register(name) \
__root_device_register(name, THIS_MODULE)

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 5278eb4..5a3ab4f 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -178,9 +178,6 @@ struct sysfs_ops {

#ifdef CONFIG_SYSFS

-int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
- void *data, struct module *owner);
-
int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
void sysfs_remove_dir(struct kobject *kobj);
int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
@@ -249,12 +246,6 @@ int __must_check sysfs_init(void);

#else /* CONFIG_SYSFS */

-static inline int sysfs_schedule_callback(struct kobject *kobj,
- void (*func)(void *), void *data, struct module *owner)
-{
- return -ENOSYS;
-}
-
static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
{
return 0;
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 4 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


driver-core now supports synchrnous self-deletion of attributes and
the asynchrnous removal mechanism is scheduled for removal. Use it
instead of device_schedule_callback(). This makes "remove" behave
synchronously.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
---
drivers/pci/pci-sysfs.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c91e6c1..94d1cb8 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -352,32 +352,20 @@ static struct device_attribute dev_rescan_attr = __ATTR(rescan,
(S_IWUSR|S_IWGRP),
NULL, dev_rescan_store);

-static void remove_callback(struct device *dev)
-{
- struct pci_dev *pdev = to_pci_dev(dev);
-
- mutex_lock(&pci_remove_rescan_mutex);
- pci_stop_and_remove_bus_device(pdev);
- mutex_unlock(&pci_remove_rescan_mutex);
-}
-
static ssize_t
-remove_store(struct device *dev, struct device_attribute *dummy,
+remove_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- int ret = 0;
unsigned long val;

if (kstrtoul(buf, 0, &val) < 0)
return -EINVAL;

- /* An attribute cannot be unregistered by one of its own methods,
- * so we have to use this roundabout approach.
- */
- if (val)
- ret = device_schedule_callback(dev, remove_callback);
- if (ret)
- count = ret;
+ if (val && device_remove_file_self(dev, attr)) {
+ mutex_lock(&pci_remove_rescan_mutex);
+ pci_stop_and_remove_bus_device(to_pci_dev(dev));
+ mutex_unlock(&pci_remove_rescan_mutex);
+ }
return count;
}
static struct device_attribute dev_remove_attr = __ATTR(remove,
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 5 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


Oops, wrong title. Reposting. No content change. git branch updated
accordingly.

Thanks.
----- 8< -----
From d0da0022677724a45cdd53dbd13eb194e6595cd2 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Tue, 7 Jan 2014 13:02:51 -0500

All device_schedule_callback_owner() users are converted to use
device_remove_file_self(). Remove now unused
{sysfs|device}_schedule_callback_owner().

Signed-off-by: Tejun Heo <tj@kernel.org>
---
drivers/base/core.c | 33 ------------------
fs/sysfs/file.c | 92 --------------------------------------------------
include/linux/device.h | 11 +-----
include/linux/sysfs.h | 9 -----
4 files changed, 1 insertion(+), 144 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9db57af..4195364 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -615,39 +615,6 @@ void device_remove_bin_file(struct device *dev,
}
EXPORT_SYMBOL_GPL(device_remove_bin_file);

-/**
- * device_schedule_callback_owner - helper to schedule a callback for a device
- * @dev: device.
- * @func: callback function to invoke later.
- * @owner: module owning the callback routine
- *
- * Attribute methods must not unregister themselves or their parent device
- * (which would amount to the same thing). Attempts to do so will deadlock,
- * since unregistration is mutually exclusive with driver callbacks.
- *
- * Instead methods can call this routine, which will attempt to allocate
- * and schedule a workqueue request to call back @func with @dev as its
- * argument in the workqueue's process context. @dev will be pinned until
- * @func returns.
- *
- * This routine is usually called via the inline device_schedule_callback(),
- * which automatically sets @owner to THIS_MODULE.
- *
- * Returns 0 if the request was submitted, -ENOMEM if storage could not
- * be allocated, -ENODEV if a reference to @owner isn't available.
- *
- * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an
- * underlying sysfs routine (since it is intended for use by attribute
- * methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
- */
-int device_schedule_callback_owner(struct device *dev,
- void (*func)(struct device *), struct module *owner)
-{
- return sysfs_schedule_callback(&dev->kobj,
- (void (*)(void *)) func, dev, owner);
-}
-EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
-
static void klist_children_get(struct klist_node *n)
{
struct device_private *p = to_device_private_parent(n);
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 1b8b91b..28cc1acd 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -453,95 +453,3 @@ void sysfs_remove_bin_file(struct kobject *kobj,
kernfs_remove_by_name(kobj->sd, attr->attr.name);
}
EXPORT_SYMBOL_GPL(sysfs_remove_bin_file);
-
-struct sysfs_schedule_callback_struct {
- struct list_head workq_list;
- struct kobject *kobj;
- void (*func)(void *);
- void *data;
- struct module *owner;
- struct work_struct work;
-};
-
-static struct workqueue_struct *sysfs_workqueue;
-static DEFINE_MUTEX(sysfs_workq_mutex);
-static LIST_HEAD(sysfs_workq);
-static void sysfs_schedule_callback_work(struct work_struct *work)
-{
- struct sysfs_schedule_callback_struct *ss = container_of(work,
- struct sysfs_schedule_callback_struct, work);
-
- (ss->func)(ss->data);
- kobject_put(ss->kobj);
- module_put(ss->owner);
- mutex_lock(&sysfs_workq_mutex);
- list_del(&ss->workq_list);
- mutex_unlock(&sysfs_workq_mutex);
- kfree(ss);
-}
-
-/**
- * sysfs_schedule_callback - helper to schedule a callback for a kobject
- * @kobj: object we're acting for.
- * @func: callback function to invoke later.
- * @data: argument to pass to @func.
- * @owner: module owning the callback code
- *
- * sysfs attribute methods must not unregister themselves or their parent
- * kobject (which would amount to the same thing). Attempts to do so will
- * deadlock, since unregistration is mutually exclusive with driver
- * callbacks.
- *
- * Instead methods can call this routine, which will attempt to allocate
- * and schedule a workqueue request to call back @func with @data as its
- * argument in the workqueue's process context. @kobj will be pinned
- * until @func returns.
- *
- * Returns 0 if the request was submitted, -ENOMEM if storage could not
- * be allocated, -ENODEV if a reference to @owner isn't available,
- * -EAGAIN if a callback has already been scheduled for @kobj.
- */
-int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
- void *data, struct module *owner)
-{
- struct sysfs_schedule_callback_struct *ss, *tmp;
-
- if (!try_module_get(owner))
- return -ENODEV;
-
- mutex_lock(&sysfs_workq_mutex);
- list_for_each_entry_safe(ss, tmp, &sysfs_workq, workq_list)
- if (ss->kobj == kobj) {
- module_put(owner);
- mutex_unlock(&sysfs_workq_mutex);
- return -EAGAIN;
- }
- mutex_unlock(&sysfs_workq_mutex);
-
- if (sysfs_workqueue == NULL) {
- sysfs_workqueue = create_singlethread_workqueue("sysfsd");
- if (sysfs_workqueue == NULL) {
- module_put(owner);
- return -ENOMEM;
- }
- }
-
- ss = kmalloc(sizeof(*ss), GFP_KERNEL);
- if (!ss) {
- module_put(owner);
- return -ENOMEM;
- }
- kobject_get(kobj);
- ss->kobj = kobj;
- ss->func = func;
- ss->data = data;
- ss->owner = owner;
- INIT_WORK(&ss->work, sysfs_schedule_callback_work);
- INIT_LIST_HEAD(&ss->workq_list);
- mutex_lock(&sysfs_workq_mutex);
- list_add_tail(&ss->workq_list, &sysfs_workq);
- mutex_unlock(&sysfs_workq_mutex);
- queue_work(sysfs_workqueue, &ss->work);
- return 0;
-}
-EXPORT_SYMBOL_GPL(sysfs_schedule_callback);
diff --git a/include/linux/device.h b/include/linux/device.h
index 1ff3f16..fb1ba13 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -566,12 +566,6 @@ extern int __must_check device_create_bin_file(struct device *dev,
const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr);
-extern int device_schedule_callback_owner(struct device *dev,
- void (*func)(struct device *dev), struct module *owner);
-
-/* This is a macro to avoid include problems with THIS_MODULE */
-#define device_schedule_callback(dev, func) \
- device_schedule_callback_owner(dev, func, THIS_MODULE)

/* device resource management */
typedef void (*dr_release_t)(struct device *dev, void *res);
@@ -931,10 +925,7 @@ extern int device_online(struct device *dev);
extern struct device *__root_device_register(const char *name,
struct module *owner);

-/*
- * This is a macro to avoid include problems with THIS_MODULE,
- * just as per what is done for device_schedule_callback() above.
- */
+/* This is a macro to avoid include problems with THIS_MODULE */
#define root_device_register(name) \
__root_device_register(name, THIS_MODULE)

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 5278eb4..5a3ab4f 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -178,9 +178,6 @@ struct sysfs_ops {

#ifdef CONFIG_SYSFS

-int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
- void *data, struct module *owner);
-
int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
void sysfs_remove_dir(struct kobject *kobj);
int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
@@ -249,12 +246,6 @@ int __must_check sysfs_init(void);

#else /* CONFIG_SYSFS */

-static inline int sysfs_schedule_callback(struct kobject *kobj,
- void (*func)(void *), void *data, struct module *owner)
-{
- return -ENOSYS;
-}
-
static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
{
return 0;
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 6 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


The recursive nature of kernfs_remove() means that, even if
kernfs_remove() is not allowed to be called multiple times on the same
node, there may be race conditions between removal of parent and its
descendants. While we can claim that kernfs_remove() shouldn't be
called on one of the descendants while the removal of an ancestor is
in progress, such rule is unnecessarily restrictive and very difficult
to enforce. It's better to simply allow invoking kernfs_remove() as
the caller sees fit as long as the caller ensures that the node is
accessible.

The current behavior in such situations is broken. Whoever enters
removal path first takes the node off the hierarchy and then
deactivates. Following removers either return as soon as it notices
that it's not the first one or can't even find the target node as it
has already been removed from the hierarchy. In both cases, the
following removers may finish prematurely while the nodes which should
be removed and drained are still being processed by the first one.

This patch restructures so that multiple removers, whether through
recursion or direction invocation, always follow the following rules.

* When there are multiple concurrent removers, only one puts the base
ref.

* Regardless of which one puts the base ref, all removers are blocked
until the target node is fully deactivated and removed.

To achieve the above, removal path now first marks all descendants
including self REMOVED and then deactivates and unlinks leftmost
descendant one-by-one. kernfs_deactivate() is called directly from
__kernfs_removal() and drops and regrabs kernfs_mutex for each
descendant to drain active refs. As this means that multiple removers
can enter kernfs_deactivate() for the same node, the function is
updated so that it can handle multiple deactivators of the same node -
only one actually deactivates but all wait till drain completion.

The restructured removal path guarantees that a removed node gets
unlinked only after the node is deactivated and drained. Combined
with proper multiple deactivator handling, this guarantees that any
invocation of kernfs_remove() returns only after the node itself and
all its descendants are deactivated, drained and removed.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/kernfs/dir.c | 112 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 61 insertions(+), 51 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index ed62de6..a73caa6 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -106,18 +106,24 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
* kernfs_unlink_sibling - unlink kernfs_node from sibling rbtree
* @kn: kernfs_node of interest
*
- * Unlink @kn from its sibling rbtree which starts from
- * kn->parent->dir.children.
+ * Try to unlink @kn from its sibling rbtree which starts from
+ * kn->parent->dir.children. Returns %true if @kn was actually
+ * removed, %false if @kn wasn't on the rbtree.
*
* Locking:
* mutex_lock(kernfs_mutex)
*/
-static void kernfs_unlink_sibling(struct kernfs_node *kn)
+static bool kernfs_unlink_sibling(struct kernfs_node *kn)
{
+ if (RB_EMPTY_NODE(&kn->rb))
+ return false;
+
if (kernfs_type(kn) == KERNFS_DIR)
kn->parent->dir.subdirs--;

rb_erase(&kn->rb, &kn->parent->dir.children);
+ RB_CLEAR_NODE(&kn->rb);
+ return true;
}

/**
@@ -171,29 +177,39 @@ void kernfs_put_active(struct kernfs_node *kn)
* kernfs_deactivate - deactivate kernfs_node
* @kn: kernfs_node to deactivate
*
- * Deny new active references and drain existing ones.
+ * Deny new active references and drain existing ones. Mutiple
+ * removers may invoke this function concurrently on @kn and all will
+ * return after deactivation and draining are complete.
*/
static void kernfs_deactivate(struct kernfs_node *kn)
+ __releases(&kernfs_mutex) __acquires(&kernfs_mutex)
{
struct kernfs_root *root = kernfs_root(kn);

+ lockdep_assert_held(&kernfs_mutex);
BUG_ON(!(kn->flags & KERNFS_REMOVED));

if (!(kernfs_type(kn) & KERNFS_ACTIVE_REF))
return;

- rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
+ /* only the first invocation on @kn should deactivate it */
+ if (atomic_read(&kn->active) >= 0)
+ atomic_add(KN_DEACTIVATED_BIAS, &kn->active);

- atomic_add(KN_DEACTIVATED_BIAS, &kn->active);
+ mutex_unlock(&kernfs_mutex);

+ rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
if (atomic_read(&kn->active) != KN_DEACTIVATED_BIAS)
lock_contended(&kn->dep_map, _RET_IP_);

+ /* but everyone should wait for draining */
wait_event(root->deactivate_waitq,
atomic_read(&kn->active) == KN_DEACTIVATED_BIAS);

lock_acquired(&kn->dep_map, _RET_IP_);
rwsem_release(&kn->dep_map, 1, _RET_IP_);
+
+ mutex_lock(&kernfs_mutex);
}

/**
@@ -342,6 +358,7 @@ struct kernfs_node *kernfs_new_node(struct kernfs_root *root, const char *name,

atomic_set(&kn->count, 1);
atomic_set(&kn->active, 0);
+ RB_CLEAR_NODE(&kn->rb);

kn->name = name;
kn->mode = mode;
@@ -438,49 +455,6 @@ int kernfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
}

/**
- * kernfs_remove_one - remove kernfs_node from parent
- * @acxt: addrm context to use
- * @kn: kernfs_node to be removed
- *
- * Mark @kn removed and drop nlink of parent inode if @kn is a
- * directory. @kn is unlinked from the children list.
- *
- * This function should be called between calls to
- * kernfs_addrm_start() and kernfs_addrm_finish() and should be
- * passed the same @acxt as passed to kernfs_addrm_start().
- *
- * LOCKING:
- * Determined by kernfs_addrm_start().
- */
-static void kernfs_remove_one(struct kernfs_addrm_cxt *acxt,
- struct kernfs_node *kn)
-{
- struct kernfs_iattrs *ps_iattr;
-
- /*
- * Removal can be called multiple times on the same node. Only the
- * first invocation is effective and puts the base ref.
- */
- if (kn->flags & KERNFS_REMOVED)
- return;
-
- if (kn->parent) {
- kernfs_unlink_sibling(kn);
-
- /* Update timestamps on the parent */
- ps_iattr = kn->parent->iattr;
- if (ps_iattr) {
- ps_iattr->ia_iattr.ia_ctime = CURRENT_TIME;
- ps_iattr->ia_iattr.ia_mtime = CURRENT_TIME;
- }
- }
-
- kn->flags |= KERNFS_REMOVED;
- kn->u.removed_list = acxt->removed;
- acxt->removed = kn;
-}
-
-/**
* kernfs_addrm_finish - finish up kernfs_node add/remove
* @acxt: addrm context to finish up
*
@@ -503,7 +477,6 @@ void kernfs_addrm_finish(struct kernfs_addrm_cxt *acxt)

acxt->removed = kn->u.removed_list;

- kernfs_deactivate(kn);
kernfs_unmap_bin_file(kn);
kernfs_put(kn);
}
@@ -814,18 +787,55 @@ static void __kernfs_remove(struct kernfs_addrm_cxt *acxt,
{
struct kernfs_node *pos, *next;

+ lockdep_assert_held(&kernfs_mutex);
+
if (!kn)
return;

pr_debug("kernfs %s: removing\n", kn->name);

+ /* disable lookup and node creation under @kn */
next = NULL;
do {
pos = next;
next = kernfs_next_descendant_post(pos, kn);
if (pos)
- kernfs_remove_one(acxt, pos);
+ pos->flags |= KERNFS_REMOVED;
} while (next);
+
+ /* deactivate and unlink the subtree node-by-node */
+ do {
+ pos = kernfs_leftmost_descendant(kn);
+
+ /*
+ * kernfs_deactivate() drops kernfs_mutex temporarily and
+ * @pos's base ref could have been put by someone else by
+ * the time the function returns. Make sure it doesn't go
+ * away underneath us.
+ */
+ kernfs_get(pos);
+
+ kernfs_deactivate(pos);
+
+ /*
+ * kernfs_unlink_sibling() succeeds once per node. Use it
+ * to decide who's responsible for cleanups.
+ */
+ if (kernfs_unlink_sibling(pos)) {
+ struct kernfs_iattrs *ps_iattr = pos->parent->iattr;
+
+ /* update timestamps on the parent */
+ if (ps_iattr) {
+ ps_iattr->ia_iattr.ia_ctime = CURRENT_TIME;
+ ps_iattr->ia_iattr.ia_mtime = CURRENT_TIME;
+ }
+
+ pos->u.removed_list = acxt->removed;
+ acxt->removed = pos;
+ }
+
+ kernfs_put(pos);
+ } while (pos != kn);
}

/**
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 7 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


kernfs_unmap_bin_file() is supposed to unmap all memory mappings of
the target file before kernfs_remove() finishes; however, it currently
is being called from kernfs_addrm_finish() and has the same race
problem as the original implementation of deactivation when there are
multiple removers - only the remover which snatches the node to its
addrm_cxt->removed list is guaranteed to wait for its completion
before returning.

It can be easily fixed by moving kernfs_unmap_bin_file() invocation
from kernfs_addrm_finish() to kernfs_deactivated(). The function may
be called multiple times but that shouldn't do any harm.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/kernfs/dir.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index a73caa6..ff633d2 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -177,9 +177,10 @@ void kernfs_put_active(struct kernfs_node *kn)
* kernfs_deactivate - deactivate kernfs_node
* @kn: kernfs_node to deactivate
*
- * Deny new active references and drain existing ones. Mutiple
- * removers may invoke this function concurrently on @kn and all will
- * return after deactivation and draining are complete.
+ * Deny new active references, drain existing ones and nuke all
+ * existing mmaps. Mutiple removers may invoke this function
+ * concurrently on @kn and all will return after deactivation and
+ * draining are complete.
*/
static void kernfs_deactivate(struct kernfs_node *kn)
__releases(&kernfs_mutex) __acquires(&kernfs_mutex)
@@ -209,6 +210,8 @@ static void kernfs_deactivate(struct kernfs_node *kn)
lock_acquired(&kn->dep_map, _RET_IP_);
rwsem_release(&kn->dep_map, 1, _RET_IP_);

+ kernfs_unmap_bin_file(kn);
+
mutex_lock(&kernfs_mutex);
}

@@ -477,7 +480,6 @@ void kernfs_addrm_finish(struct kernfs_addrm_cxt *acxt)

acxt->removed = kn->u.removed_list;

- kernfs_unmap_bin_file(kn);
kernfs_put(kn);
}
}
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




== 8 of 8 ==
Date: Tues, Jan 7 2014 10:10 am
From: Tejun Heo


Sometimes it's necessary to implement a node which wants to delete
nodes including itself. This isn't straightforward because of kernfs
active reference. While a file operation is in progress, an active
reference is held and kernfs_remove() waits for all such references to
drain before completing. For a self-deleting node, this is a deadlock
as kernfs_remove() ends up waiting for an active reference that itself
is sitting on top of.

This currently is worked around in the sysfs layer using
sysfs_schedule_callback() which makes such removals asynchronous.
While it works, it's rather cumbersome and inherently breaks
synchronicity of the operation - the file operation which triggered
the operation may complete before the removal is finished (or even
started) and the removal may fail asynchronously. If a removal
operation is immmediately followed by another operation which expects
the specific name to be available (e.g. removal followed by rename
onto the same name), there's no way to make the latter operation
reliable.

The thing is there's no inherent reason for this to be asynchrnous.
All that's necessary to do this synchronous is a dedicated operation
which drops its own active ref and deactivates self. This patch
implements kernfs_remove_self() and its wrappers in sysfs and driver
core. kernfs_remove_self() is to be called from one of the file
operations, drops the active ref the task is holding, removes the self
node, and restores active ref to the dead node so that the ref is
balanced afterwards. __kernfs_remove() is updated so that it takes an
early exit if the target node is already fully removed so that the
active ref restored by kernfs_remove_self() after removal doesn't
confuse the deactivation path.

This makes implementing self-deleting nodes very easy. The normal
removal path doesn't even need to be changed to use
kernfs_remove_self() for the self-deleting node. The method can
invoke kernfs_remove_self() on itself before proceeding the normal
removal path. kernfs_remove() invoked on the node by the normal
deletion path will simply be ignored.

This will replace sysfs_schedule_callback(). A subtle feature of
sysfs_schedule_callback() is that it collapses multiple invocations -
even if multiple removals are triggered, the removal callback is run
only once. An equivalent effect can be achieved by testing the return
value of kernfs_remove_self() - only the one which gets %true return
value should proceed with actual deletion. All other instances of
kernfs_remove_self() will wait till the enclosing kernfs operation
which invoked the winning instance of kernfs_remove_self() finishes
and then return %false. This trivially makes all users of
kernfs_remove_self() automatically show correct synchronous behavior
even when there are multiple concurrent operations - all "echo 1 >
delete" instances will finish only after the whole operation is
completed by one of the instances.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
---
drivers/base/core.c | 17 +++++++++
fs/kernfs/dir.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++-
fs/sysfs/file.c | 23 +++++++++++++
include/linux/device.h | 2 ++
include/linux/kernfs.h | 3 ++
include/linux/sysfs.h | 6 ++++
6 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2b56717..9db57af 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -571,6 +571,23 @@ void device_remove_file(struct device *dev,
EXPORT_SYMBOL_GPL(device_remove_file);

/**
+ * device_remove_file_self - remove sysfs attribute file from its own method.
+ * @dev: device.
+ * @attr: device attribute descriptor.
+ *
+ * See kernfs_remove_self() for details.
+ */
+bool device_remove_file_self(struct device *dev,
+ const struct device_attribute *attr)
+{
+ if (dev)
+ return sysfs_remove_file_self(&dev->kobj, &attr->attr);
+ else
+ return false;
+}
+EXPORT_SYMBOL_GPL(device_remove_file_self);
+
+/**
* device_create_bin_file - create sysfs binary attribute file for device.
* @dev: device.
* @attr: device binary attribute descriptor.
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 71faef9..df630b3 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -745,7 +745,11 @@ static void __kernfs_remove(struct kernfs_node *kn)

lockdep_assert_held(&kernfs_mutex);

- if (!kn)
+ /*
+ * Short-circuit if @kn has already finished removal. This is for
+ * kernfs_remove_self() which plays with active ref after removal.
+ */
+ if (!kn || RB_EMPTY_NODE(&kn->rb))
return;

pr_debug("kernfs %s: removing\n", kn->name);
@@ -807,6 +811,93 @@ void kernfs_remove(struct kernfs_node *kn)
}

/**
+ * kernfs_remove_self - remove a kernfs_node from its own method
+ * @kn: the self kernfs_node to remove
+ *
+ * The caller must be running off of a kernfs operation which is invoked
+ * with an active reference - e.g. one of kernfs_ops. This can be used to
+ * implement a file operation which deletes itself.
+ *
+ * For example, the "delete" file for a sysfs device directory can be
+ * implemented by invoking kernfs_remove_self() on the "delete" file
+ * itself. This function breaks the circular dependency of trying to
+ * deactivate self while holding an active ref itself. It isn't necessary
+ * to modify the usual removal path to use kernfs_remove_self(). The
+ * "delete" implementation can simply invoke kernfs_remove_self() on self
+ * before proceeding with the usual removal path. kernfs will ignore later
+ * kernfs_remove() on self.
+ *
+ * kernfs_remove_self() can be called multiple times concurrently on the
+ * same kernfs_node. Only the first one actually performs removal and
+ * returns %true. All others will wait until the kernfs operation which
+ * won self-removal finishes and return %false. Note that the losers wait
+ * for the completion of not only the winning kernfs_remove_self() but also
+ * the whole kernfs_ops which won the arbitration. This can be used to
+ * guarantee, for example, all concurrent writes to a "delete" file to
+ * finish only after the whole operation is complete.
+ */
+bool kernfs_remove_self(struct kernfs_node *kn)
+{
+ bool ret;
+
+ mutex_lock(&kernfs_mutex);
+
+ /*
+ * Take out ourself out of the active ref dependency chain. If
+ * we're called without an active ref, lockdep will complain.
+ */
+ kernfs_put_active(kn);
+
+ /*
+ * SUICIDAL is used to arbitrate among competing invocations. Only
+ * the first one will actually perform removal. When the removal
+ * is complete, SUICIDED is set and the active ref is restored
+ * while holding kernfs_mutex. The ones which lost arbitration
+ * waits for SUICDED && drained which can happen only after the
+ * enclosing kernfs operation which executed the winning instance
+ * of kernfs_remove_self() finished.
+ */
+ if (!(kn->flags & KERNFS_SUICIDAL)) {
+ kn->flags |= KERNFS_SUICIDAL;
+ __kernfs_remove(kn);
+ kn->flags |= KERNFS_SUICIDED;
+ ret = true;
+ } else {
+ wait_queue_head_t *waitq = &kernfs_root(kn)->deactivate_waitq;
+ DEFINE_WAIT(wait);
+
+ while (true) {
+ prepare_to_wait(waitq, &wait, TASK_UNINTERRUPTIBLE);
+
+ if ((kn->flags & KERNFS_SUICIDED) &&
+ atomic_read(&kn->active) == KN_DEACTIVATED_BIAS)
+ break;
+
+ mutex_unlock(&kernfs_mutex);
+ schedule();
+ mutex_lock(&kernfs_mutex);
+ }
+ finish_wait(waitq, &wait);
+ WARN_ON_ONCE(!RB_EMPTY_NODE(&kn->rb));
+ ret = false;
+ }
+
+ /*
+ * @kn is fully removed now and future kernfs_remove() invocations
+ * on it will be treated as noop and we can safely bump the active
+ * ref back up so that it's balanced when the enclosing kernfs
+ * operation finshes.
+ */
+ atomic_inc(&kn->active);
+ if (kernfs_lockdep(kn))
+ rwsem_acquire(&kn->dep_map, 0, 1, _RET_IP_);
+
+ mutex_unlock(&kernfs_mutex);
+
+ return ret;
+}
+
+/**
* kernfs_remove_by_name_ns - find a kernfs_node by name and remove it
* @parent: parent of the target
* @name: name of the kernfs_node to remove
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 810cf6e..1b8b91b 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -372,6 +372,29 @@ void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
}
EXPORT_SYMBOL_GPL(sysfs_remove_file_ns);

+/**
+ * sysfs_remove_file_self - remove an object attribute from its own method
+ * @kobj: object we're acting for
+ * @attr: attribute descriptor
+ *
+ * See kernfs_remove_self() for details.
+ */
+bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr)
+{
+ struct kernfs_node *parent = kobj->sd;
+ struct kernfs_node *kn;
+ bool ret;
+
+ kn = kernfs_find_and_get(parent, attr->name);
+ if (WARN_ON_ONCE(!kn))
+ return false;
+
+ ret = kernfs_remove_self(kn);
+
+ kernfs_put(kn);
+ return ret;
+}
+
void sysfs_remove_files(struct kobject *kobj, const struct attribute **ptr)
{
int i;
diff --git a/include/linux/device.h b/include/linux/device.h
index 952b010..1ff3f16 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -560,6 +560,8 @@ extern int device_create_file(struct device *device,
const struct device_attribute *entry);
extern void device_remove_file(struct device *dev,
const struct device_attribute *attr);
+extern bool device_remove_file_self(struct device *dev,
+ const struct device_attribute *attr);
extern int __must_check device_create_bin_file(struct device *dev,
const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev,
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 1238a66..7ef1b85 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -42,6 +42,8 @@ enum kernfs_node_flag {
KERNFS_HAS_MMAP = 0x0080,
KERNFS_LOCKDEP = 0x0100,
KERNFS_STATIC_NAME = 0x0200,
+ KERNFS_SUICIDAL = 0x0400,
+ KERNFS_SUICIDED = 0x0800,
};

/* type-specific structures for kernfs_node union members */
@@ -233,6 +235,7 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
const char *name,
struct kernfs_node *target);
void kernfs_remove(struct kernfs_node *kn);
+bool kernfs_remove_self(struct kernfs_node *kn);
int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
const void *ns);
int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 30b2ebe..5278eb4 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -198,6 +198,7 @@ int __must_check sysfs_chmod_file(struct kobject *kobj,
const struct attribute *attr, umode_t mode);
void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
const void *ns);
+bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);

int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -301,6 +302,11 @@ static inline void sysfs_remove_file_ns(struct kobject *kobj,
{
}

+static inline void sysfs_remove_file_self(struct kobject *kobj,
+ const struct attribute *attr)
+{
+}
+
static inline void sysfs_remove_files(struct kobject *kobj,
const struct attribute **attr)
{
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: kobject: provide kobject_put_wait to fix module unload race
http://groups.google.com/group/linux.kernel/t/f1e8d59a892ab84a?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:10 am
From: Mikulas Patocka




On Tue, 7 Jan 2014, Linus Torvalds wrote:

> This looks completely broken to me. You do a "kobject_put()" and then
> after you've dropped that last use, you wait for the completion of
> something that may already have been free'd.
>
> Wtf? Am I missing something?
>
> Linus

It is correct. The release method dm_kobject_release doesn't free the
kobject. It just signals the completion and returns.

This is the sequence of operations:
* call kobject_put
* wait until all users stop using the kobject, when it happens the release
method is called
* the release method signals the completion and returns
* the unload code that waits on the completion continues
* the unload code frees the mapped_device structure that contains the
kobject

Using kobject this way avoids the module unload race that was mentioned at
the beginning of this thread.

Mikulas

> On Tue, Jan 7, 2014 at 12:01 PM, Mikulas Patocka <mpatocka@redhat.com> wrote:
> >
> >
> > On Mon, 6 Jan 2014, Mike Snitzer wrote:
> >
> >> On Mon, Jan 06 2014 at 1:55pm -0500,
> >> Mikulas Patocka <mpatocka@redhat.com> wrote:
> >>
> >> >
> >> >
> >> > On Sun, 5 Jan 2014, Greg Kroah-Hartman wrote:
> >> >
> >> > > On Sun, Jan 05, 2014 at 05:43:56PM +0100, Bart Van Assche wrote:
> >> > > > On 01/04/14 19:06, Mikulas Patocka wrote:
> >> > > > > - if (t && !t->release)
> >> > > > > - pr_debug("kobject: '%s' (%p): does not have a release() "
> >> > > > > - "function, it is broken and must be fixed.\n",
> >> > > > > - kobject_name(kobj), kobj);
> >> > > > > -
> >> > > >
> >> > > > Has it been considered to issue a warning if no release function has
> >> > > > been defined and free_completion == NULL instead of removing the above
> >> > > > debug message entirely ? I think even with this patch applied it is
> >> > > > still wrong to invoke kobject_put() on an object without defining a
> >> > > > release function.
> >> > >
> >> > > This patch isn't going to be applied, and I've reverted the original
> >> > > commit, so there shouldn't be any issues anymore with this code.
> >> >
> >> > Why? This patch does the same thing as
> >> > eee031649707db3c9920d9498f8d03819b74fc23, but it's smaller. So why did you
> >> > accept eee031649707db3c9920d9498f8d03819b74fc23 and not this?
> >> >
> >> > The code to wait for kobject destruction using completion already exists
> >> > in cpufreq_sysfs_release, cpuidle_sysfs_release,
> >> > cpuidle_state_sysfs_release, cpuidle_driver_sysfs_release,
> >> > ext4_sb_release, ext4_feat_release, f2fs_sb_release (these are the only
> >> > kobject users that are correct w.r.t. module unloading), so if you accept
> >> > this patch, you can simplify them to use kobject_put_wait.
> >>
> >> Hi Mikulas,
> >>
> >> Please just submit a DM-only patch that follows the same racey pattern
> >> of firing a completion from the kobj_type .release method in dm_mod.
> >> I'll get it queued up for 3.14.
> >>
> >> If/when we gets reports of a crash due to dm_mod unload racing with
> >> kobject_put we can revisit this.
> >>
> >> Thanks,
> >> Mike
> >
> > Here I'm sending dm-only patch.
> >
> >
> >
> > dm: wait until kobject is destroyed
> >
> > There may be other parts of the kernel taking reference to the dm kobject.
> > We must wait until they drop the references before deallocating the md
> > structure.
> >
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > Cc: stable@vger.kernel.org
> >
> > ---
> > drivers/md/dm-sysfs.c | 10 +++++++++-
> > drivers/md/dm.c | 11 +++++++++++
> > drivers/md/dm.h | 2 ++
> > 3 files changed, 22 insertions(+), 1 deletion(-)
> >
> > Index: linux-3.13-rc7/drivers/md/dm-sysfs.c
> > ===================================================================
> > --- linux-3.13-rc7.orig/drivers/md/dm-sysfs.c 2014-01-07 02:06:08.000000000 +0100
> > +++ linux-3.13-rc7/drivers/md/dm-sysfs.c 2014-01-07 02:07:09.000000000 +0100
> > @@ -79,6 +79,11 @@ static const struct sysfs_ops dm_sysfs_o
> > .show = dm_attr_show,
> > };
> >
> > +static void dm_kobject_release(struct kobject *kobj)
> > +{
> > + complete(dm_get_completion_from_kobject(kobj));
> > +}
> > +
> > /*
> > * dm kobject is embedded in mapped_device structure
> > * no need to define release function here
> > @@ -86,6 +91,7 @@ static const struct sysfs_ops dm_sysfs_o
> > static struct kobj_type dm_ktype = {
> > .sysfs_ops = &dm_sysfs_ops,
> > .default_attrs = dm_attrs,
> > + .release = dm_kobject_release,
> > };
> >
> > /*
> > @@ -104,5 +110,7 @@ int dm_sysfs_init(struct mapped_device *
> > */
> > void dm_sysfs_exit(struct mapped_device *md)
> > {
> > - kobject_put(dm_kobject(md));
> > + struct kobject *kobj = dm_kobject(md);
> > + kobject_put(kobj);
> > + wait_for_completion(dm_get_completion_from_kobject(kobj));
> > }
> > Index: linux-3.13-rc7/drivers/md/dm.c
> > ===================================================================
> > --- linux-3.13-rc7.orig/drivers/md/dm.c 2014-01-07 02:07:09.000000000 +0100
> > +++ linux-3.13-rc7/drivers/md/dm.c 2014-01-07 04:58:37.000000000 +0100
> > @@ -203,6 +203,9 @@ struct mapped_device {
> > /* sysfs handle */
> > struct kobject kobj;
> >
> > + /* wait until the kobject is released */
> > + struct completion kobj_completion;
> > +
> > /* zero-length flush that will be cloned and submitted to targets */
> > struct bio flush_bio;
> >
> > @@ -2049,6 +2052,7 @@ static struct mapped_device *alloc_dev(i
> > init_waitqueue_head(&md->wait);
> > INIT_WORK(&md->work, dm_wq_work);
> > init_waitqueue_head(&md->eventq);
> > + init_completion(&md->kobj_completion);
> >
> > md->disk->major = _major;
> > md->disk->first_minor = minor;
> > @@ -2931,6 +2935,13 @@ struct mapped_device *dm_get_from_kobjec
> > return md;
> > }
> >
> > +struct completion *dm_get_completion_from_kobject(struct kobject *kobj)
> > +{
> > + struct mapped_device *md = container_of(kobj, struct mapped_device, kobj);
> > +
> > + return &md->kobj_completion;
> > +}
> > +
> > int dm_suspended_md(struct mapped_device *md)
> > {
> > return test_bit(DMF_SUSPENDED, &md->flags);
> > Index: linux-3.13-rc7/drivers/md/dm.h
> > ===================================================================
> > --- linux-3.13-rc7.orig/drivers/md/dm.h 2014-01-07 02:06:08.000000000 +0100
> > +++ linux-3.13-rc7/drivers/md/dm.h 2014-01-07 02:07:09.000000000 +0100
> > @@ -15,6 +15,7 @@
> > #include <linux/list.h>
> > #include <linux/blkdev.h>
> > #include <linux/hdreg.h>
> > +#include <linux/completion.h>
> >
> > #include "dm-stats.h"
> >
> > @@ -152,6 +153,7 @@ int dm_sysfs_init(struct mapped_device *
> > void dm_sysfs_exit(struct mapped_device *md);
> > struct kobject *dm_kobject(struct mapped_device *md);
> > struct mapped_device *dm_get_from_kobject(struct kobject *kobj);
> > +struct completion *dm_get_completion_from_kobject(struct kobject *kobj);
> >
> > /*
> > * Targets for linear and striped mappings
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/





==============================================================================
TOPIC: OMAPDSS: DISPC: horizontal timing too tight errors
http://groups.google.com/group/linux.kernel/t/f2b09789ae626fc0?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Jan 7 2014 10:10 am
From: Pavel Machek


On Tue 2014-01-07 14:35:02, Tomi Valkeinen wrote:
> On 2014-01-06 11:43, Ivaylo Dimitrov wrote:
> > Hi,
> >
> > commit 7faa92339bbb1e6b9a80983b206642517327eb75 "OMAPDSS: DISPC: Handle
> > synclost errors in OMAP3" introduces some limits check to prevent
> > SYNCLOST errors on OMAP3 in a specific usecase. The problem I see here
> > (on Nokia N900, Maemo 5, linux 3.13-rc6, DSP accel video decoding) is
> > that those checks effectively prevent fullscreen video playback of
> > anything above lets say 640x350 with "horizontal timing too tight"
> > errors spit in dmesg log. If I hack check_horiz_timing_omap3 function to
> > always return true, I can happily play videos up to (and including) 720p
> > resolutions, with no SYNCLOST errors.
>
> I never worked with the patch in question, but my understanding is that
> the core issue is quite difficult to solve optimally for all cases.
> There are so many variables involved. So it may well be that the patch
> in question does it a bit over-safely. Then again, it might as well have
> a bug =).

Can we simply revert 7faa92339bbb1e6b9a80983b206642517327eb75 ?

Working around undocumented problems on unspecified machine, but
breaking configuration people actually use seems like a bad idea.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/




==============================================================================

You received this message because you are subscribed to the Google Groups "linux.kernel"
group.

To post to this group, visit http://groups.google.com/group/linux.kernel?hl=en

To unsubscribe from this group, send email to linux.kernel+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/linux.kernel/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate