Re: Could we use jprobe to skip kprboed function
On Tue, Feb 26, 2019 at 11:59 AM wuzhouhui wrote: > > Hi, > > The documentation of jprobe says that we must call jprobe_return() > before return. I'm wondering what if we don't call jprobe_return, and > could we use it to skip probed function? Hi, Please keep in mind the jprobe is likely to be removed unless it was already. https://lwn.net/Articles/735667/ thanks, daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Kernel API's for ADC
On Wed, Jul 25, 2018 at 1:25 PM, chandrasekhar wrote: > Hi, > > > > Are there any kernel API's for ADC. I am using NXP IMX6UL processor. I have > to read ADC values in kernel space instead of sysfs/userspace. It depends on the type of driver used. Either input or IIO. The sysfs interface for IIO is described here: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: New to the Kernel Newbie
Hi, You can have a look at our Linux kernel labs: https://linux-kernel-labs.github.io/master/ For example, start with a short introduction to Linux kernel: https://linux-kernel-labs.github.io/master/labs/introduction.html then create a simple kernel module: https://linux-kernel-labs.github.io/master/labs/kernel_modules.html Hope this helps. thanks, Daniel. On Mon, May 21, 2018 at 12:24 PM, Janakiramireddy Tammawrote: > Hello, > > I am completely new to the kernel newbie, can some one help me where can I > get started. > > Thanks > Janaki Rami Reddy > > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Add IIO example to the kernelnewbies wiki
Sure, you can do that. Nice to see that you are using Diolan DLN-2 adapter. thanks, Daniel. On Mon, Apr 2, 2018 at 8:06 PM, Gaston Gonzalezwrote: > Hi, > > I'm testing an AD7746 eval board using a Diolan DLN-2 adapter. I wrote > some basic notes about the installation an instanciation process for my > own use. But then I thought it could be useful for someone else. So > maybe I could put this in the kernel newbies page under the IIO section? > > If you think is worth it, I would be glad to add it to the wiki page. > > Best regards, > > Gaston > > Notes: > > The setup > = > > AD7746-EVAL BOARD --> Diolan DLN-2 Adapter --> Thinkpad T430 > > The connection between the AD7746 eval board and adapter is as detailed > in [2] I2C Interface Configuration Options, External connection (pag 4). > > The connection between Diolan DLN-2 and the T430 is USB straighforward. > > Drivers > === > > Both in mainline kernel: > > - Diolan DLN-2 driver: I2C_DLN2 (prompt Diolan DLN-2 USB I2C adapter) > Loc: drivers/i2c/busses/ > - AD7746: AD7746 > Loc: drivers/staging/iio/cdc/ > > Bus of interest > === > > $ sudo i2cdetect -l > > We get something like: > > ... > i2c-10 i2c dln2-i2c-1-1.2:1.0-0I2C adapter > ... > > So our bus is the number 10. > > Getting the address > === > > $ sudo i2cdetect -y -r 10 > > We get something like: > > 0 1 2 3 4 5 6 7 8 9 a b c d e f > 00: -- -- -- -- -- -- -- -- -- -- -- -- -- > 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- > 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 70: -- -- -- -- -- -- -- -- > > 3. Device instantiation: > > # echo add7746 0x48 > /sys/bus/i2c/devices/i2c-10/new_device > > We must see something like: > > $ cd /sys/bus/i2c/devices/i2c-10/10-0048/ > $ ls > driver iio:device0 modalias name power subsystem uevent > > $ cd iio:device0 > $ ls > dev in_capacitance-capacitance_calibbias > in_capacitance0_calibbias_calibration > in_capacitance-capacitance_sampling_frequency > in_capacitance0_calibscale in_capacitance-capacitance_scale > in_capacitance0_calibscale_calibration in_capacitance_sampling_frequency > in_capacitance0-capacitance2_calibscale > in_capacitance_sampling_frequency_available > in_capacitance0-capacitance2_offset in_capacitance_scale > in_capacitance0-capacitance2_raw in_temp0_input > in_capacitance0_offset in_temp1_input > in_capacitance0_raw in_voltage0_calibscale_calibration > in_capacitance1_calibbias_calibrationin_voltage0_raw > in_capacitance1_calibscale in_voltage1_supply_raw > in_capacitance1_calibscale_calibration in_voltage_sampling_frequency > in_capacitance1-capacitance3_calibscale > in_voltage_sampling_frequency_available > in_capacitance1-capacitance3_offset in_voltage_scale > in_capacitance1-capacitance3_raw name > in_capacitance1_offset power > in_capacitance1_raw subsystem > in_capacitance_calibbias uevent > > Checking the permits: > > $ ll > -r--r--r-- 1 root root 4096 mar 31 09:57 dev > --w--- 1 root root 4096 mar 31 09:57 in_capacitance0_calibbias_calibration > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance0_calibscale > --w--- 1 root root 4096 mar 31 09:57 > in_capacitance0_calibscale_calibration > -rw-r--r-- 1 root root 4096 mar 31 09:57 > in_capacitance0-capacitance2_calibscale > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance0-capacitance2_offset > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance0-capacitance2_raw > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance0_offset > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance0_raw > --w--- 1 root root 4096 mar 31 09:57 in_capacitance1_calibbias_calibration > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance1_calibscale > --w--- 1 root root 4096 mar 31 09:57 > in_capacitance1_calibscale_calibration > -rw-r--r-- 1 root root 4096 mar 31 09:57 > in_capacitance1-capacitance3_calibscale > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance1-capacitance3_offset > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance1-capacitance3_raw > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance1_offset > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance1_raw > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance_calibbias > -rw-r--r-- 1 root root 4096 mar 31 09:57 in_capacitance-capacitance_calibbias > -rw-r--r-- 1 root root 4096 mar 31 09:57 > in_capacitance-capacitance_sampling_frequency > -rw-r--r-- 1 root root 4096 mar 31 09:57
Announce Linux kernel labs project
Hi all, The Linux kernel labs documentation is a collection of "labs" for various device driver topics. For each topic there are two parts: a walk-through which explain the basic concepts and a hands-on part which contains a few exercises. The kernel labs are integrated with Linux kernel Documentation system: https://github.com/linux-kernel-labs/linux To view the generated Linux kernel labs documentation have a look at: https://linux-kernel-labs.github.io/ We kindly appreciate your feedback, directly here or via Issues/Pull Requests on github. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in loading module of Software trigger
Hi, On Sun, Mar 26, 2017 at 9:51 PM, SIMRAN SINGHALwrote: > On Sun, Mar 26, 2017 at 1:47 PM, Jonathan Cameron > wrote: >> Insmod will not pick up dependencies in the same way modprobe will. >> >> Make sure to also insmod industrialio.ko and iio-sw-trigger.ko before the sw >> trigger module. I >> think those are the only ones you will need. > > Thanks > > modprobe works for me as it's depended on industrialio-sw-trigger.ko > > But now I am facing one more probem with iio_generic_buffer in tools/iio > > I am trying to execute iio_generic_buffer: > as given I can use -N -t > > I create trigger with name trig-sample present in > /config/iio/triggers/trig-sample. How did you create the trigger here? The trigger must be created according to its type. So far we have only hrtimer trigger type, so creating a trigger implies creating a directory in: /config/iio/triggers/hrtimer See: http://lxr.free-electrons.com/source/Documentation/iio/iio_configfs.txt#L83 > > $./iio_generic_buffer -N iio_dummy_part_no > iio device number being used is 0 > Failed to find the trigger my_dummy_device-trigger > > Its giving me ^ this error: > > What wrong I am doing? > > I have loaded all the modules including iio_dummy_evgen, iio_dummy. > > How I will be pass trig-sample as an argument to it? > and one more question how can I find Trigger-number of a trigger. > > I am facing same problem with iio_event_monitor:- > > $ ./iio_event_monitor /sys/bus/iio/devices/iio_evgen/poke_ev0 > Here you should use the device node. It is usually /dev/iio:device0. If there is not already created by a daemon there, create it using mknod /dev/iio:device0 c major minor. The major and minor can be found in /sys/bus/iio/devices/iio:device0/dev file/ > getting following error:- > Failed to retrieve event fd > > Same with all other events. > > This is working fine for me: > echo 1 > /sys/bus/iio/devices/iio_evgen/poke_ev0 thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux Kernel Based Research Projects
On Tue, Oct 4, 2016 at 4:08 AM, Robert P. J. Day <rpj...@crashcourse.ca> wrote: > On Sun, 2 Oct 2016, Daniel Baluta wrote: > >> On Sun, Oct 2, 2016 at 2:54 PM, Shyam Saini <mayhs11sa...@gmail.com> wrote: >> > Hi everyone, >> > >> > I'm final year computer science undergraduate student. I want to do my >> > major project based on linux kernel. >> > >> > Would you please suggest me some areas in the kernel which have some >> > projects. To be more specific, I want know on going research areas in >> > kernel. Or some ideas which are not yet implemented. >> >> Would you be interested in taking a look at lguest? [1] >> >> I will be having a presentation about lguest and how one learn >> linux kernel internals by studying lguest code >> this week at LinuxCon Europe [2] >> >> Porting it on x86_64 or any other architecture will be a very cool project >> but I warn you it won't be trivial :). >> >> thanks, >> Daniel. >> >> [1] http://lguest.ozlabs.org/ >> [2] http://sched.co/7o92 > > Reference [1] claims, "Those crazy guys at Red Hat have an > experimental port of lguest to x86-64: you can grab their git tree." > so why do you say porting to x86_64 wouldn't be trivial? First of all because the linux kernel changed a lot since then. Second, because I think their code wasn't upstream ready. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux Kernel Based Research Projects
On Mon, Oct 3, 2016 at 12:48 PM, shyamwrote: > Thanks a lot for your reply, > I'ld like attend your session but right now I'm in India. So, couldn't > manage everything so early to attend linuxCon Europe. > > Apart from this thing, > I'ld like to work on lguest to port it on x86_64 architecture. > May you please tell me why it is not been ported yet for x86_64 architecture > and can we discuss it further and start work on its porting. It is not yet ported because lack of time and experience with x86_64 arch specifics in my case :). Also, note that this is not a trivial task :), but I think it worths the effort. See here the discussion with people who worked on porting it to x86_64. https://marc.info/?l=lguest=131810934128197=2 thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux Kernel Based Research Projects
On Sun, Oct 2, 2016 at 2:54 PM, Shyam Sainiwrote: > Hi everyone, > > I'm final year computer science undergraduate student. I want to do my > major project based on linux kernel. > > Would you please suggest me some areas in the kernel which have some > projects. To be more specific, I want know on going research areas in > kernel. Or some ideas which are not yet implemented. Would you be interested in taking a look at lguest? [1] I will be having a presentation about lguest and how one learn linux kernel internals by studying lguest code this week at LinuxCon Europe [2] Porting it on x86_64 or any other architecture will be a very cool project but I warn you it won't be trivial :). thanks, Daniel. [1] http://lguest.ozlabs.org/ [2] http://sched.co/7o92 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How to debug ethernet driver ?
On Mon, Aug 1, 2016 at 10:26 PM, Ran Shalitwrote: > Hello, > > I am writing ethernet network driver. > I would like to ask if there are any steps which can help when > debugging ethernet driver, or is it that the first test should already > involve transmit/recieve packets to/from ip stack ? > > Any tips for debugging and testing a new ethernet driver will be appreciated, You can start by testing the loopback mode (perhaps). Also, use wireshark or tcpdump for capturing the packets. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: pushing other commits upstream
On Mon, Jul 18, 2016 at 1:49 AM, Alexander Couzenswrote: > Hi, > > I would like to push patches from somebody else upstream. > I'm talking of commits of the TI's beagleboard repo [1]. > > What do I need to take care of? Well, basically apply the patch from beagleboard repo into your repo. This will keep the patch author and Signed-off-by line. Then, add your Signed-off-by line and don't forget to Cc the original author. Good luck. :) ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: looking for tutorials
On Mon, Jun 13, 2016 at 5:43 PM, ty armourwrote: > I need tutorials on kernel development. And on complete operating system > development. I would prefer them to be in assembly because it is faster, but > it seriously needs to get done. > > If you are interested, simply post all of the tutorials and other relevant > information to coding kernels that you can > > and show the references, like actually say okay so in order to do this we > need to look for this in the assembler manual. > > Thanks and have fun You can start by reading the code for lguest: http://lxr.free-electrons.com/source/drivers/lguest It has very good documentation and it covers a lot of OS fundamental blocks. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: [PATCH] HC-SR04 ultrasonic ranger IIO driver
On Wed, Jun 1, 2016 at 12:05 AM,wrote: > From: Johannes Thoma > > The HC-SR04 is an ultrasonic distance sensor attached to two GPIO > pins. The driver based on Industrial I/O (iio) subsystem and is > controlled via configfs and sysfs. It supports an (in theory) unlimited > number of HC-SR04 devices. > > Datasheet to the device can be found at: > > http://www.micropik.com/PDF/HCSR04.pdf > Signed-off-by: Johannes Thoma Please send this to the linux-iio mailing list (linux-...@vger.kernel.org ) thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How to enable IIO driver in 3.18 kernel
On Wed, Jun 1, 2016 at 5:26 PM, Munagala Nareshwrote: > Thanks for the response. > > From the "cat /proc/devices", I could see "iio" listed like this. > > / # cat /proc/devices > cat /proc/devices > Character devices: > 1 mem > 4 /dev/vc/0 > 4 tty > 5 /dev/tty > 5 /dev/console > 5 /dev/ptmx > -- > 250 iio > 251 pps > - > > I could see few other deices @ /dev/. CONFIG_DEVTMPFS is not set in the > def config. I will try it by adding "CONFIG_DEVTMPFS=y" and > "CONFIG_DEVTMPFS_MOUNT=y". Please don't use top posting. You can look into /sys/bus/iio/devices/iio:device0/dev and get the MAJOR and MINOR, then create the device node manually, using: mknod /dev/iio:device0 c MAJOR MINOR Not sure why are you mentioning /proc/devices here. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: make oldconfig forces HWMON to be inbuilt
On Fri, May 20, 2016 at 7:35 AM, Ani Sinhawrote: > Hi guys : > > I am seeing this weird issue where even though my original kernel > configuration tries to build HWMON as a module, when I do 'make > oldconfig', it forces HWMON to be built into the kernel. Is there > anyway I can find what configuration is forcing this change? > CONFIG_HWMEM is a tristate symbol. Did you mean CONFIG_HWMON? Run make menuconfig and use / CONFIG_HWMON to find its place in config hierarchy. It should be under "Device Drivers" -> Hardware Monitoring Support. Then press "?" to find more info about CONFIG_HWMON symbol. Look for "Selected by". thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: git send-email
On Sun, May 22, 2016 at 2:29 PM, Tobin Hardingwrote: > Workflow - > > $ git format-patch -s -1 > > add patch comment then > > $ git send-email > > Question please - > > Who should the email be sent to without having a 'To' address repeated in the > CC > field generated by `git send-email`. > > To rephrase the question: git send-email CC's everyone who may be interested > according to get_maintainers.pl. Will I annoy people if I address them in the > To > field as well as the CC field. I usually add only the maintainer and the mailing list as To: and the rest in Cc. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: if block style when condition spams to multiple lines.
On Thu, May 19, 2016 at 9:07 PM, Daniel.wrote: > What is the preferred way to ident if statement when the condition > spams to multiple lines, ex: > > if (cond1 && > cond2 && > cond3) { > ... > ... > } ^ this one is preferred. > > or > > if (cond1 && > cond2 && > cond3) > { >... >... > } > > or if only one statement inside body > > if (cond1 && > cond2 && > cond3 > ... > > Also, usualy, I align the remaining lines from codition to one > column after the parenthesis that starts the condition and usually > I need spaces to do that. Is that okay? With no spaces would be: > if (cond1 && > cond2) > { > ... > > Regards, > -- > "Do or do not. There is no try" > Yoda Master > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Is there anyone on MAC kernel
On Tue, May 10, 2016 at 12:26 PM, Robert Clovewrote: > Hi, > > I am looking for some with whom i can discuss my mac kernel problems. > If you know someone please mail me . Hi, It doesn't work this way. Please describe your problem here. What is the issue and how did you try to fix it? Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: i2c driver develpment with diolan DLN-2 / ACPI?
On Sat, Apr 30, 2016 at 6:10 PM, Martin Kepplinger <mart...@posteo.de> wrote: > Am 2016-04-27 um 13:51 schrieb Daniel Baluta: >> On Wed, Apr 27, 2016 at 2:36 PM, Martin Kepplinger <mart...@posteo.de> wrote: >>> Hi roberta or anyone who uses a diolan i2c/spi bridge device, >>> >>> I try to do get the kernel driver for the connected chip loaded, but I'm >>> having some trouble getting it right. >>> >>> Cables are connected to the device (i2c), and the (mainline) kernel >>> driver for the diolan DLN-2 device is compiled and loaded on plugin. >>> >>> I don't use any of their (userspace) software. >>> >>> Now I get a new i2c bus and can manually instanciate my driver >>> >>> root@laptop:/sys/bus/i2c/devices/i2c-7# echo mma8452 0x1c > new_device >>> >>> and the driver loads. (Now for development, later maybe for merging) I >>> added acpi support, I guess I'd need it, but ACPI_HANDLE(>dev) >>> isn't true (during probe) hence we don't continue. I append my >>> adding-acpi-patch below. >>> >>> How do you do it? >>> >>> Do *you* manually instantiate your i2c-driver during development with >>> your diolan device or should it somehow even get loaded automatically? >>> >> >> Hi Martin, >> >> Please also use the following two patches: >> >> https://lkml.org/lkml/2014/12/16/290 >> https://lkml.org/lkml/2014/12/16/289 >> >> How does your setup looks like? >> > > Those patches don't apply anymore, also because of API changes. I save > them but I'll ignore the ACPI problem for now. Oh well, for development > only, I skip it and go ahead and try to write and read registers. > > Different problem: > > i2c_smbus_read_byte_data always returns with "Protocol Error". > > DLN-2 jumpers are correct. Is there anything special to consider, using > the DLN-2, regardless of which chip you are talking to? > Please check the wiring. Also make sure you run at the correct voltage for your specific chip. One other thing, is the firmware version. http://dlnware.com/Downloads AFAIK Diolan by default comes in U2C compatiblity mode which will not work with DLN2 drivers. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: i2c driver develpment with diolan DLN-2 / ACPI?
On Wed, Apr 27, 2016 at 2:36 PM, Martin Kepplingerwrote: > Hi roberta or anyone who uses a diolan i2c/spi bridge device, > > I try to do get the kernel driver for the connected chip loaded, but I'm > having some trouble getting it right. > > Cables are connected to the device (i2c), and the (mainline) kernel > driver for the diolan DLN-2 device is compiled and loaded on plugin. > > I don't use any of their (userspace) software. > > Now I get a new i2c bus and can manually instanciate my driver > > root@laptop:/sys/bus/i2c/devices/i2c-7# echo mma8452 0x1c > new_device > > and the driver loads. (Now for development, later maybe for merging) I > added acpi support, I guess I'd need it, but ACPI_HANDLE(>dev) > isn't true (during probe) hence we don't continue. I append my > adding-acpi-patch below. > > How do you do it? > > Do *you* manually instantiate your i2c-driver during development with > your diolan device or should it somehow even get loaded automatically? > Hi Martin, Please also use the following two patches: https://lkml.org/lkml/2014/12/16/290 https://lkml.org/lkml/2014/12/16/289 How does your setup looks like? > thanks so much for any help, > > martin > > > --- a/drivers/iio/accel/mma8452.c > +++ b/drivers/iio/accel/mma8452.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > > #define MMA8452_STATUS 0x00 > #define MMA8452_STATUS_DRDY (BIT(2) | BIT(1) | BIT(0)) > @@ -1434,6 +1435,19 @@ static const struct of_device_id mma8452_dt_ids[] = { > }; > MODULE_DEVICE_TABLE(of, mma8452_dt_ids); > > +static const char *mma8452_match_acpi_device(struct device *dev, int *data) > +{ > +const struct acpi_device_id *id; > + > +id = acpi_match_device(dev->driver->acpi_match_table, dev); > +if (!id) > +return NULL; > + > +*data = (int)id->driver_data; > + > +return dev_name(dev); > +} > + > static int mma8452_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > @@ -1441,21 +1455,35 @@ static int mma8452_probe(struct i2c_client *client, > struct iio_dev *indio_dev; > int ret; > const struct of_device_id *match; > + const char *name = NULL; > + int dev_id = 0; > > - match = of_match_device(mma8452_dt_ids, >dev); > - if (!match) { > - dev_err(>dev, "unknown device model\n"); > - return -ENODEV; > - } > +pr_info("mma probe running!!\n"); > > indio_dev = devm_iio_device_alloc(>dev, sizeof(*data)); > if (!indio_dev) > return -ENOMEM; > > data = iio_priv(indio_dev); > + i2c_set_clientdata(client, indio_dev); > data->client = client; > + > + match = of_match_device(mma8452_dt_ids, >dev); > + if (match) { > + if (id) > + name = id->name; > + data->chip_info = match->data; > + } else if (ACPI_HANDLE(>dev)) { > + name = mma8452_match_acpi_device(>dev, _id); > + pr_info("mma acpi ok. found id %d\n", dev_id); > + /* TODO chip_info setting*/ > + data->chip_info = _chip_info_table[dev_id]; > + } else { > + dev_err(>dev, "unknown device model\n"); > + return -ENODEV; > + } > + > mutex_init(>lock); > - data->chip_info = match->data; > > ret = i2c_smbus_read_byte_data(client, MMA8452_WHO_AM_I); > if (ret < 0) > @@ -1475,11 +1503,10 @@ static int mma8452_probe(struct i2c_client *client, > } > > dev_info(>dev, "registering %s accelerometer; ID 0x%x\n", > -match->compatible, data->chip_info->chip_id); > +name, data->chip_info->chip_id); > > - i2c_set_clientdata(client, indio_dev); > indio_dev->info = _info; > - indio_dev->name = id->name; > + indio_dev->name = name; > indio_dev->dev.parent = >dev; > indio_dev->modes = INDIO_DIRECT_MODE; > indio_dev->channels = data->chip_info->channels; > @@ -1669,6 +1696,17 @@ static const struct dev_pm_ops mma8452_pm_ops = { >mma8452_runtime_resume, NULL) > }; > > +static const struct acpi_device_id mma8452_acpi_match[] = { > + { "MMA8451", mma8451 }, > + { "MMA8452", mma8452 }, > + { "MMA8453", mma8453 }, > + { "MMA8652", mma8652 }, > + { "MMA8653", mma8653 }, > + { "FXLS8471", fxls8471 }, > + { }, > +}; > +MODULE_DEVICE_TABLE(acpi, mma8452_acpi_match); > + > static const struct i2c_device_id mma8452_id[] = { > { "mma8451", mma8451 }, > { "mma8452", mma8452 }, > @@ -1684,6 +1722,7 @@ static struct i2c_driver mma8452_driver = { > .driver = { > .name = "mma8452", > .of_match_table = of_match_ptr(mma8452_dt_ids), > +
Re: How to correctly decode fun+X/Y
On Thu, Dec 3, 2015 at 8:14 PM, Matwey V. Kornilovwrote: > Hello, > > I have the following stack trace: > > [ 1351.381696] a.out S c0afb050 0 1676 1658 0x > [ 1351.387048] [] (__schedule) from [] > (schedule+0x58/0xcc) > [ 1351.392436] [] (schedule) from [] > (tty_port_block_til_ready+0x1a8/0x35c) > [ 1351.396937] [] (tty_port_block_til_ready) from [] > (uart_open+0x118/0x158) > [ 1351.402560] [] (uart_open) from [] > (tty_open+0x11c/0x600) > [ 1351.407043] [] (tty_open) from [] > (chrdev_open+0xb4/0x188) > [ 1351.412556] [] (chrdev_open) from [] > (do_dentry_open+0x230/0x330) > [ 1351.417038] [] (do_dentry_open) from [] > (vfs_open+0x64/0x6c) > [ 1351.422470] [] (vfs_open) from [] > (do_last+0x510/0xd94) > [ 1351.426909] [] (do_last) from [] > (path_openat+0x8c/0x270) > [ 1351.432398] [] (path_openat) from [] > (do_filp_open+0x70/0xd4) > [ 1351.436815] [] (do_filp_open) from [] > (do_sys_open+0x120/0x1e4) > [ 1351.442117] [] (do_sys_open) from [] > (SyS_open+0x28/0x30) > [ 1351.447046] [] (SyS_open) from [] > (ret_fast_syscall+0x0/0x34) > > > Could please explain, how to correctly decode > tty_port_block_til_ready+0x1a8/0x35c to the instruction or line of code > using gdb? $ gdb ./vmlinux list *(tty_port_block_til_ready+0x1a8) HTH, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: i want to use the script in kernel script folder.
On Tue, Nov 17, 2015 at 7:10 AM, 윤영석wrote: > > hi, > i want to use a script in kernel, but i can't use this. > in my terminal. > yoon@pc:~/project/aosp/kernel/linux/scripts$ ./checkpatch.pl sortextable.c > Must be run from the top-level dir. of a kernel tree Hi, You can try ./checkpatch.pl -f --no-tree thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Regirect /var/log/log/syslog messages to our own txt file
On Sat, Sep 19, 2015 at 9:29 PM, Gunjan Mehtawrote: > Hi, > > I am working on a project, where i print my log messages in > /var/log/log/syslog like > > project_my:info::project started > project_my:debug::value of a is 1 > > i want to redirect project_my:info messages in info.txt file and > project_my:debug in debug.txt file. Hi Gunjan, If I'm not wrong this depends on your syslog daemon. For example using rsyslog, you have an /etc/rsyslog.conf file useful for configuring rsyslog. If you are talking about kernel messages than adding: kern.debug -/your/debug/file.txt kern.info -/your/info/file.txt HTH, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: kernel.c//Starting for The Journey of The Kernel;
On Thu, Sep 17, 2015 at 7:56 AM, GanesH AvacharEwrote: > if I have to start with the basics of the OS then what sequence should I > follow? You can start with Operating Systems Concepts book. http://www.amazon.com/Operating-System-Concepts-Abraham-Silberschatz/dp/0470128720 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: samples driver is not compiling and building at present dir .ko file
On Fri, Aug 21, 2015 at 10:25 AM, ravi ranjan Mishra raviranjanmishr...@gmail.com wrote: Hi, Just for learning purpose , i need to compile the sample directory in mainline kernel . can anybody tell to how build samples directory through make. Use: $ make menuconfig, to select CONFIG_SAMPLES=y, then in the root of your kernel sources run: $ make samples/ thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Is there any tool can format source code according to kernel coding rule?
On Mon, Aug 3, 2015 at 6:35 AM, Nan Xiao xiaonan830...@gmail.com wrote: Hi all, I am just wondering whether there is a script/tool which format source code according to kernel coding rule automatically? Such as tab, space, brace, etc. Try scripts/Lindent from the kernel source tree. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How can I locate a struct's defination?
On Sun, Aug 2, 2015 at 8:01 AM, Navy Cheng nav...@126.com wrote: Hi, I use emacs and tags to read kernel source. The tags is create by make tags in the kernel source tree. When I want to find a struct's defination, something goes wrong. For example: when I find *dentry* , the first result is: struct rchan_buf { ... struct dentry *dentry; /* channel file dentry */ ... } There are so many items like this before I find struct dentry { } Usually the definition has the curly brace on the same line, like this: struct dentry {. Just search for {, it work in vim. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Unit in which generic_buffer.c application gives data for sensors.
On Thu, Jul 2, 2015 at 10:46 AM, s.rawat imsaurabhra...@gmail.com wrote: Hi, What are the unit in which the generic_buffer.c application gives the accelerometer , Gyro and Magnetometer values. Thanks in advance ! Hi, Look for process_scan function in generic_buffer.c. It says: process_scan() - print out the values in SI units. Then, look inside IIO ABI file [1] for units associated with _raw attributes. There you'll find: * accel - m/s^2 * gyro - rad/s * magneto - Gauss thanks, Daniel. [1] http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-bus-iio ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Unit in which generic_buffer.c application gives data for sensors.
On Thu, Jul 2, 2015 at 2:53 PM, s.rawat imsaurabhra...@gmail.com wrote: On Thu, Jul 2, 2015 at 4:13 PM, Daniel Baluta daniel.bal...@gmail.com wrote: * accel - m/s^2 * gyro - rad/s * magneto - Gaus I get the data as below : in_accel_x 71000 71000.0 in_accel_y -45000 -45000.0 in_accel_z -1003000 -1003000.0 This seems correct except I think the data from the device is definitely not in m/s2 , seems like it is in μg.What would be correct - telling the device firmware writer to change the fw to send data in m/s2 or I convert this data to m/s^2 at host end? What driver is this? generic_buffer application reads the data from device buffer than applies the offset and the scale. Perhaps, your driver doesn't correctly expose the scale? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: About guiding hello world module submission
On Wed, Jun 24, 2015 at 7:49 AM, Mayur Patil linuxcra...@gmail.com wrote: Hi All, I am conducting one workshop at FUDCon in which I am trying to teach how to write and send your first linux kernel device driver. Could please suggest me the place where I can guide the students to send the device driver? Not sure what do you want to achieve with this. To show students how to contribute to the Linux kernel you can find small coding style issues in the drivers/staging/ directory and send them to Greg KH. We are doing this every year and its a lot of fun. You can start with this video: https://www.youtube.com/watch?v=LLBrBBImJt4 thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Suggested environments for kernel development
On Sun, May 3, 2015 at 8:11 PM, Lewis Clark le...@lewmpk.uk wrote: I would really like to know how you guys do your kernel development. What distro do you use and whats the process? I’m very comfortable with debian, but i’ve heard it’s not the easiest distro to build kernels for as you need to build to a .deb and apply it that way. You can use whatever distro you like. Anyhow, for rapidly booting kernels I use qemu :). Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Writing driver for a net device which does not support interrupt
On Tue, Mar 24, 2015 at 3:34 AM, Freeman Zhang freeman.zhang1...@gmail.com wrote: Hi phil, Thanks for your reply! I googled timer, it might be a solution except that interval granularity is a little bit large. This device is for high performance network. I'm not sure whether the missmatch will cause problem. Google for high resolution timers. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Sysfs requirement for running generic_buffer.c application - IIO sensors
On Mon, Mar 23, 2015 at 7:27 AM, s.rawat imsaurabhra...@gmail.com wrote: I have two system having different kernel version and drivers(IIO) on which i can run the generic_buffer.c application .On one system it works fine but on the other it does not give the input reports data. What kernel versions are you using? Why are you using different drivers? :D thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Delaying an interrupt handler
On Mon, Mar 23, 2015 at 2:18 PM, Milton Krutt mil...@krutt.org wrote: Hi. It is known that no semaphore synchronization should be used inside an interrupt handler. Anyway, I am looking at a freeBSD device driver (written by a profesionist) and there are semaphores inside an interrupt handler's subroutine. Since I should port to linux that driver, I ask you how can I reach such synchronization under linux; I tried to use semaphores inside my handler but I got complains, and I don't want to break the law, so no semaphores for me. Perhaps spinlocks could be the solution :). 2.6.10 please no - :), Linux kernel is now at 4.0. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: CHECK: Alignment should match open parenthesis
On Fri, Mar 13, 2015 at 3:47 PM, Nicholas Mc Guire der.h...@hofr.at wrote: On Fri, 13 Mar 2015, Nicholas Mc Guire wrote: On Fri, 13 Mar 2015, palik imre wrote: On Friday, 13 March 2015, 13:43, Nicholas Mc Guire der.h...@hofr.at wrote: On Fri, 13 Mar 2015, palik imre wrote: Sorry for the silly question, but I have some issues with this checkpatch.pl warning. I mean Documentation/CodingStyle says: Outside of comments, documentation and except in Kconfig, spaces are never used for indentation, and the above example is deliberately broken. But checkpatch.pl claims I should align to open parentheses. These two things seem to be contradictory to me. Could somebody clarify this? leading tabs *followed* by spaces to align parameters to a function are fine The emacs settings in Documentation/CodingStyle seem to contradict to you, as it is set up to use c-lineup-arglist-tabs-only The problem is that CodingStyle does not explicitly address parameter alignment for functions that do not fit on a single line but checkpatch.pl does you can try it out - if you align to the opening braces with spaces with preceding TABs it will not fuss and this is also common practice. here is a quick shot at summarizing this If the parameter list to a functions would exceed the 80 char limit then break it at the separators, and align to opening braces, e.g.: ret = fw_load_from_user_helper(fw, name, device, opt_flags, timeout); or: int = wait_for_completion_interruptible_timeout(data-completion, PMI_TIMEOUT); Note that this is indented by tabs and then aligned with spaced to fit the opening braces. If you can not fit it even if you break the parameter list at the commas then indent by tabs only but *significantly* to the left of the opening braces, e.g.: int ret = wait_for_completion_interruptible_timeout( info-done, usecs_to_jiffies(TIMEOUT_US)); would be suprised if there is no writeup somewhere alredy but I did not find this covered in Documentations anywhere. I think it would be a coding idea to have this in CodingStyle doc :). Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: CHECK: Alignment should match open parenthesis
On Fri, Mar 13, 2015 at 5:33 PM, Nicholas Mc Guire der.h...@hofr.at wrote: On Fri, 13 Mar 2015, Daniel Baluta wrote: On Fri, Mar 13, 2015 at 3:47 PM, Nicholas Mc Guire der.h...@hofr.at wrote: On Fri, 13 Mar 2015, Nicholas Mc Guire wrote: On Fri, 13 Mar 2015, palik imre wrote: On Friday, 13 March 2015, 13:43, Nicholas Mc Guire der.h...@hofr.at wrote: On Fri, 13 Mar 2015, palik imre wrote: Sorry for the silly question, but I have some issues with this checkpatch.pl warning. I mean Documentation/CodingStyle says: Outside of comments, documentation and except in Kconfig, spaces are never used for indentation, and the above example is deliberately broken. But checkpatch.pl claims I should align to open parentheses. These two things seem to be contradictory to me. Could somebody clarify this? leading tabs *followed* by spaces to align parameters to a function are fine The emacs settings in Documentation/CodingStyle seem to contradict to you, as it is set up to use c-lineup-arglist-tabs-only The problem is that CodingStyle does not explicitly address parameter alignment for functions that do not fit on a single line but checkpatch.pl does you can try it out - if you align to the opening braces with spaces with preceding TABs it will not fuss and this is also common practice. here is a quick shot at summarizing this If the parameter list to a functions would exceed the 80 char limit then break it at the separators, and align to opening braces, e.g.: ret = fw_load_from_user_helper(fw, name, device, opt_flags, timeout); or: int = wait_for_completion_interruptible_timeout(data-completion, PMI_TIMEOUT); Note that this is indented by tabs and then aligned with spaced to fit the opening braces. If you can not fit it even if you break the parameter list at the commas then indent by tabs only but *significantly* to the left of the opening braces, e.g.: int ret = wait_for_completion_interruptible_timeout( info-done, usecs_to_jiffies(TIMEOUT_US)); would be suprised if there is no writeup somewhere alredy but I did not find this covered in Documentations anywhere. I think it would be a coding idea to have this in CodingStyle doc :). At this level of detail it would be almost unmaintainable and also you would end up with far too many rules to actually keep them in mind. That is the job of tools like checkpatch.pl they can have all the myriads of corner cases encoded without creating a burden to the developers/maintainers. I see. Thanks! ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting error failed to setup attributes on Adding Custom Fields in accelerometer HID driver
+ linux-iio list. On Thu, Feb 26, 2015 at 8:04 AM, s.rawat imsaurabhra...@gmail.com wrote: I have modified the hid-sensor-accel_3d.c driver to add the custom fields - CHANNEL_SCAN_DATA_MOTION and HID_USAGE_SENSOR_DATA_CUSTOM_VALUEX ( X = 2,3,4). Below are my modifications : enum accel_3d_channel { CHANNEL_SCAN_INDEX_X, CHANNEL_SCAN_INDEX_Y, CHANNEL_SCAN_INDEX_Z, CHANNEL_SCAN_DATA_MOTION, CHANNEL_CUSTOM_VALUE_2, CHANNEL_CUSTOM_VALUE_3, CHANNEL_CUSTOM_VALUE_4, ACCEL_3D_CHANNEL_MAX, static const u32 accel_3d_addresses[ACCEL_3D_CHANNEL_MAX] = { HID_USAGE_SENSOR_ACCEL_X_AXIS, HID_USAGE_SENSOR_ACCEL_Y_AXIS, HID_USAGE_SENSOR_ACCEL_Z_AXIS, HID_USAGE_SENSOR_DATA_MOTION_STATE, HID_USAGE_SENSOR_DATA_CUSTOM_VALUE2, HID_USAGE_SENSOR_DATA_CUSTOM_VALUE3, HID_USAGE_SENSOR_DATA_CUSTOM_VALUE4 }; /* Channel definitions */ static const struct iio_chan_spec accel_3d_channels[] = { { .. .. .. { .type = IIO_ACCEL, .modified = 1, .channel2 = IIO_MOD_X, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_SCAN_DATA_MOTION, }, { .type = IIO_ACCEL, .modified = 1, .channel2 = IIO_MOD_X, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_CUSTOM_VALUE_2, }, { .type = IIO_ACCEL, .modified = 1, .channel2 = IIO_MOD_X, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_CUSTOM_VALUE_3, }, { .type = IIO_ACCEL, .modified = 1, .channel2 = IIO_MOD_X, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_CUSTOM_VALUE_4, } /* Capture samples in local storage */ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev, unsigned usage_id, size_t raw_len, char *raw_data, void *priv) { struct iio_dev *indio_dev = platform_get_drvdata(priv); struct accel_3d_state *accel_state = iio_priv(indio_dev); int offset; int ret = -EINVAL; switch (usage_id) { case HID_USAGE_SENSOR_ACCEL_X_AXIS: case HID_USAGE_SENSOR_ACCEL_Y_AXIS: case HID_USAGE_SENSOR_ACCEL_Z_AXIS: case HID_USAGE_SENSOR_DATA_MOTION_STATE: case HID_USAGE_SENSOR_DATA_CUSTOM_VALUE2: case HID_USAGE_SENSOR_DATA_CUSTOM_VALUE3: case HID_USAGE_SENSOR_DATA_CUSTOM_VALUE4: offset = usage_id - HID_USAGE_SENSOR_ACCEL_X_AXIS; /* Parse report which is specific to an usage id*/ static int accel_3d_parse_report(struct platform_device *pdev, struct hid_sensor_hub_device *hsdev, struct iio_chan_spec *channels, unsigned usage_id, struct accel_3d_state *st) { int ret; int i; for (i = 0; i = CHANNEL_CUSTOM_VALUE_4; ++i) { //previously CHANNEL_SCAN_INDEX_Z ret = sensor_hub_input_get_attribute_info(hsdev, After build /insmod i get the following dmesg : hid_sensor_accel_3d:HID-SENSOR-200073.3 auto : failed to setup attributes hid_sensor_accel_3d:HID-SENSOR-200073.3 auto.failed with error -1 I am not getting what else I have to modify to avoid this error .If i remove the portion in bold(and use this original code :http://lxr.free-electrons.com/source/drivers/iio/accel/hid-sensor-accel-3d.c) I can happily insert the module without any error and can interact with the driver using my application. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: from WHERE platform driver's probe is called?
On Fri, Nov 21, 2014 at 3:16 PM, Sunil Shahu sunil.roc...@yahoo.in wrote: Hello, I am looking into platform driver and devices and understood HOW platform driver's probe is called from kernel doc and following forum. http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050 For further information I went through code in platform_driver_register() and got lost. I looked web but could not find substantiation information. I am still not able to locate from WHERE this probe function is called and WHO calls it? Can someone please point to source code or some other document related to this? Does dump_stack() help? Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: fd type from number
On Tue, Aug 19, 2014 at 6:38 PM, Loris Degioanni lo...@draios.com wrote: (resending making sure this is not part of another thread) I'm looking for an efficient way to determine the type of an fd (file, socket...) given its number, from a kernel module. The closest thing I found by looking at the kernel sources is sockfd_lookup(), which works but is limited to telling me if the fd is a socket or not. Is there something else I can look at? https://www.kernel.org/doc/Documentation/filesystems/files.txt See point 4. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: A new way to dive into the kernel!
It's there any solution to this issue? I'm using mutt, It's ok. Hi, Evolution works for me. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How can I 'getchar()' in module code?
On Tue, Dec 3, 2013 at 4:20 PM, Bernd Petrovitsch be...@petrovitsch.priv.at wrote: On Die, 2013-12-03 at 08:38 -0500, valdis.kletni...@vt.edu wrote: On Tue, 03 Dec 2013 20:35:41 +0800, said: For debugging purpose, I want something like 'getchar()' that can pause execution in the module code. Do any candidates I can choose? I think there is a way to stop execution :). Run your image under qemu, and use gdb to set breakpoints. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How can I 'getchar()' in module code?
On Tue, Dec 3, 2013 at 2:35 PM, 乃宏周 naive...@gmail.com wrote: For debugging purpose, I want something like 'getchar()' that can pause execution in the module code. Do any candidates I can choose? No. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Can mm_struct of a process be null?
On Fri, Nov 15, 2013 at 6:24 PM, Paul Davies C pauldavi...@gmail.com wrote: Hi, I happen to find this code snippet in the kernel source : struct mm_struct *mm=current-mm; /* some other code */ if(mm){ /*==Why is this here? */ /*read the contents by locking*/ } The if checks whether the mm_struct of the current process is NULL or not. That means the mm_struct of a process can become NULL. How can that happen? mm_struct points to a process address space. It is NULL for kernel threads. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Initial git repository - kernel tree
On Mon, May 13, 2013 at 10:51 AM, Kevin Wilson wkev...@gmail.com wrote: Hello, I have a question about git patches. When I run git log include/linux/skbuff.h and page down till the end, I reach 1da177e Linux-2.6.12-rc2 (I do it on the net-next tree.) git show 1da177e gives: Author: Linus Torvalds torva...@ppc970.osdl.org Date: Sat Apr 16 15:20:36 2005 -0700 Linux-2.6.12-rc2 Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate historical git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip! So this is the initial patch from 2005. Now, does it mean that prior to this patch all patches were not handled by git ? or was there some merging from an old tree to a new tree where history of git patches was removed in the new tree ? Hi Kevin, Please check this https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/ thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: misc device question
On Wed, Dec 19, 2012 at 10:36 AM, Kevin Wilson wkev...@gmail.com wrote: Hello,kernelnewbies I am trying to develop a misc driver in 3.7.0 kernel. As a basis I copy and paste this code, *without any change*, http://virtlog.com/2008/03/25/linux-miscdevice-sample/ And build it. after insmod I have : [root@n miscDevice]\ls -al /dev/mymisc crw--- 1 root root 10, 59 Dec 19 10:24 /dev/mymisc However, when trying to open this file I get: open: No such file or directory Any ideas why ? You should implement open. Check this out [1] The program with which I try to open the device is simple, a few lines following here: int main() { int fd; fd = open(/dev/mymodule, O_RDONLY); Isn't this supposed to be called /dev/mymisc ? if (fd == -1) { perror(open); exit(1); } printf(open succeeded\n); } thanks, Daniel. [1] http://lxr.linux.no/#linux+v3.7.1/drivers/char/efirtc.c#L282 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux Kernel Development
On Sun, Sep 9, 2012 at 12:16 PM, Kaushal Shriyan kaushalshri...@gmail.com wrote: On Sun, Sep 9, 2012 at 9:02 AM, Alexandru Juncu alex.ju...@rosedu.org wrote: On 9 September 2012 06:15, Kaushal Shriyan kaushalshri...@gmail.com wrote: Hi, I am interested to contribute to linux kernel development process. I have been working on Linux for the last ten years and have been a great fan of Linux OS since beginning. Any good references to start learning C and understand the linux kernel source code. Regards, Kaushal Hello! You could start by looking through the site of this community [0]. They have some pointers. You should take a look at this video [1] first. It's a brief intro on how the Linux Kernel community works. But first, you should be familiar with C programming (it's good if you did some system programming in C). If you have the basic C experience and if you want to go onto kernel programming (not that hard) you should try reading some books (I would recommend these [2] [3]). After that, use the source! And if you get stuck, ask around (here, for example). Good luck and happy hacking! [0] http://kernelnewbies.org/KernelHacking [1] http://www.youtube.com/watch?v=LLBrBBImJt4 [2] http://www.amazon.com/Linux-Kernel-Development-3rd-Edition/dp/0672329468 [3] http://www.amazon.com/Understanding-Linux-Kernel-Third-Edition/dp/0596005652/ref=pd_bxgy_b_text_z -- Alexandru Juncu ROSEdu http://rosedu.org Hi, I am totally new to C Programming Language. How do i start learning C and which books or tutorials i need to refer. I would recommend 'The C programming language' by K R :)[1]. thanks, Daniel [1] http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/0131103628 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Profiling my Modules
On Thu, Apr 26, 2012 at 10:33 AM, Rishi Agrawal rishi.b.agra...@gmail.com wrote: Hi All, I have a kernel module which has functions which take a lot of time in execution. I am curious to know how can I profile it, and find out the functions taking most of the time. I saw Oprofile, but it seems that I will have to build the whole kernel, and also that it will be difficult to profile my module through it. Any trick or tool will do. Hello, Have a look at perf [1]. thanks, Daniel. [1] https://perf.wiki.kernel.org/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: slacks usage,..
On Mon, Mar 5, 2012 at 11:00 AM, trisha yad trisha1ma...@gmail.com wrote: Hi All, I am going through below topic http://patches.linaro.org/6833/. I could not got the meaning of slacks. Why I need this .. Is there some real example of need of slacks. Have you tried searching for it? :D [1]. thanks, Daniel. [1] https://lwn.net/Articles/369549/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Check if specific functionally is built into the kernel
On Sun, Feb 26, 2012 at 7:08 PM, Arokux B. aro...@gmail.com wrote: Dear all, I have the following problem. Some functionality can be either built into the kernel or it can be build as a module. In the latter case the application should load the module. Is there a general approach to test if specific functionality is built statically or as a module? If available, you can check .config file. (e.g check if CONFIG_X_OPTION=Y or CONFIG_X_OPTION=m). thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: cross compile linux
On Sat, Feb 11, 2012 at 9:05 AM, chromaticwt zac zac.3.14...@gmail.com wrote: what is the proper way to cross compile the linux kernel from one arch to another? specifically, i386 - ppc. You should use a cross-compiler. I recommend you crosstool-ng. Use google for references. [1] thanks, Daniel. [1] http://forum.samdroid.net/wiki/showwiki/How+to+build+cross+toolchains+for+ARM+crosstool-NG ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How to create patch for checkpatch.pl cleanups
On Sun, Feb 5, 2012 at 11:00 PM, kashyap gada kashyapg...@yahoo.com wrote: Hello Linux Newbies, I'm one too. I was looking out for some clean up work and I ran the checkpatch.pl script. I came across a file with some 400 errors and 200 warnings. Now there were bunch of 80 char per line warning , braces and related things. I don't want to be sending patches for each and every error or warning I fix as it becomes tedious and If i send lots of correction patches in one go the kernel maintainers wont accept it. I want to know Can we correct all similar errors or warnings in one patch? or series of patches? Regarding 80 chars per line issues, people are discussing right now on increasing the limit to 100. See [1]. For the other issues, just send a patch with all the changes. It should be fine since you are modifying one single file. thanks, Daniel. [1] https://lkml.org/lkml/2012/2/5/141 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How to use /proc
On Sun, Feb 5, 2012 at 11:07 PM, Surenkumar Nihalani su...@gatech.edu wrote: Hello Guys, I am CS student trying to write a kernel module as a part of my class assignment. I wanted to know, from within kernel, how do I read and write data to my proc file? I need to store state from last call of my function. Hello, Have you tried searching on the internet? :D [1]. Another approach is to see how an existing proc entry is handled. Look for example at /proc/sched_debug [2]. thanks, Daniel. [1] http://www.ibm.com/developerworks/linux/library/l-proc/index.html [2] http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: using sizeof operator
On Sun, Jan 22, 2012 at 10:17 PM, Sukrit Sangwan sukritsang...@gmail.com wrote: I found an instance where sizeof(struct xyz) is used instead of sizeof(variablename). I want to ask if it would be appropriate to contact the author about the same. Well, this doesn't really matter, but the recommended practice is to use sizeof(*pointer); Please keep intact Cc's list. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: [OOT] About the symbols in binary file.
On Fri, Jan 20, 2012 at 11:56 AM, nilesh nilesh.tay...@netscout.com wrote: Hi, The question is not completely related to kernel. But I came across similar question when debugging in kernel. I tried dissecting the SSL library using 'nm' command. It is showing the list of symbols along with some generic addresses (to be used when relocating). Also there are some characters 't', 'T', 'U'. I guess these correspond to properties of symbols - like static, extern etc. Could someone please point out what exactly each character corresponds to? I mean looking at the character, we should be able to denote if it's a static symbol or inline etc. Do we have any such mapping? man nm :) thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: multiple definition error from dl-addr.c with addition of printf, in glibc compilation
On Thu, Dec 8, 2011 at 10:59 AM, solmac john johnsol...@gmail.com wrote: Hi All, in glibc-2.13/nptl/sigaction.c, i just put a simple printf(test\n); and my glibc compilation fails. Just adding a printf gives me multiple definitions of _itoa from dl-addr.c and i have no idea why. Can any body please tell me why is this happening and possible solution. For better clarity here is the Are there any variable declarations after printf? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How to hook the system call?
On Wed, Nov 23, 2011 at 11:22 AM, Alexandru Juncu alex.ju...@rosedu.org wrote: On Wed, Nov 23, 2011 at 10:40 AM, Geraint Yang geraint0...@gmail.com wrote: Hello everyone, I am going to hook a system call like 'read' or 'send' by modifying the sys_call_table, but it seems that the sys_call_table is in read only page, how can I set modify the sys_call_table ? Or if there any method that I can use to hook a system call in module without modify the kernel source? Thanks! On a 2.6.35 kernel, it worked for me just by changing an entry in the sys_call_table, within a kernel module. Something like this: Alex, I am pretty sure that you are using a hacked version of 2.6.35. Geraint, In order to be able to hook a syscall you must do the following: 1. export syscall_table in arch/x86/kernel/i386_ksyms_32.c extern void* sys_call_table[]; EXPORT_SYMBOL(sys_call_table); 2. make sys_call_table writebale. In arch/x86/kernel/entry_32.S you must have: .section .data,a #include syscall_table_32.S thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: x86 kernel build chain - how bzImage gets created
On Tue, Nov 22, 2011 at 12:46 PM, Graeme Russ graeme.r...@gmail.com wrote: Hi All, Hopefully this will help demystify the build process Notation: primary input file (file size in bytes) | + additional input file | * command | \- output file (file size in bytes) The file sizes are arbitrary and are based on the current configuration options I have set for a small kernel. They are simply there to illustrate the relative differences in file sizes. Great! Thanks for sharing this. Note that vmlinux.o is not used to generate bzImage but I've included it for completeness [...] + net/built-in.o | * ld -m elf_i386 -r -o vmlinux.o | \-vmlinux.o (2,889,050) What is the purpose of vmlinux.o then? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Trouble removing character device
On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyer k...@gnukai.com wrote: I can't seem to get my character device to remove itself from the /proc/devices list. I'm calling all of the following functions like so: alloc_chrdev_region(dev, 0, 5, my_char); cdev_init(my_cdev, my_ops); cdev_add(my_cdev, MKDEV(my_major, my_minor), 1); cdev_del(my_cdev); unregister_chrdev_region(my_major, 5); It seems like I'm missing something, but I can't find it. I'm referencing the Linux Device Drivers v3, chapter 3. In the example code, the scull_cleanup_module function calls cdev_dell and unregister_chrdev_region, just like I do. To be clear, after I unload my module (after calling cdev_del and unregister_chrdev_region), my my_char string still shows up in /proc/devices. Did you check return codes for all functions? Also, can you post a link to the code? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting 'bad file number' error writing to device driver
On Mon, Oct 17, 2011 at 6:49 PM, Philip Anil-QBW348 anil.phi...@motorolasolutions.com wrote: -Original Message- From: Daniel Baluta [mailto:daniel.bal...@gmail.com] Sent: Saturday, October 15, 2011 3:34 AM To: Philip Anil-QBW348 Cc: kernelnewbies@kernelnewbies.org Subject: Re: Getting 'bad file number' error writing to device driver On Sat, Oct 15, 2011 at 2:42 AM, Philip Anil-QBW348 anil.phi...@motorolasolutions.com wrote: I am calling the driver from an Android program (OMAP4/Blaze). It calls a c++ program via JNI which then calls the device driver. Someone suggested it might be a permissions problem - the program is running in user mode. on Blaze board, /system/bin # ls -l -rwxrwxrwx system system 7636 2011-09-30 03:53 mydriver Will strace still be useful? In general, in Linux, how does one enable a user program to call a custom device driver? Please don't top post! :) strace will be useful to check the parameters for open, write system calls. EBADF fd is not a valid file descriptor or is not open for writing. Ok, so either open fails, or you don't have the permission to write into /dev/mydriver file. -- I apologize for 'top-posting' (I did not know that was undesirable - most email clients and also Google newsgroups put one's reply at the top.). Yes, the /dev/mydriver had permissions 600. I did a chmod to 666 and it worked. I am performing security testing and want to see if a program running in user mode can elevate its privileges to call the device driver which has permissions 600. Any ideas how it can? Anil Maybe setuid bit can help you ([1]). When this bit is set, a certain program can run with the privileges of its owner. thanks, Daniel. [1] http://en.wikipedia.org/wiki/Setuid ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting 'bad file number' error writing to device driver
On Sat, Oct 15, 2011 at 2:42 AM, Philip Anil-QBW348 anil.phi...@motorolasolutions.com wrote: I am calling the driver from an Android program (OMAP4/Blaze). It calls a c++ program via JNI which then calls the device driver. Someone suggested it might be a permissions problem - the program is running in user mode. on Blaze board, /system/bin # ls -l -rwxrwxrwx system system 7636 2011-09-30 03:53 mydriver Will strace still be useful? In general, in Linux, how does one enable a user program to call a custom device driver? Please don't top post! :) strace will be useful to check the parameters for open, write system calls. EBADF fd is not a valid file descriptor or is not open for writing. Ok, so either open fails, or you don't have the permission to write into /dev/mydriver file. Another thing that I can think of, is that your driver's write function is wrong, and returns -EBADF in some case ? Can you give us a pointer to your driver? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Why can the kernel be stuck by a busy kernel thread ?
On Fri, Oct 14, 2011 at 5:04 PM, Parmenides mobile.parmeni...@gmail.com wrote: Hi, I code a kernel module which do some nop. When inserted into the kernel, the kernel will be stuck and can not reponse my keypress anymore. So, I have to reboot to get out. Why? Is kernel preemption activated? Could you check for # grep CONFIG_PREEMPT .config? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting 'bad file number' error writing to device driver
Hello, I am trying to write to mydriver but get a 'Bad file number' error. int fd = open(/dev/mydriver,O_RDWR); this opens successfully as fd is not -1. ssize_t bytesToWrite = strlen(buf); value is: bytesToWrite 28 ssize_t bytesWritten = write(fd,buf,bytesToWrite); value is: bytesWritten -1 __android_log_print(ANDROID_LOG_INFO,__FILE__,ANIL strerror(errno) %s, strerror(errno)); value is: strerror(errno) Bad file number Please use strace and let us know the full trace of system calls. Also, if possible could you paste the 'write' function of your driver? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
TCP_DELACK_MIN vs TCP_ATO_MIN
Hello, RFC2582, Section 4.2 says: ... an ACK SHOULD be generated for at least every second full-sized segment, and MUST be generated within 500 ms of the arrival of the first unacknowledged packet. . I guess that the delayed ACK timeout is computed in tcp_send_delayed_ack: === void tcp_send_delayed_ack(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); int ato = icsk-icsk_ack.ato; unsigned long timeout; /* */ /* Stay within the limit we were given */ timeout = jiffies + ato; Can one explain what is the difference between TCP_DELACK_MIN and TCP_ATO_MIN, specifically if the timeout (ato) is always in the interval [TCP_DELACK_MIN, TCP_DELACK_MAX] ? I want to make the delayed ack timeout configurable as some guys tried here [1], so for this reason I plan to make TCP_DELACK_MIN and TCP_DELACK_MAX tunable via proc entries. thanks, Daniel. [1] http://kerneltrap.org/mailarchive/linux-netdev/2008/9/9/3245554 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: TCP_DELACK_MIN vs TCP_ATO_MIN
Now the default value is of both the macros is same. But if you want to make delayed ack timeout configurable, then I think you should give proc interface for TCP_DELACK_MIN. Thanks Rohan. Then also I have to export TCP_DELACK_MAX since I think ato cannot grow over this value. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: how to use hashmap in kernel module?
On Mon, Sep 19, 2011 at 9:23 AM, Jon Zhou jon.z...@jdsu.com wrote: Hi I want to hashmap to store datat in kernel module, how can I do this? Any existed code? Hello, There are a lot of places where hashes are used. Just grep for 'hash' through the kernel sources. For example have a look at futex_queues [1]. thanks, Daniel. [1] http://lxr.linux.no/linux+v3.0.4/kernel/futex.c#L150 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
TCP - RST flag
Hello, Please help me understanding the behavior of the following TCP conversation. You can find bellow a snippet of the (FTP) conversation captured both on client (C) and server (S). [client]$ tcpdump -n -r client-6-conv.cap [P1] 49.045690 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 197:220, ack 81, win 757, length 23 [P2] 49.046600 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, length 0 [P3] 49.047462 IP 10.10.0.20.58277 10.10.0.1.21: Flags [P.], seq 81:87, ack 220, win 738, length 6 [P5] 49.048757 IP 10.10.0.1.21 10.10.0.20.58277: Flags [F.], seq 242, ack 87, win 757, length 0 [P6] 49.048794 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, options [nop,nop,sack 1 {242:243}], length 0 [P4] 49.048801 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 220:242, ack 87, win 757, length 22 [P7] 49.048833 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 243, win 715, length 0 [P8] 49.049566 IP 10.10.0.20.58277 10.10.0.1.21: Flags [F.], seq 87, ack 243, win 715, length 0 [P9] 49.050889 IP 10.10.0.1.21 10.10.0.20.58277: Flags [R], seq 1672731590, win 0, length 0 [server]$ tcpdump -n -r server-6-conv.cap [P1] 49.059740 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 197:220, ack 81, win 757, length 23 [P2] 49.061394 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, length 0 [P3] 49.061760 IP 10.10.0.20.58277 10.10.0.1.21: Flags [P.], seq 81:87, ack 220, win 738, length 6 [P4] 49.062794 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 220:242, ack 87, win 757, length 22 [P5] 49.062843 IP 10.10.0.1.21 10.10.0.20.58277: Flags [F.], seq 242, ack 87, win 757, length 0 [P6] 49.063808 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, options [nop,nop,sack 1 {242:243}], length 0 [P7] 49.063823 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 243, win 715, length 0 [P8] 49.064271 IP 10.10.0.20.58277 10.10.0.1.21: Flags [F.], seq 87, ack 243, win 715, length 0 [P9] 49.064481 IP 10.10.0.1.21 10.10.0.20.58277: Flags [R], seq 1672731590, win 0, length 0 What happens is that servers sends packets P4 and P5, but client receives P5 before P4. Since SACK is enabled, client will send a SACK (P6) ack-ing P5. Then client sees P4, and will send an ack (P7) for P4, then sends P8 with FIN flag set. What I don't understand, is why server responds with RST (P9) instead of ACK? This is was obtained on 2.6.32.43. I have also attached full capture files. I am reading TCP's RFC and kernel code, but so far I haven't reached a conclusion. thanks, Daniel. server-6-conv.cap Description: Binary data client-6-conv.cap Description: Binary data ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: TCP - RST flag
On Tue, Aug 23, 2011 at 11:55 PM, Eric Dumazet eric.duma...@gmail.com wrote: Le mardi 23 août 2011 à 23:31 +0300, Daniel Baluta a écrit : Hello, Please help me understanding the behavior of the following TCP conversation. You can find bellow a snippet of the (FTP) conversation captured both on client (C) and server (S). [client]$ tcpdump -n -r client-6-conv.cap [P1] 49.045690 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 197:220, ack 81, win 757, length 23 [P2] 49.046600 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, length 0 [P3] 49.047462 IP 10.10.0.20.58277 10.10.0.1.21: Flags [P.], seq 81:87, ack 220, win 738, length 6 [P5] 49.048757 IP 10.10.0.1.21 10.10.0.20.58277: Flags [F.], seq 242, ack 87, win 757, length 0 [P6] 49.048794 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, options [nop,nop,sack 1 {242:243}], length 0 [P4] 49.048801 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 220:242, ack 87, win 757, length 22 [P7] 49.048833 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 243, win 715, length 0 [P8] 49.049566 IP 10.10.0.20.58277 10.10.0.1.21: Flags [F.], seq 87, ack 243, win 715, length 0 [P9] 49.050889 IP 10.10.0.1.21 10.10.0.20.58277: Flags [R], seq 1672731590, win 0, length 0 [server]$ tcpdump -n -r server-6-conv.cap [P1] 49.059740 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 197:220, ack 81, win 757, length 23 [P2] 49.061394 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, length 0 [P3] 49.061760 IP 10.10.0.20.58277 10.10.0.1.21: Flags [P.], seq 81:87, ack 220, win 738, length 6 [P4] 49.062794 IP 10.10.0.1.21 10.10.0.20.58277: Flags [P.], seq 220:242, ack 87, win 757, length 22 [P5] 49.062843 IP 10.10.0.1.21 10.10.0.20.58277: Flags [F.], seq 242, ack 87, win 757, length 0 [P6] 49.063808 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 220, win 738, options [nop,nop,sack 1 {242:243}], length 0 [P7] 49.063823 IP 10.10.0.20.58277 10.10.0.1.21: Flags [.], ack 243, win 715, length 0 [P8] 49.064271 IP 10.10.0.20.58277 10.10.0.1.21: Flags [F.], seq 87, ack 243, win 715, length 0 [P9] 49.064481 IP 10.10.0.1.21 10.10.0.20.58277: Flags [R], seq 1672731590, win 0, length 0 What happens is that servers sends packets P4 and P5, but client receives P5 before P4. Since SACK is enabled, client will send a SACK (P6) ack-ing P5. Then client sees P4, and will send an ack (P7) for P4, then sends P8 with FIN flag set. What I don't understand, is why server responds with RST (P9) instead of ACK? This is was obtained on 2.6.32.43. I have also attached full capture files. I am reading TCP's RFC and kernel code, but so far I haven't reached a conclusion. TCP in RFC 1122 section 4.2.2.13: A host MAY implement a half-duplex TCP close sequence, so that an application that has called CLOSE cannot continue to read data from the connection. If such a host issues a CLOSE call while received data is still pending in TCP, or if new data is received after CLOSE is called, its TCP SHOULD send a RST to show that data was lost. So, this means that server's CLOSE operation is issued while received data is still pending? I will analyze ftp's server code, but this is strange since P4 [221 Have a nice day!\r\n] it is generated as a response for P3 [QUIT\r\n]. So P4 must have been fully received. Also, looking at the capture no data is received from the client after server calls CLOSE (P5) (there are only ACKs and FIN - P6, P7, P8). This is why some apps first call shutdown(), then drain receive queue, then close() This makes sense :). thanks Eric. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: TCP - RST flag
On Wed, Aug 24, 2011 at 12:50 AM, Eric Dumazet eric.duma...@gmail.com wrote: Le mercredi 24 août 2011 à 00:32 +0300, Daniel Baluta a écrit : On Tue, Aug 23, 2011 at 11:55 PM, Eric Dumazet eric.duma...@gmail.com wrote: TCP in RFC 1122 section 4.2.2.13: A host MAY implement a half-duplex TCP close sequence, so that an application that has called CLOSE cannot continue to read data from the connection. If such a host issues a CLOSE call while received data is still pending in TCP, or if new data is received after CLOSE is called, its TCP SHOULD send a RST to show that data was lost. So, this means that server's CLOSE operation is issued while received data is still pending? I will analyze ftp's server code, but this is strange since P4 [221 Have a nice day!\r\n] it is generated as a response for P3 [QUIT\r\n]. So P4 must have been fully received. tcpdump only shows TCP stack did receive the frame, not that it was _read_ by application. Only strace could eventually say if the input queue was really drained before the close(). Maybe server decided to close the connexion before reading the QUIT command from client. Also, looking at the capture no data is received from the client after server calls CLOSE (P5) (there are only ACKs and FIN - P6, P7, P8). That doesnt matter. If data was received (and ACKnowledged by TCP stack) _before_ close(fd), but not yet read by application, TCP must send an RST to be RFC compliant. I see. Thanks a lot for your explanations. I will further use strace to see what's going on. Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: One more question on alignment
On Sat, Aug 6, 2011 at 10:17 PM, subin gangadharan subingangadha...@gmail.com wrote: Hi, This is a text excerpt from the article [1]. Below paragraph I didn't understand quite well.Mainly in bold letters.Could anybody please explain how this will lead to an infinite loop. It seems self-explanatory. Most atomic ops are written to retry upon a failed store, and on PowerPC an atomic store to an unaligned address always fails, thus the processor will infinitely try to store the value, without having the chance to fix the unaligned access (as would have happened if an exception was thrown). Unfortunately, the PowerPC does not throw an exception when atomically storing to an unaligned address. Instead, the store simply always fails. This is bad because most atomic functions are written to retry upon a failed store, under the assumption they were preempted. These two circumstances combine to where your program will go into an infinite loop if you attempt to atomically store to an unaligned address. Oops. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: question about staging tree branches
On Tue, Jul 12, 2011 at 7:01 PM, Greg KH g...@kroah.com wrote: On Tue, Jul 12, 2011 at 12:15:17PM +0530, Prashant Shah wrote: Hi, There are 4 branches in the staging tree remotes/staging/master remotes/staging/ralink remotes/staging/staging-linus remotes/staging/staging-next Is the staging-linus is what Linus merges and staging-next is merged by linux-next tree ? No, staging-linus is what goes to Linus for this kernel release, after the -rc1 kernel is out. It is picked up in the linux-next daily releases. staging-next is what goes to Linus for the next kernel release after this one. It too is picked up in the linux-next daily releases. ralink is an old branch of mine that I need to delete that has an obsolete ralink driver in it that I was working on cleaning up. Anyone remember what the command to delete a remote branch is? I always need to look it up... According to Google ([1]) this should be: # git push remote :remote_branch thanks, Daniel. [1] http://yuji.wordpress.com/2010/06/11/git-delete-remote-branch/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: timer problem
Hello Prashant, struct timer_list tim; void timfunc(unsigned long data) { [..] schedule_timeout(10 * HZ); [..] } static int __init init_testmod(void) { init_timer(tim); tim.expires = jiffies + HZ*5; tim.data = 1000; tim.function = timfunc; add_timer(tim); return 0; } You can find here ([1]) a good source for documenting on kernel timers API. Basically, the kernel has a list with registered timers and runs the associated handlers when timeout expires. Looking at your code, you've initialized the timer but you didn't added it to kernel timers list. You can find here a simple example of how to setup a timer ([2]). Please read this [3], and figure out why even after you'll correctly setup the timer, your timer handler will cause you trouble. thanks, Daniel. [1] http://www.ibm.com/developerworks/linux/library/l-timers-list/index.html [2] http://lxr.linux.no/linux+v2.6.39/arch/blackfin/kernel/nmi.c#L176 [3] http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/c557.html ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in compiling kernel
On Wed, Jun 29, 2011 at 9:28 AM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: On Wed, Jun 29, 2011 at 01:08, Daniel Baluta daniel.bal...@gmail.com wrote: On Tue, Jun 28, 2011 at 8:39 PM, Ponkumaran Annadurai aspkuma...@gmail.com wrote: I got struck in making initrd file, I got the following error root@rocker:/boot# mkinitramfs -o initrd.img-2.6.39.1 2.6.39.1Y 2.6.39.1Y? - shouldn't it be 2.6.39.1. Daniel, I guess Ponkumaran did something (wrong) with extra version...what do you think? Mulyadi, I don't see how he could have changed EXTRA_VERSION from Makefile. Ponkumaran, could you try running: # mkinitramfs -o initrd.img-2.6.39.1 2.6.39.1 thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in compiling kernel
On Wed, Jun 29, 2011 at 4:37 PM, Ponkumaran Annadurai aspkuma...@gmail.com wrote: On Wed, Jun 29, 2011 at 12:42 PM, Daniel Baluta daniel.bal...@gmail.com wrote: I got struck in making initrd file, I got the following error root@rocker:/boot# mkinitramfs -o initrd.img-2.6.39.1 2.6.39.1Y 2.6.39.1Y? - shouldn't it be 2.6.39.1. Daniel, I guess Ponkumaran did something (wrong) with extra version...what do you think? Mulyadi, I don't see how he could have changed EXTRA_VERSION from Makefile. No, I didn do anything in the Makefile Ponkumaran, could you try running: # mkinitramfs -o initrd.img-2.6.39.1 2.6.39.1 I tried this one first but I was prompted that the folder 2.6.39.1 is not found in /lib/modules. Then I found a folder named 2.6.39.1Y thats why I used this name. But now I guess that this Y is given by me during configuration in the place for local version option. Is that any problem with that? I don't know :). I would recommend you to start a fresh install. It's obvious that you've did something wrong in the first time. Compiling the kernel should be fairly easy. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in compiling kernel
Have you tried to setup some sort of cross-compilation environment? Could you check CROSS_COMPILE env variable? Yes, I have given yes for that option during configuration OK, then that's your problem. CROSS_COMPILE is a string pointing to your cross compiler prefix. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in compiling kernel
On Tue, Jun 28, 2011 at 2:07 PM, Ponkumaran Annadurai aspkuma...@gmail.com wrote: On Tue, Jun 28, 2011 at 1:13 PM, Daniel Baluta daniel.bal...@gmail.com wrote: Have you tried to setup some sort of cross-compilation environment? Could you check CROSS_COMPILE env variable? Yes, I have given yes for that option during configuration OK, then that's your problem. CROSS_COMPILE is a string pointing to your cross compiler prefix. thanks, Daniel. Yes, It worked. Thank you sir. But I couldn't understand the reason. Can you explain this to me? Please keep kernelnewbies to CC:, so that other can read about this problem if they hit it. The reason for which it didn't work is that you haven't set a valid cross-compiler prefix in CROSS_COMPILE When you set a cross-compiler prefix, the value stored in CROSS_COMPILE is concatenated with the name of each tool used to compile your kernel. For example, objdump will be used as ${CROSS_COMPILE}objdump. You set CROSS_COMPILE=Y, and the tool to be used is now named Yobjdump, which obviously doesn't exist. Valid values for CROSS_COMPILE look like this: CROSS_COMPILE= mips64-octeon-linux-gnu-. Hope that things are now more clear. thanks, Daniel ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem in compiling kernel
On Mon, Jun 27, 2011 at 7:21 PM, Ponkumaran Annadurai aspkuma...@gmail.com wrote: Hello, I encountered the following error while compiling the kernel version linux-2.6.39.1. So I am giving here what I got on my screen. root@rocker:/usr/src/linux-2.6.39.1# make CHK include/linux/version.h CHK include/generated/utsrelease.h CC kernel/bounds.s GEN include/generated/bounds.h CC arch/x86/kernel/asm-offsets.s GEN include/generated/asm-offsets.h CALL scripts/checksyscalls.sh HOSTCC scripts/genksyms/genksyms.o SHIPPED scripts/genksyms/lex.c SHIPPED scripts/genksyms/parse.h SHIPPED scripts/genksyms/keywords.c HOSTCC scripts/genksyms/lex.o SHIPPED scripts/genksyms/parse.c HOSTCC scripts/genksyms/parse.o HOSTLD scripts/genksyms/genksyms CC scripts/mod/empty.o /bin/sh: Yobjdump: not found HOSTCC scripts/mod/mk_elfconfig MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o HOSTLD scripts/mod/modpost HOSTCC scripts/selinux/genheaders/genheaders HOSTCC scripts/selinux/mdp/mdp HOSTCC scripts/kallsyms HOSTCC scripts/conmakehash HOSTCC scripts/recordmcount CC init/main.o /bin/sh: Yobjdump: not found CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o /bin/sh: Yobjdump: not found CC init/do_mounts.o /bin/sh: Yobjdump: not found CC init/do_mounts_rd.o /bin/sh: Yobjdump: not found CC init/do_mounts_initrd.o /bin/sh: Yobjdump: not found CC init/do_mounts_md.o /bin/sh: Yobjdump: not found LD init/mounts.o /bin/sh: Yld: not found make[1]: *** [init/mounts.o] Error 127 make: *** [init] Error 2 Have you tried to setup some sort of cross-compilation environment? Could you check CROSS_COMPILE env variable? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: threading problem
Hello Murali, I have a device driver which provides the IOCTL function for the application to interact. when the application sends the IOCTL CMD_GO, my driver has to toggle a GPIO every 500 m Sec. until a 3 minute timeout occurs or a CMD_STOP IOCTL is received. I tried the DECLARE_WORK, DECLARE_DELAYED_WORK and also kernel_thread() to meet this requirement with no success. Could you please show us the code? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Getting started with kernel sources [Was: No subject]
On Thu, Jun 16, 2011 at 2:41 PM, Venkateswarlu P p.venkatesh...@gmail.com wrote: how to understand the kernerl source files in a simple way what header files i have to understand first for example to understand do_fork() function for process creation which is defined in kernel/fork.c There's no shortcuts. :) Use dump_stack() in various places and check what functions are called. Also use lxr ([1]) for code browsing. Please add a relevant Subject description to your emails. thanks, Daniel. [1] http://lxr.linux.no/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux module for causing a system hard lock-up
Hello, Could anyone please let me know how can I achieve this? Is hard lockup detector enabled in your system? Could you post your .config. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
show_regs vs dump_stack in watchdog_timer_fn
Hello, Why the stack isn't always dumped in watchdog_timer_fn ([1])? Registers content is useful, but without a stack trace it's very hard to find the task which caused system softlockup. thanks, Daniel. [1] http://lxr.linux.no/linux+v2.6.39/kernel/watchdog.c#L292 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: OS Books suggestion
Hello, * The design of unix operating system (Bach) * Modern operative systems (Tanenbaum) * Operating Systems design and implementation(Tanenbaum) I haven't done formal Computer Science studies, and I don't the time to read the three of them, but as I am working very close to the linux kernel, I am trying to sharp my skills a little. I would further suggest: * kernel area: Linux Kernel Development [1] * OS area: Operating Systems Concepts [2] * systems area: The Linux Programming Interface [3] Anyhow, while reading books it's ok in the beginning to really have a progress in your learning progress you should start looking at the code. thanks, Daniel. [1] http://www.amazon.com/Linux-Kernel-Development-Robert-Love/dp/0672325128 [2] http://www.amazon.com/Operating-Concepts-Seventh-Abraham-Silberschatz/dp/0471694665 [3] http://nostarch.com/tlpi ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Can we map a device address to two different memory locations?
On Fri, May 27, 2011 at 1:49 PM, sandeep kumar coolsandyfor...@gmail.com wrote: Hi all, Memory mapping is done so that CPU can access the devices, which it cant unless. Now the question is can we memory map a one device resource(say some iomemory) to two different memory locations? the other way of seeing at this question is, Will ioremap() gives different 'virtual addresses' when called multiple times? I can't see any reasons for which you can't do that. The best way to find out, is to try it. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: how to download a specific kernel version from kernel.org
Try this: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.tar.gz thanks, Daniel. On Mon, May 23, 2011 at 2:08 PM, sandeep kumar coolsandyfor...@gmail.com wrote: Hi all, I want to download kernel version 2.6.35 for a specific reason. I have a patch which is to be applied to that specific kernel revision. But in kernel.org i m finding only 2.6.35.13 only.(May be i cudnot find it) Pls tell me How to download that? Thanks in advance.. -- With regards, Sandeep Kumar Anantapalli, ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux kernel test suites
On Sat, May 21, 2011 at 2:33 AM, Abu Rasheda rcpilot2...@gmail.com wrote: Can someone pass me pointer to Linux kernel test suite ? I am specially interested in iptables (netfilter) and socket APIs. Hello Abu, Linux Test Project can be a good starting point ([1]). thanks, Daniel. [1] http://ltp.sourceforge.net/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: unlocked_ioctl explanation
2011/5/19 Ezequiel García elezegar...@yahoo.com.ar Thanks Dave for your answer. I guess the same question has been answered several times before. For the interest reader, I've found these: http://unix.stackexchange.com/questions/4711/what-is-the-difference-between-ioctl-unlocked-ioctl-and-compat-ioctl http://lwn.net/Articles/119652/ http://www.mail-archive.com/kernelnewbies@nl.linux.org/msg00269.html I have a remaining question, though. In the lwn article I read this: The ioctl() system call has long been out of favor among the kernel developers, who see it as a completely uncontrolled entry point into the kernel. Is this pointing that ioctl() is planning to get removed from the kernel ? In that case what's the currently preferred mechanism for giving 'control commands' to device drivers ? I would bet for 'sysfs'. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: tools to identify bugs in driver
On Thu, May 12, 2011 at 7:34 AM, Amit Nagal helloin.a...@gmail.com wrote: Hi , What are the mandatory tools that must be run to identify potential bugs ( say memory , locking etc ) in a linux device driver ? Turning on DEBUG_SLAB might be a good option. Have a look for all available options under make menuconfig's Kernel Hacking section. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: char driver error
i create a character special file using mknod in /dev directory. i try to write data to my file by echo -n abcd /dev/memory and when i try to read from that file i get the last char was written to that file that is d Hello Aravind, Can you post the output for: $ strace -n abcd /dev/memory $ strace cat /dev/memory a thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: char driver error
OK. See how write and read works. $strace echo -n abcd /dev/memory(/home/aravind/me write(1, abcd, 4) = 1 write(1, bcd, 3) = 1 write(1, cd, 2) = 1 write(1, d, 1) = 1 $ strace cat /dev/memory(/home/aravind/memory) read(3, d, 32768) = 1 write(1, d, 1d) = 1 Please allocate space for more than 1 char, and also correct memory_write tmp=buf+count-1; - tmp=buf+*f_ps-1; thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: perhaps confused about operation of alloc_chrdev_region()
Hi Robert, static int __init bsr_init(void) { struct device_node *np; dev_t bsr_dev = MKDEV(bsr_major, 0); --- You are right, this seems to be completely useless. Go on make a patch, compile and send it. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Interpreting call trace
Hello, I have the following stack trace: [3992.172/0] BUG: soft lockup - CPU#0 stuck for 61s! [events/0:39] [ 3992.215/0] Pid: 39, comm: events/0 Tainted: PW 2.6.32 #1 X8DTT-H [ 3992.222/0] RIP: 0010:[8115f989] [8115f989] __write_lock_failed+0x9/0x20 [ 3992.231/0] RSP: 0018:880028203908 EFLAGS: 0287 [ 3992.236/0] RAX: 88063ce0bfd8 RBX: 880028203920 RCX: 814e1b00 [ 3992.243/0] RDX: 8800282144e0 RSI: 880028203abc RDI: 814e1b04 [ 3992.250/0] RBP: 8100c6f3 R08: 0004 R09: 880028203ab0 [ 3992.257/0] R10: 88061851fa08 R11: R12: 880028203880 [ 3992.264/0] R13: 88060404f800 R14: 814e1b04 R15: 8101fd88 [ 3992.272/0] FS: () GS:88002820() knlGS: [ 3992.280/0] CS: 0010 DS: 0018 ES: 0018 CR0: 8005003b [ 3992.286/0] CR2: 7f9cc9fb9000 CR3: 01001000 CR4: 06f0 [ 3992.293/0] DR0: DR1: DR2: [ 3992.300/0] DR3: DR6: 0ff0 DR7: 0400 [ 3992.307/0] Call Trace: [ 3992.309/0] IRQ [81374e12] ? _write_lock_bh+0x22/0x30 [ 3992.316/0] [81297751] ? neigh_create+0x2f1/0x6b0 [ 3992.321/0] [81374f00] ? _read_unlock_bh+0x10/0x20 [ 3992.327/0] [81296401] ? neigh_lookup+0xd1/0xf0 [ 3992.333/0] [81297b96] ? neigh_event_ns+0x86/0xc0 [ 3992.338/0] [812f2cdb] ? arp_process+0x9fb/0xbf0 [ 3992.344/0] [812f2ffc] ? arp_rcv+0x11c/0x130 How could one interpret this? For example having: [ 3992.316/0] [81297751] ? neigh_create+0x2f1/0x6b0 [ 3992.321/0] [81374f00] ? _read_unlock_bh+0x10/0x20 means that _read_unlock_bh has been called finished ? Or it has been interrupted by next function in trace (neigh_create). Any other info about interpreting call traces are welcomed. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: query regarding kernel daemon
A daemon sleeps in the background. User can enter a string through the proc interface. Whenever a string is entered, the daemon is woke. The daemon keeps a copy of the last entered string in a variable. Initially the variable is initialized to NULL. When the daemon wakes, it checks if the string entered is same as the previous one or a new string is entered. When the string is entered, in case the new or the old strings are NULL, or in case the entered string is same as the old string the daemon goes back to sleep (with the help of the function interruptible_sleep_on(). Don't use interruptible_sleep_on use wait_event* instead. thanks, Daniel. [1] http://lxr.linux.no/linux+v2.6.38/include/linux/wait.h#L570 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Scheduling policy
On Mon, Apr 4, 2011 at 4:13 PM, Laurențiu Dascălu dascalu.laurent...@gmail.com wrote: Hello, I'm trying to implement a simple scheduling policy in the Linux kernel, but I'm not sure if I correctly understand the sched_class interface. Specifically, I would like to know more about the following functions: There's some useful information about sched_class interface inside [1], check 'Scheduler Classes', page 89. * put_prev_task(struct rq *rq, struct task_struct *prev) Q: It means the prev was preempted and I have to reschedule another task? Or I have just to add prev to the running queue? put_prev_task first announces to the scheduler class that the currently running task is going to be replaced by another one. So I guess, that prev was preempted but it is still in the running queue. Now the scheduler has to dequeue it, and to schedule another task. The code should look something like: if (prev-se.on_rq) { enqueue_task(rq, prev); } or I'm wrong? Why do you want to enqueue prev? Isn't rq supposed to hold the current running tasks? * task_tick(struct rq *rq, struct task_struct *p, int queued) Q: Should I preempt the task p, by calling resched_task? What does queued means? thanks, Daniel. [1] Professional Linux Kernel Architecture, W. Mauerer ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: why only C?
On Sun, Apr 3, 2011 at 10:17 PM, mohit verma mohit89m...@gmail.com wrote: Hi list, I have a very basic question. How much time have you tried documenting on this topic [1]? thanks, Daniel. [1] http://answers.google.com/answers/threadview/id/718661.html ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: how to get kernel functions calling stack/invokation ordert
Is there a way to find, in the kernel src tree, which routine/function is calling another function OR kernel function invocation stack order? This would be helpful for me to know the various steps/functionalities involved during executing something in kernel space. At runtime you can use dumpstack() [1]. Otherwise, just for reading the code I suggest cscope [2]. thanks, Daniel. [1] http://lxr.linux.no/linux+v2.6.38/arch/x86/kernel/dumpstack.c#L198 [2] http://cscope.sourceforge.net/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: how to get kernel functions calling stack/invokation ordert
Is there a way to find, in the kernel src tree, which routine/function is calling another function OR kernel function invocation stack order? This would be helpful for me to know the various steps/functionalities involved during executing something in kernel space. At runtime you can use dumpstack() [1]. Otherwise, just for reading the code I suggest cscope [2]. thanks, Daniel. [1] http://lxr.linux.no/linux+v2.6.38/arch/x86/kernel/dumpstack.c#L198 [2] http://cscope.sourceforge.net/ ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Snooping on sockets/file descriptors
On Thu, Mar 31, 2011 at 10:29 PM, Vimal j.vi...@gmail.com wrote: Hi, Is it possible for an application (say snoop, with sufficient privileges) to monitor data on any socket/file descriptor in the system? Here's an example: suppose we have a browser and it creates a tcp socket to connect to a URL. Whenever the browser issues a read() and data is pushed to user space, I want snoop to get notified and made available a copy of the same data that the browser read. ptrace can be used to do it, but then there are several ways the app can read data. It could use read(), or recv() or recvmsg(). Is there a better way to deal with this complexity? It's like the action of tee on any socket/file descriptor in the system. How about tcpdump? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: what is the kernel symbol for user space grant access driver
Hello, I want to know with respect to an image here http://bderzhavets.files.wordpress.com/2010/04/pv-2-6-32-12.png I have already compiled a kernel it mentions to enable user space grant access driver While compiling I did not notice it how can I now verify post compile some symbol CONFIG_* which can tell me if I included it? How can I find out can such a thing be looked some where in .config file? Compile the kernel with and without that option enabled than diff the .configs. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: messages printed lots of times
i am putting a printk() on link_path_walk() kernel function ( the pathname resolution function). i access that printk() only at some special condition (like if pathname passed to link_path_walk() matches with some name) . but when it gets hit like when i pass pathname via unlink(2) , lots of messages are written to dmesg ( or /var/log/messages) . i could not understand why these lots of messages are being written ? (i was hoping for only one message) Try to printout the name of the process on behalf of which the kernel runs link_path_walk using current-comm. Then filter out the printks done by your application. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: syscalls performance
Hi Mauro, On Fri, Feb 25, 2011 at 7:03 PM, Mauro Romano Trajber traj...@gmail.com wrote: I was doing some performance tests of system calls and I find an interesting behavior. Using RDTSC to count the CPU cycles, a single call to the getpid() consumes about 7k of CPU clock cycles and ten calls consume approximately 9,800 cycles. The fact is that from the second call, the CPU cycles grows at a rate of about 350 CPU cycles per call. Why does this happen? There is some hardware optimization when the syscall ID is already in EAX register ? Use strace and check to number of getpid() syscalls. You'll notice that only 1 system call is made, glibc caching the pid value. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: syscalls performance
On Fri, Feb 25, 2011 at 8:22 PM, Mauro Romano Trajber traj...@gmail.com wrote: Thanks Enrico and Daniel, you're right. glibc was caching getpid(); but this is not the root cause of this behavior. Going further, I decide to use call getpid without glibc, using syscall(SYS_getpid) to test this behavior and it happened again. Calling it once, the test consumes about 7k CPU cycles and 10 calls consumes about 10k CPU cycles. Any ideas ? Can you post a pointer to your code and information about how you got this numbers? thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies