2.6.14-rt15 IDE compat_semaphore to completion
Subsystems (3)
PATCH 1/1 2.6.14-rt15 IDE compat_semaphore to completion
Hi Ingo,
Please consider if this patch could be included into the next realtime patch.
Aleksey Makarov
include/linux/ide.h +3 -2
@@ -18,6 +18,7 @@#include <linux/bio.h> #include <linux/device.h> #include <linux/pci.h> +#include <linux/completion.h> #include <asm/byteorder.h> #include <asm/system.h> #include <asm/io.h>
@@ -754,7 +755,7 @@ typedef struct ide_drive_s {int crc_count;/* crc counter to reduce drive speed */ struct list_head list;struct device gendev; -struct compat_semaphore gendev_rel_sem;/* to deal with device release() */ +struct completion gendev_rel_sem;/* to deal with device release() */ } ide_drive_t;#define to_ide_device (dev)container_of(dev, ide_drive_t, gendev)
@@ -910,7 +911,7 @@ typedef struct hwif_s { unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */struct device gendev; -struct compat_semaphore gendev_rel_sem;/* To deal with device release() */ +struct completion gendev_rel_sem;/* To deal with device release() */ void *hwif_data;/* extra hwif data */
drivers/ide/ide.c +4 -4
@@ -222,7 +222,7 @@ static void init_hwif_data(ide_hwif_t *h hwif->mwdma_mask =0x80 ;/* disable all mwdma */ hwif->swdma_mask =0x80 ;/* disable all swdma */ -sema_init (&hwif->gendev_rel_sem,0 ); +init_completion (&hwif->gendev_rel_sem);default_hwif_iops (hwif);default_hwif_transport (hwif);
@@ -245,7 +245,7 @@ static void init_hwif_data(ide_hwif_t *h drive->is_flash =0 ; drive->vdma =0 ;INIT_LIST_HEAD (&drive->list); -sema_init (&drive->gendev_rel_sem,0 ); +init_completion (&drive->gendev_rel_sem); } }
@@ -602,7 +602,7 @@ void ide_unregister(unsigned int index) }spin_unlock_irq (&ide_lock);device_unregister (&drive->gendev); -down (&drive->gendev_rel_sem); +wait_for_completion (&drive->gendev_rel_sem);spin_lock_irq (&ide_lock); } hwif->present =0 ;
@@ -662,7 +662,7 @@ void ide_unregister(unsigned int index)/* More messed up locking ... */ spin_unlock_irq (&ide_lock);device_unregister (&hwif->gendev); -down (&hwif->gendev_rel_sem); +wait_for_completion (&hwif->gendev_rel_sem);/* * Remove us from the kernel's knowledge
drivers/ide/ide-probe.c +2 -2
@@ -656,7 +656,7 @@ static void hwif_release_dev (struct dev {ide_hwif_t *hwif =container_of (dev, ide_hwif_t, gendev); -up (&hwif->gendev_rel_sem); +complete (&hwif->gendev_rel_sem); }static void hwif_register (ide_hwif_t *hwif)
@@ -1328,7 +1328,7 @@ static void drive_release_dev (struct de drive->queue =NULL ;spin_unlock_irq (&ide_lock); -up (&drive->gendev_rel_sem); +complete (&drive->gendev_rel_sem); }/*
Ingo Molnar
AppliedQuoted 4 lines · Aleksey Makarov
Hi Ingo,
Please consider if this patch could be included into the next realtime patch.
thanks, applied.
Ingo
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 IDE compat_semaphore to completion
The following patch is from Montavista. I modified it slightly. Semaphores are currently being used where it makes more sense for completions. This patch corrects that.
-- Steve
Source: MontaVista Software, Inc.
Description:
The patch changes semaphores that are initialized as locked to complete().
drivers/ide/ide-probe.c +2 -2
@@ -655,7 +655,7 @@ {ide_hwif_t *hwif =container_of (dev, ide_hwif_t, gendev); -up (&hwif->gendev_rel_sem); +complete (&hwif->gendev_rel_comp); }static void hwif_register (ide_hwif_t *hwif)
@@ -1325,7 +1325,7 @@ drive->queue =NULL ;spin_unlock_irq (&ide_lock); -up (&drive->gendev_rel_sem); +complete (&drive->gendev_rel_comp); }/*
drivers/ide/ide.c +4 -4
@@ -222,7 +222,7 @@ hwif->mwdma_mask =0x80 ;/* disable all mwdma */ hwif->swdma_mask =0x80 ;/* disable all swdma */ -sema_init (&hwif->gendev_rel_sem,0 ); +init_completion (&hwif->gendev_rel_comp);default_hwif_iops (hwif);default_hwif_transport (hwif);
@@ -245,7 +245,7 @@ drive->is_flash =0 ; drive->vdma =0 ;INIT_LIST_HEAD (&drive->list); -sema_init (&drive->gendev_rel_sem,0 ); +init_completion (&drive->gendev_rel_comp); } }
@@ -602,7 +602,7 @@ }spin_unlock_irq (&ide_lock);device_unregister (&drive->gendev); -down (&drive->gendev_rel_sem); +wait_for_completion (&drive->gendev_rel_comp);spin_lock_irq (&ide_lock); } hwif->present =0 ;
@@ -662,7 +662,7 @@/* More messed up locking ... */ spin_unlock_irq (&ide_lock);device_unregister (&hwif->gendev); -down (&hwif->gendev_rel_sem); +wait_for_completion (&hwif->gendev_rel_comp);/* * Remove us from the kernel's knowledge
include/linux/ide.h +3 -2
@@ -18,6 +18,7 @@#include <linux/bio.h> #include <linux/device.h> #include <linux/pci.h> +#include <linux/completion.h> #include <asm/byteorder.h> #include <asm/system.h> #include <asm/io.h>
@@ -759,7 +760,7 @@int crc_count;/* crc counter to reduce drive speed */ struct list_head list;struct device gendev; -struct semaphore gendev_rel_sem;/* to deal with device release() */ +struct completion gendev_rel_comp;/* to deal with device release() */ } ide_drive_t;#define to_ide_device (dev)container_of(dev, ide_drive_t, gendev)
@@ -915,7 +916,7 @@ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */struct device gendev; -struct semaphore gendev_rel_sem;/* To deal with device release() */ +struct completion gendev_rel_comp;/* To deal with device release() */ void *hwif_data;/* extra hwif data */
PATCH 1/1 2.6.14-rt15 IDE compat_semaphore to completion
In reply to a message not in the archiveIngo,
Here's a patch from MontaVista, that I slightly modified. I sent this to the mainline as well (you were CC'd).
-- Steve
Source: MontaVista Software, Inc.
MR: 14219
Type: Defect fix
Disposition: Should be submitted to lkml
Description:
The patch changes semaphores that are initialized as locked to complete().
drivers/ide/ide-probe.c +2 -2
@@ -656,7 +656,7 @@ {ide_hwif_t *hwif =container_of (dev, ide_hwif_t, gendev); -up (&hwif->gendev_rel_sem); +complete (&hwif->gendev_rel_comp); }static void hwif_register (ide_hwif_t *hwif)
@@ -1328,7 +1328,7 @@ drive->queue =NULL ;spin_unlock_irq (&ide_lock); -up (&drive->gendev_rel_sem); +complete (&drive->gendev_rel_comp); }/*
drivers/ide/ide.c +4 -4
@@ -222,7 +222,7 @@ hwif->mwdma_mask =0x80 ;/* disable all mwdma */ hwif->swdma_mask =0x80 ;/* disable all swdma */ -sema_init (&hwif->gendev_rel_sem,0 ); +init_completion (&hwif->gendev_rel_comp);default_hwif_iops (hwif);default_hwif_transport (hwif);
@@ -245,7 +245,7 @@ drive->is_flash =0 ; drive->vdma =0 ;INIT_LIST_HEAD (&drive->list); -sema_init (&drive->gendev_rel_sem,0 ); +init_completion (&drive->gendev_rel_comp); } }
@@ -602,7 +602,7 @@ }spin_unlock_irq (&ide_lock);device_unregister (&drive->gendev); -down (&drive->gendev_rel_sem); +wait_for_completion (&drive->gendev_rel_comp);spin_lock_irq (&ide_lock); } hwif->present =0 ;
@@ -662,7 +662,7 @@/* More messed up locking ... */ spin_unlock_irq (&ide_lock);device_unregister (&hwif->gendev); -down (&hwif->gendev_rel_sem); +wait_for_completion (&hwif->gendev_rel_comp);/* * Remove us from the kernel's knowledge
include/linux/ide.h +3 -2
@@ -18,6 +18,7 @@#include <linux/bio.h> #include <linux/device.h> #include <linux/pci.h> +#include <linux/completion.h> #include <asm/byteorder.h> #include <asm/system.h> #include <asm/io.h>
@@ -754,7 +755,7 @@int crc_count;/* crc counter to reduce drive speed */ struct list_head list;struct device gendev; -struct compat_semaphore gendev_rel_sem;/* to deal with device release() */ +struct completion gendev_rel_comp;/* to deal with device release() */ } ide_drive_t;#define to_ide_device (dev)container_of(dev, ide_drive_t, gendev)
@@ -910,7 +911,7 @@ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */struct device gendev; -struct semaphore gendev_rel_sem;/* To deal with device release() */ +struct completion gendev_rel_comp;/* To deal with device release() */ void *hwif_data;/* extra hwif data */
PATCH 1/1 convert compat sem in block device sx8
In reply to a message not in the archiveIngo,
I decided to add a few more conversions to the list :-)
Here's sx8. Unfortunately, I was only able to test compiling it, since I don't have the hardware. Hence, I'm not sending this to mainline unless someone can test it on yours. (your patch is the new -mm ;-)
-- Steve
drivers/block/sx8.c +6 -8
@@ -27,6 +27,7 @@#include <linux/time.h> #include <linux/hdreg.h> #include <linux/dma-mapping.h> +#include <linux/completion.h> #include <asm/io.h> #include <asm/semaphore.h> #include <asm/uaccess.h>
@@ -280,10 +281,7 @@struct work_struct fsm_task; -/* -* PREEMPT_RT: should be converted to completions. -*/ -struct compat_semaphore probe_sem; +struct completion probe_comp; };struct carm_response {
@@ -1345,7 +1343,7 @@ }case HST_PROBE_FINISHED : -up (&host->probe_sem); +completion (&host->probe_comp);break ;case HST_ERROR :
@@ -1621,7 +1619,7 @@ host->flags = pci_dac ?FL_DAC :0 ;spin_lock_init (&host->lock);INIT_WORK (&host->fsm_task, carm_fsm_task, host); -init_MUTEX_LOCKED (&host->probe_sem); +init_completion (&host->probe_comp);for (i =0 ; i <ARRAY_SIZE (host->req); i++) host->req[i].tag = i;
@@ -1690,8 +1688,8 @@if (rc) goto err_out_free_irq; -DPRINTK ("waiting for probe_sem\n" ); -down (&host->probe_sem); +DPRINTK ("waiting for probe_comp\n" ); +wait_for_completion (&host->probe_comp); printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n", host->name, pci_name(pdev), (int) CARM_MAX_PORTS,
Re: [PATCH -rt] convert compat sem in block device sx8
Quoted 8 lines · Steven Rostedt
Ingo,
I decided to add a few more conversions to the list :-)
Here's sx8. Unfortunately, I was only able to test compiling it, since I don't have the hardware. Hence, I'm not sending this to mainline unless someone can test it on yours. (your patch is the new -mm ;-)
Ack! I sent this after making a small change and never refreshing quilt. So this would not even compile!
Here's the fixed patch:
-- Steve
drivers/block/sx8.c +6 -8
@@ -27,6 +27,7 @@#include <linux/time.h> #include <linux/hdreg.h> #include <linux/dma-mapping.h> +#include <linux/completion.h> #include <asm/io.h> #include <asm/semaphore.h> #include <asm/uaccess.h>
@@ -280,10 +281,7 @@struct work_struct fsm_task; -/* -* PREEMPT_RT: should be converted to completions. -*/ -struct compat_semaphore probe_sem; +struct completion probe_comp; };struct carm_response {
@@ -1345,7 +1343,7 @@ }case HST_PROBE_FINISHED : -up (&host->probe_sem); +complete (&host->probe_comp);break ;case HST_ERROR :
@@ -1621,7 +1619,7 @@ host->flags = pci_dac ?FL_DAC :0 ;spin_lock_init (&host->lock);INIT_WORK (&host->fsm_task, carm_fsm_task, host); -init_MUTEX_LOCKED (&host->probe_sem); +init_completion (&host->probe_comp);for (i =0 ; i <ARRAY_SIZE (host->req); i++) host->req[i].tag = i;
@@ -1690,8 +1688,8 @@if (rc) goto err_out_free_irq; -DPRINTK ("waiting for probe_sem\n" ); -down (&host->probe_sem); +DPRINTK ("waiting for probe_comp\n" ); +wait_for_completion (&host->probe_comp); printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n", host->name, pci_name(pdev), (int) CARM_MAX_PORTS,
Ingo Molnar
AppliedRe: [PATCH -rt] convert compat sem in block device sx8
Quoted 10 lines · Steven Rostedt
Quoted 8 lines · Steven Rostedt
Ingo,
I decided to add a few more conversions to the list :-)
Here's sx8. Unfortunately, I was only able to test compiling it, since I don't have the hardware. Hence, I'm not sending this to mainline unless someone can test it on yours. (your patch is the new -mm ;-)
Quoted 4 lines
Ack! I sent this after making a small change and never refreshing quilt. So this would not even compile!
Here's the fixed patch:
thanks, applied.
Ingo
PATCH 1/1 convert watchdog cpu5wdt from compat_sem to completion.
In reply to a message not in the archiveOK Ingo,
This one is the last. Of the compat_semaphores in drivers that I looked at, these were the trivial ones. The other ones I would not touch unless I had hardware to test with, or the time to look deeper into it.
-- Steve
drivers/char/watchdog/cpu5wdt.c +5 -4
@@ -28,6 +28,7 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/timer.h> +#include <linux/completion.h> #include <asm/io.h> #include <asm/uaccess.h>
@@ -56,7 +57,7 @@/* some device data */ static struct { - struct compat_semaphore stop; + struct completion stop; volatile int running; struct timer_list timer; volatile int queue;
@@ -84,7 +85,7 @@ }else {/* ticks doesn't matter anyway */ -up (&cpu5wdt_device.stop); +complete (&cpu5wdt_device.stop); } }
@@ -238,7 +239,7 @@if ( !val ) printk(KERN_INFO PFX "sorry, was my fault\n"); -init_MUTEX_LOCKED (&cpu5wdt_device.stop); +init_completion (&cpu5wdt_device.stop); cpu5wdt_device.queue =0 ;clear_bit (0 , &cpu5wdt_device.inuse);
@@ -268,7 +269,7 @@ {if ( cpu5wdt_device.queue ) { cpu5wdt_device.queue =0 ; -down (&cpu5wdt_device.stop); +wait_for_completion (&cpu5wdt_device.stop); }misc_deregister (&cpu5wdt_misc);
Ingo Molnar
AppliedRe: [PATCH -rt] convert watchdog cpu5wdt from compat_sem to completion.
Quoted 6 lines · Steven Rostedt
OK Ingo,
This one is the last. Of the
compat_semaphoresin drivers that I looked at, these were the trivial ones. The other ones I would not touch unless I had hardware to test with, or the time to look deeper into it.
thanks, applied.
Ingo