On Mon, Aug 17, 2009 at 10:10 AM, Greg KH <[email protected]> wrote:

> On Thu, Aug 13, 2009 at 12:57:49PM -0700, srinivasramana wrote:
> >
> > Hi All,
> >
> > 1. I am using the tiny tty driver written by Greg long back. Looks like
> its
> > too old and hence some compilation issues. Once i resolve that, its
> giving
> > BUG on add_timer(i tried in 2.6.28 & 2.6.30).
> > 2. I have two applications one reads and one which calls an ioctl on the
> > same device node. the read app blocks once i start. In the ioctl from
> second
> > app, i am using tty_flip_buffer_push() to write data to tty core so that
> the
> > first app unblocks.
> > But i am surprised to see that the data is written back to the tty device
> > using write call.
> >
> > can anybody help me on this? How do i have first read app get the data?
>
> Can you post the driver that you now have, and the error you are
> getting?
>
> thanks,
>
> greg k-h
>

Hi Greg,

The error which i was getting is pasted below. I could see that this is
getting resolved if i do init_timer in tiny_open() call before calling
add_timer(). So that resolves this crash. But i still could see the
application which is reading on this fd getting unblocked. After further
debugging of tty, i found that at the place it wakes ou the waiting threads,
its check for ICANON flag. when i un set this flag, my app got unblocked.

I am not sure what is this flag for? and why my app got unblocked now.
request help.

Error without init_timer() call:
 ------------[ cut here ]------------
[ 2980.134486] kernel BUG at include/linux/timer.h:165!
[ 2980.134490] invalid opcode: 0000 [#1] SMP
[ 2980.134492] Modules linked in: tinyyy_tty tiny_serial af_packet i915 drm
binfmt_misc rfcomm sco bridge stp bnep l2cap bluetooth ppdev ipv6
acpi_cpufreq cpufreq_userspace cpufreq_conservative cpufreq_ondemand
cpufreq_stats freq_table cpufreq_powersave wmi sbs pci_slot container video
output sbshc battery iptable_filter ip_tables x_tables ac sbp2 parport_pc lp
parport snd_hda_intel snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy
psmouse snd_seq_oss serio_raw joydev evdev pcspkr iTCO_wdt
iTCO_vendor_support snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq
snd_timer snd_seq_device intel_agp button shpchp snd soundcore pci_hotplug
snd_page_alloc agpgart heci ext3 jbd mbcache sr_mod cdrom sd_mod crc_t10dif
sg pata_acpi usbhid hid pata_marvell ata_piix ata_generic ohci1394 ieee1394
libata scsi_mod dock ehci_hcd uhci_hcd usbcore e1000e thermal processor fan
fbcon tileblit font bitblit softcursor fuse [last unloaded: tinyyy_tty]
[ 2980.134571]
[ 2980.134574] Pid: 7089, comm: tty_write Not tainted (2.6.27-7-generic #1)
[ 2980.134576] EIP: 0060:[<f90d79d0>] EFLAGS: 00210286 CPU: 0
[ 2980.134581] EIP is at tiny_open+0x130/0x160 [tinyyy_tty]
[ 2980.134583] EAX: ed37a980 EBX: ed35d300 ECX: ffffffff EDX: ed37a900
[ 2980.134586] ESI: ed11c800 EDI: 00000000 EBP: ed373e24 ESP: ed373e0c
[ 2980.134588]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[ 2980.134591] Process tty_write (pid: 7089, ti=ed372000 task=ed333240
task.ti=ed372000)
[ 2980.134593] Stack: f90d7f68 00000000 ed35d308 f90d78a0 10400000 ed35d180
ed373e48 c02a343c
[ 2980.134600]        00000000 00025e2c 00000000 ed11c800 ed314ca0 ed35d180
00000000 ed373e58
[ 2980.134607]        c02a3644 00000000 ed35d484 ed373e80 c01b4d95 ed35d180
ed314ca0 ed35d484
[ 2980.134614] Call Trace:
[ 2980.134618]  [<f90d78a0>] ? tiny_open+0x0/0x160 [tinyyy_tty]
[ 2980.134623]  [<c02a343c>] ? __tty_open+0x15c/0x340
[ 2980.134629]  [<c02a3644>] ? tty_open+0x24/0x40
[ 2980.134633]  [<c01b4d95>] ? chrdev_open+0xd5/0x1b0
[ 2980.134639]  [<c01b01fc>] ? __dentry_open+0xbc/0x260
[ 2980.134643]  [<c01b0477>] ? nameidata_to_filp+0x47/0x60
[ 2980.134647]  [<c01b4cc0>] ? chrdev_open+0x0/0x1b0
[ 2980.134651]  [<c01bdb1d>] ? do_filp_open+0x1bd/0x790
[ 2980.134655]  [<c01e207c>] ? inotify_inode_queue_event+0xbc/0xe0
[ 2980.134660]  [<c01e1fce>] ? inotify_inode_queue_event+0xe/0xe0
[ 2980.134664]  [<c037e61d>] ? _spin_lock+0xd/0x10
[ 2980.134668]  [<c01b3526>] ? __fput+0x146/0x190
[ 2980.134672]  [<c01c9619>] ? expand_files+0x9/0x60
[ 2980.134676]  [<c01c9750>] ? alloc_fd+0xe0/0x100
[ 2980.134680]  [<c01afff5>] ? do_sys_open+0x65/0x100
[ 2980.134684]  [<c01b00fe>] ? sys_open+0x2e/0x40
[ 2980.134687]  [<c0103f7b>] ? sysenter_do_call+0x12/0x2f
[ 2980.134692]  [<c0370000>] ? default_device_exit+0x70/0xb0
[ 2980.134696]  =======================


Thanks & Regards,
-- Srinivas R

Reply via email to