Re: Boot log before panic

2024-02-09 Thread Mandeep Sandhu
How you access the log depends on the Linux distribution you're using
(whether its systemd based or not).

If you have journalctl, you can get the last boot log with

$ journalctl -k -b 1
(-k is to get get dmesg logs)

HTH,
-mandeep

On Fri, Feb 9, 2024 at 2:12 PM Abdulrasaq Lawani
 wrote:
>
> Hi all,
>
> Please, how do I locate the logs for a system boot that had a kernel panic 
> before booting was completed?
>
> Best regards,
> ___
> 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: How to handle Hotplug with UIO userspace driver

2017-09-28 Thread Mandeep Sandhu
On Thu, Sep 28, 2017 at 11:51 AM, Divakar  wrote:

> Hi Mandeep,
> Recently i encountered similar issue with UIO framework in hotplug
> scenario. I reviewed the earlier patch from 2010 and your 4 patch
> series. 4 patch series seems to work. I checked the latest kernel
> source and i dont think your patches have been merged. Hopefully
> i am not looking at the wrong place. If they are not merged is there
> a plan to merge them ? I do think these patches are required.
>
>
Thats correct. The patches have not been merged. I no longer have the
hardware available and have moved away from the project that needed it,
therefore I was unable to carry with the patches (they were still under
review). It'd be great if you can resubmit those. Make sure they apply
cleanly to the latest staging branch (?). I think Greg had asked some
question regarding during the review, it would be good if you can pick it
up from there. GKH (who's on this list too) can weigh in more on this.

Good luck.
-mandeep





> I also found a bug in your patch set which is discussed here
> https://lkml.org/lkml/2017/6/14/30. I was able to workaround/fix it.
> I can upload a patch if needed.
>
> Please advice if you plan to get the patchset merged.
>
> Thanks
> Divakar
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kgdb debug with ttyUSB0 instead of ttyS0

2017-04-25 Thread Mandeep Sandhu
>
> echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc
>
> but only got:
>
> echo write error: No such device
>

Is the USB-to-serial device detected on your target? Do you see a ttyUSB0
device node on your target? You can look at the kernel logs on your target
when you insert the device. If the kernel has the drivers for it, you
should see a device node being created.

-mandeep



>
> if I try:
>
> echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc
>
> is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?
>
> Best regards,
>
> Oliver
>
> ___
> 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: Patch Question

2017-04-17 Thread Mandeep Sandhu
On Mon, Apr 17, 2017 at 4:28 PM, Perry Hooker 
wrote:

> Hi everyone,
>
> I recently submitted a patch to the kernel mailing list:
> https://lkml.org/lkml/2017/3/21/712


lkml.org seems to be down! Wow, what did you do!?! :P

-mandeep




>
>
> I received some feedback on the patch. After a bit of polite
> back-and-forth, the respondent stopped replying when I asked for more
> information, and I haven't heard anything from the maintainers.
>
> Based on my analysis (contained in the thread), I still think the
> patch is correct & appropriate.
>
> What's the best way to determine if this is a good fix or not?
> How should I proceed if the patch is, in fact, a good fix?
>
> Best regards,
> Perry
>
> ___
> 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: How to browse the code

2017-04-12 Thread Mandeep Sandhu
On Wed, Apr 12, 2017 at 2:46 PM, Mandeep Sandhu  wrote:

> On Wed, Apr 12, 2017 at 2:41 PM, Code Soldier1 
> wrote:
>
>> Yes that is possible but it is very time consuming. Let's say I get
>> 500 hits ? Try searching for destructor in linux kernel code. I am
>> only interested in the one that is defined in sk_buff.
>>
>
> Look at cscope & ctags for such queries. Both tools will list all
> instances where the said identifier is declared. If a field is defined in
> multiple structs, you will get multiple results from which you have to sift
> through (it will still be less than free-text search that you'd do on lxr
> though).
>
> Also, please reply to the list (and not to me directly). Others on this
> list might have better suggestions.
>

(and I myself forgot to CC the list! :P)

-mandeep


> HTH,
> -mandeep
>
>
>
>>
>> On Wed, Apr 12, 2017 at 2:28 PM, Mandeep Sandhu
>>  wrote:
>> > On Wed, Apr 12, 2017 at 2:25 PM, Code Soldier1 
>> > wrote:
>> >>
>> >> Thanks. This does not completely solve my issue. I am looking for
>> >> something that can associate a field name with the structure.
>> >
>> >
>> > Well, you can search for a field's use using free-text search, then
>> looks at
>> > the line of code to figure out what struct it's part of, no? :)
>> >
>> > -mandeep
>> >
>> >
>> >>
>> >>
>> >> On Tue, Apr 11, 2017 at 1:13 PM, Mandeep Sandhu
>> >>  wrote:
>> >> >>
>> >> >> I am looking for something that can list all the places that a
>> certain
>> >> >> field of a certain structure is used. For example, sk_buff has a
>> field
>> >> >> called destructor, but so do many other data structures. How do I
>> >> >> search for places where just the destructor field of sk_buff.
>> >> >
>> >> >
>> >> > I think lxr has an identifier & free-text search (powered by
>> google). If
>> >> > that doesn't do it for you, you can go "old school" and try cscope
>> >> > maybe?
>> >> >
>> >> > HTH,
>> >> > -mandeep
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >> Thanks a lot.
>> >> >>
>> >> >> --
>> >> >> CS1
>> >> >>
>> >> >> ___
>> >> >> Kernelnewbies mailing list
>> >> >> Kernelnewbies@kernelnewbies.org
>> >> >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> CS1
>> >
>> >
>>
>>
>>
>> --
>> CS1
>>
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to browse the code

2017-04-12 Thread Mandeep Sandhu
On Wed, Apr 12, 2017 at 2:25 PM, Code Soldier1 
wrote:

> Thanks. This does not completely solve my issue. I am looking for
> something that can associate a field name with the structure.
>

Well, you can search for a field's use using free-text search, then looks
at the line of code to figure out what struct it's part of, no? :)

-mandeep



>
> On Tue, Apr 11, 2017 at 1:13 PM, Mandeep Sandhu
>  wrote:
> >>
> >> I am looking for something that can list all the places that a certain
> >> field of a certain structure is used. For example, sk_buff has a field
> >> called destructor, but so do many other data structures. How do I
> >> search for places where just the destructor field of sk_buff.
> >
> >
> > I think lxr has an identifier & free-text search (powered by google). If
> > that doesn't do it for you, you can go "old school" and try cscope maybe?
> >
> > HTH,
> > -mandeep
> >
> >
> >>
> >>
> >> Thanks a lot.
> >>
> >> --
> >> CS1
> >>
> >> ___
> >> Kernelnewbies mailing list
> >> Kernelnewbies@kernelnewbies.org
> >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> >
>
>
>
> --
> CS1
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to browse the code

2017-04-11 Thread Mandeep Sandhu
>
>
> I am looking for something that can list all the places that a certain
> field of a certain structure is used. For example, sk_buff has a field
> called destructor, but so do many other data structures. How do I
> search for places where just the destructor field of sk_buff.
>

I think lxr has an identifier & free-text search (powered by google). If
that doesn't do it for you, you can go "old school" and try cscope maybe?

HTH,
-mandeep



>
> Thanks a lot.
>
> --
> CS1
>
> ___
> 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: iptables-translate command not found

2016-10-14 Thread Mandeep Sandhu
This is query is not related to the Linux kernel, IMO.

You'll find better help in MLs for the Linux distribution you're using or
possibly on the netfilter ML. You should post your query there.

-mandeep


On Fri, Oct 14, 2016 at 6:50 AM, Gargi Sharma  wrote:

> Hi!
>
> I am looking to translate iptable rules to nftables and when I run the
> command sudo iptables-translate I get , command not found.
>
> The path for iptables command is /sbin/iptables.
>
> The other commands related to iptables that are available are:
> iptables-save
> iptables-restore
> ip6tables
>
> How do I install iptables-translate? From what I have understood from
> looking around is that iptables-translate comes with the iptables package.
>
> Thanks!
> Gargi
>
> ___
> 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: rules for interface naming for on-board cards

2016-05-02 Thread Mandeep Sandhu
>
> If the name contains a %d format string, the first available device
> name with the given base is used; assigned numbers start at zero.
>
> On my base machine, I have 1 NIC card which is onboard, rest I can
> remove and plug.
> For the onboard card I get the interfaces as em1-4, while all the
> other cards I get names as p1p2, p3p4 etc.

This looks like systemd's way of naming network interfaces (aka
predictable network interface names). Are you running a systemd
enabled system?

If so, look at this systemd guide for the naming convention:

https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

HTH,
-mandeep


>
> Does Udev know the difference.
>
> How are these names given, definitely there must be some configuration
> which is used to distinguish on-board card vs removable.
>
> Thanks.
>
> ___
> 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: UIO driver test

2016-04-15 Thread Mandeep Sandhu
>>  * Main initialization/remove routines
>>  */
>> static int __init uio_dummy_init(void)
>> {
>> printk("uio_dummy_init( )\n" );
>> uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
>>NULL, 0);

You also need to register the UIO driver by calling
uio_register_device() after populating your "struct uio_info"
appropriately.

>
> Why are you using a platform driver and device on x86?  That's not going
> to work at all, as your device doesn't have an irq.  Please use this on
> a "real" device that has an interrupt assigned to it.

If it's only for learning purpose, I guess one can skip registering a
IRQ handler and use UIO_IRQ_CUSTOM, right?

I did something similar for testing a UIO hotplug bug once. I used to
fake an IRQ event from a timer by using uio_event_notify().
https://github.com/mandeepsandhu/uio-hotplug-test/blob/master/uio_fake_hotplug.c

Although, I'm not sure if the OP wants to do something similar

HTH,
-mandeep


>
> hope this helps,
>
> greg k-h
>
> ___
> 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: What are need to makes humidifier?

2016-01-12 Thread Mandeep Sandhu
Wrong list.

This has nothing to do with the Linux kernel.


On Tue, Jan 12, 2016 at 12:11 AM, 윤영석  wrote:

> Hi,
>
> I want to make own humidifier.
>
> What sensor need when making humidifier??
>
>
>
> humidity indicator (detecting humidity), ultrasonic waves maker??
>
> Please shares your wisdom to me.
>
>
>
> Thanks.
>
> Best regards.
>
>
>
> ___
> 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: [PATCH] allow strictatime to be set as a global default

2015-12-19 Thread Mandeep Sandhu
Looks good to me.

To test the real watersyou should send it to the lists you
mentioned (or whatever the maintainers script tells you).

Good luck,
-mandeep


On Sat, Dec 19, 2015 at 1:41 PM, Raymond Jennings  wrote:
> How does this version look?
>
> (the other delta for the other file was untouched)
>
> Any chance it is ready to post to the big list (presumably fs with a cc to
> lkml)?
>
> diff --git a/fs/Kconfig b/fs/Kconfig
> index 6ce72d8..122a993 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -4,6 +4,20 @@
>
>  menu "File systems"
>
> +config DEFAULT_STRICTATIME
> + bool "Use strictatime by default"
> + default n
> + help
> +  Use strictatime as a default mount option.
> +
> +  Relatime became the default in 2007 to reduce I/O load on block devices.
> +
> +  Enabling this option will restore historic behavior and provide perfectly
> +  accurate atimes, but the increase in write load may reduce performance
> +  and shorten the life of the block device.
> +
> +  If unsure, say N.
> +
>  # Use unaligned word dcache accesses
>  config DCACHE_WORD_ACCESS
> bool
>
> On Fri, Dec 18, 2015 at 2:21 PM, Mandeep Sandhu
>  wrote:
>>
>> Ah yes...now it makes sense! :)
>>
>> The current 'word of caution' (about increased I/O load on block
>> devices), seems mild IMHO. Maybe we should we have a stricter
>> warning...something like enabling this option might be harmful to the
>> life of your block device (due to excessive writes) and will also lead
>> to reduced performance?
>>
>> HTH,
>> -mandeep
>>
>>
>> On Fri, Dec 18, 2015 at 2:12 PM, Raymond Jennings 
>> wrote:
>> > On Fri, Dec 18, 2015 at 10:50 AM, Mandeep Sandhu
>> >  wrote:
>> >>
>> >> You've removed the strictatime option altogether. So how does that
>> >> satisfy people who _do_ want it?
>> >
>> >
>> > ...actually it looks like I was an idiot and got my diff backwards when
>> > I
>> > pulled it out of git :P
>> >
>> > Here's the correct version.
>> >
>> > diff --git a/fs/Kconfig b/fs/Kconfig
>> > index 6ce72d8..4b917eb 100644
>> > --- a/fs/Kconfig
>> > +++ b/fs/Kconfig
>> > @@ -4,6 +4,17 @@
>> >
>> > menu "File systems"
>> >
>> > +config DEFAULT_STRICTATIME
>> > +   bool "Use strictatime by default"
>> > +   default n
>> > +   help
>> > + Use strictatime as a default mount option.
>> > +
>> > + Strictatime preserves ancient historic behavior of keeping the
>> > atime field always up to date.
>> > + However, it was changed in 2007 to relatime to reduce I/O load
>> > on
>> > block devices.
>> > +
>> > + If unsure, say N.
>> > +
>> > # Use unaligned word dcache accesses
>> > config DCACHE_WORD_ACCESS
>> >bool
>> > diff --git a/fs/namespace.c b/fs/namespace.c
>> > index 0570729..48e7c15 100644
>> > --- a/fs/namespace.c
>> > +++ b/fs/namespace.c
>> > @@ -2680,9 +2680,15 @@ long do_mount(const char *dev_name, const char
>> > __user
>> > *dir_name,
>> > if (retval)
>> > goto dput_out;
>> >
>> > -   /* Default to relatime unless overriden */
>> > +#ifdef CONFIG_DEFAULT_STRICTATIME
>> > +   /* Default to strictatime unless overridden */
>> > +   if (flags & MS_RELATIME)
>> > +   mnt_flags |= MNT_RELATIME;
>> > +#else
>> > +   /* Default to relatime unless overridden */
>> > if (!(flags & MS_NOATIME))
>> > mnt_flags |= MNT_RELATIME;
>> > +#endif
>> >
>> >
>> > /* Separate the per-mountpoint flags */
>> > if (flags & MS_NOSUID)
>> >
>> >
>> >
>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [PATCH] allow strictatime to be set as a global default

2015-12-18 Thread Mandeep Sandhu
Ah yes...now it makes sense! :)

The current 'word of caution' (about increased I/O load on block
devices), seems mild IMHO. Maybe we should we have a stricter
warning...something like enabling this option might be harmful to the
life of your block device (due to excessive writes) and will also lead
to reduced performance?

HTH,
-mandeep


On Fri, Dec 18, 2015 at 2:12 PM, Raymond Jennings  wrote:
> On Fri, Dec 18, 2015 at 10:50 AM, Mandeep Sandhu
>  wrote:
>>
>> You've removed the strictatime option altogether. So how does that
>> satisfy people who _do_ want it?
>
>
> ...actually it looks like I was an idiot and got my diff backwards when I
> pulled it out of git :P
>
> Here's the correct version.
>
> diff --git a/fs/Kconfig b/fs/Kconfig
> index 6ce72d8..4b917eb 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -4,6 +4,17 @@
>
> menu "File systems"
>
> +config DEFAULT_STRICTATIME
> +   bool "Use strictatime by default"
> +   default n
> +   help
> + Use strictatime as a default mount option.
> +
> + Strictatime preserves ancient historic behavior of keeping the
> atime field always up to date.
> + However, it was changed in 2007 to relatime to reduce I/O load on
> block devices.
> +
> + If unsure, say N.
> +
> # Use unaligned word dcache accesses
> config DCACHE_WORD_ACCESS
>bool
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 0570729..48e7c15 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2680,9 +2680,15 @@ long do_mount(const char *dev_name, const char __user
> *dir_name,
> if (retval)
> goto dput_out;
>
> -   /* Default to relatime unless overriden */
> +#ifdef CONFIG_DEFAULT_STRICTATIME
> +   /* Default to strictatime unless overridden */
> +   if (flags & MS_RELATIME)
> +   mnt_flags |= MNT_RELATIME;
> +#else
> +   /* Default to relatime unless overridden */
> if (!(flags & MS_NOATIME))
> mnt_flags |= MNT_RELATIME;
> +#endif
>
>
> /* Separate the per-mountpoint flags */
> if (flags & MS_NOSUID)
>
>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [PATCH] allow strictatime to be set as a global default

2015-12-18 Thread Mandeep Sandhu
You've removed the strictatime option altogether. So how does that
satisfy people who _do_ want it?

Is there some other option that will enable it? Just curious.

-mandeep


On Fri, Dec 18, 2015 at 6:42 AM, Raymond Jennings  wrote:
> I'm aware of a little tiff regarding strictatime in the past, and I
> think I came up with a patch that might help everyone get what they
> want.  I'm already using it myself.
>
> I've had some review on #kernelnewbies for technical issues, how does
> this look?
>
> ---
>
> diff --git a/fs/Kconfig b/fs/Kconfig
> index 4b917eb..6ce72d8 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -4,17 +4,6 @@
>
>  menu "File systems"
>
> -config DEFAULT_STRICTATIME
> -   bool "Use strictatime by default"
> -   default n
> -   help
> - Use strictatime as a default mount option.
> -
> - Strictatime preserves ancient historic behavior of keeping the
> atime field always up to date.
> - However, it was changed in 2007 to relatime to reduce I/O load on
> block devices.
> -
> - If unsure, say N.
> -
>  # Use unaligned word dcache accesses
>  config DCACHE_WORD_ACCESS
> bool
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 48e7c15..0570729 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2680,15 +2680,9 @@ long do_mount(const char *dev_name, const char
> __user *dir_name,
> if (retval)
> goto dput_out;
>
> -#ifdef CONFIG_DEFAULT_STRICTATIME
> -   /* Default to strictatime unless overridden */
> -   if (flags & MS_RELATIME)
> -   mnt_flags |= MNT_RELATIME;
> -#else
> -   /* Default to relatime unless overridden */
> +   /* Default to relatime unless overriden */
> if (!(flags & MS_NOATIME))
> mnt_flags |= MNT_RELATIME;
> -#endif
>
> /* Separate the per-mountpoint flags */
> if (flags & MS_NOSUID)
>
>
>
>
> ___
> 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: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Mandeep Sandhu
>> I'm on linux kernel version 3.14, and I followed the guide here:
>>
>> https://www.kernel.org/doc/htmldocs/uio-howto/userspace_driver.html
>>
>> And it describes the location on where the device file that should be
>> opened by userland code as either one of two locations:
>>
>> /dev/uioX, with X being a number
>>
>> or /sys/class/uio/uioX
>>
>> But the each of following returns nothing:
>>
>> ls /dev/uio*
>> ls /sys/class/uio/
>>
>> After I compile the uio example that is provided in the linux source at
>> source/drivers/uio/uio.c and uio_dmem_genirq.c, and insmod them, I do
>> modprobe uio and modprobe uio_dmem_genirq and each of those return nothing.
>> However, I do see that /sys/modules/uio and /sys/modules/uio_dmem_genirq

Have a look at this sample driver I wrote sometime back to trigger a UIO issue:

https://github.com/mandeepsandhu/uio-hotplug-test

I have not had the time to look at where it differs from your
implemntation, but I'll leave that to you to figure out :)

This create the /devuioX device file which the userspace code is opening.

HTH,
-mandeep


>>
>>
>> What am I doing wrong? Or where are the respective device files that I'm
>> supposed to use in my userland driver process?
>>
>> int fd = open("where is it!!?");
>> mmap(, fd,..);
>
>
>
> ___
> 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: What is negative lookup in linux filesystem

2015-10-05 Thread Mandeep Sandhu
>From the context of the snippet you posted, it looks like the author
implies a "failed lookup" when s/he writes "negative lookup".

CMIIW.

-mandeep



On Mon, Oct 5, 2015 at 8:08 AM, Praveen Kumar  wrote:
> Hi,
>
> I am trying to understand the path-lookup in linux filesystem and was going
> through https://www.kernel.org/doc/Documentation/filesystems/path-lookup.txt
>
> Under 'Rename' heading, I came across the negative lookup terminology,
> snapshot below
>
> 'Between deleting the dentry from the old hash list, and inserting it on the
> new
> hash list, a lookup may find neither 'A' nor 'B' matching the dentry. The
> same
> rename seqlock is also used to cover this race in much the same way, by
> retrying a negative lookup result if a rename was in progress.'
>
> Can anyone please help understanding the negative lookup concept and how do
> we achieve it. Thanks in advance.
>
> Regards,
>
> ~Praveen.
>
> ___
> 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: cross-compiling kernel using a 32-bit toolchain on a 64-bit machine

2015-04-07 Thread Mandeep Sandhu
So I found the issue (it was a PIBKAC issue :/)

I was using sudo to try and build the kernel (this was due to a messed
up setup where the whole kernel src tree ended up being written by
root). When copy-pasting my command here, I missed copying the sudo
part and that was precisely the reason for the error. When invoking
sudo, I think the current shells environment variables are not copied
(probably due to security reasons) and that's why it was not picking
up the toolchain paths.

Once I fixed the permissions on the source tree and invoke make as
regular user, it started working.

Sorry about the noise, I should've figured this out earlier.



On Tue, Apr 7, 2015 at 9:15 AM, Lad, Prabhakar
 wrote:
> On Mon, Apr 6, 2015 at 11:50 PM, Mandeep Sandhu
>  wrote:
>> Hi All,
>>
>> I'm having trouble compiling my kernel using a 32-bit toolchain (for
>> ARM) on a 64-bit host (Ubuntu 14.10). The kernel version is 3.14.17.
>>
>> I understand that 32-bit binaries require "ia32-libs" (or equivalent)
>> for compiling on 64-bit hosts. I installed the required packages
>> (lib32z1 lib32ncurses5 lib32bz2-1.0 for Ubuntu 14.10), but still keep
>> getting errors:
>>
>> $ make CROSS_COMPILE=arm-none-linux-gnueabi- all
>> Makefile:616: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR:
>> -fstack-protector not supported by compiler
>> make: arm-none-linux-gnueabi-gcc: Command not found
>
> Have built this toolchain or just downloaded from coudesourcery ?
> Go to the source where you downloaded toolchain (on your machine not
> the website)
> traverse to bin directory and try ./arm-none-linux-gnueabi-gcc --version.
>
> Cheers,
> --Prabhakar Lad

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: cross-compiling kernel using a 32-bit toolchain on a 64-bit machine

2015-04-07 Thread Mandeep Sandhu
> Edit .config and set  CONFIG_CROSS_COMPILE to the path where your cross
> compiler is located.

This doesn't help either! :/ I'll start afresh. Maybe my setup got
messed-up somehow.

Thanks anyway!

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: cross-compiling kernel using a 32-bit toolchain on a 64-bit machine

2015-04-07 Thread Mandeep Sandhu
On Mon, Apr 6, 2015 at 5:27 PM, John de la Garza  wrote:
> On Mon, Apr 06, 2015 at 03:50:41PM -0700, Mandeep Sandhu wrote:
>>
>> I'm having trouble compiling my kernel using a 32-bit toolchain (for
>> ARM) on a 64-bit host (Ubuntu 14.10). The kernel version is 3.14.17.
>>
>> Any hints on how to get make to use the toolchain?
>>
>
> after you export CROSS_COMPILE export ARCH=arm
>

This didn't help. I get the same error as before.

Thanks,
-mandeep


>
>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


cross-compiling kernel using a 32-bit toolchain on a 64-bit machine

2015-04-06 Thread Mandeep Sandhu
Hi All,

I'm having trouble compiling my kernel using a 32-bit toolchain (for
ARM) on a 64-bit host (Ubuntu 14.10). The kernel version is 3.14.17.

I understand that 32-bit binaries require "ia32-libs" (or equivalent)
for compiling on 64-bit hosts. I installed the required packages
(lib32z1 lib32ncurses5 lib32bz2-1.0 for Ubuntu 14.10), but still keep
getting errors:

$ make CROSS_COMPILE=arm-none-linux-gnueabi- all
Makefile:616: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR:
-fstack-protector not supported by compiler
make: arm-none-linux-gnueabi-gcc: Command not found
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC  kernel/bounds.s
/bin/sh: 1: arm-none-linux-gnueabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2

I've ensured that the PATH to the toolchain binaries is correct.

If I try to export CROSS_COMPILE to my environment, then too I get an
error (although it's for a different reason):

$ make all
Makefile:616: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR:
-fstack-protector not supported by compiler
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC  kernel/bounds.s
gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mapcs’
gcc: error: unrecognized command line option ‘-mno-sched-prolog’
gcc: error: unrecognized command line option ‘-mno-thumb-interwork’
gcc: error: unrecognized command line option ‘-mfpu=vfp’
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

It looks like make is starting a new shell which does not have either
PATH (1st case) or  CROSS_COMPILE (2nd case) set.

Any hints on how to get make to use the toolchain?

Thanks,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debugging an ARP issue (no resp to ARP requests)

2015-01-20 Thread Mandeep Sandhu
arp_filter=0 is the default, so I'm sure I've tested it with this
setting. I think I've tested with arp_ignore=0 too, although with
trying so many different combinations, I might've missed it out. I'll
keep this in mind when testing next.

Thanks.

On Mon, Jan 19, 2015 at 10:14 PM, Dave Tian  wrote:
> What about arp_filter=0 && arp_ignore=0?
>
> -daveti
>> On Jan 19, 2015, at 9:14 PM, Mandeep Sandhu  
>> wrote:
>>
>> Here's how my current setup looks like:
>>
>> $ ifconfig eth4
>> eth4  Link encap:Ethernet  HWaddr 74:fe:48:04:e7:eb
>>  inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
>> ...
>> $
>> ifconfig eth5
>> eth5  Link encap:Ethernet  HWaddr 74:fe:48:04:e7:e6
>>  inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
>> ...
>>
>> $ ip route show
>> default via 192.168.1.2 dev eth4
>> 192.168.1.0/24 dev eth4  proto kernel  scope link  src 192.168.1.1
>> 192.168.1.0/24 dev eth5  proto kernel  scope link  src 192.168.1.2
>>
>> I've deliberately added a default gateway to 192.168.1.2 (so that the
>> ARP response is routed back through it).
>>
>> $ip neigh show
>>
>> (there's no neighbor entries)
>>
>> cat /proc/sys/net/ipv4/conf/all/rp_filter
>> 0
>> cat /proc/sys/net/ipv4/conf/all/arp_filter
>> 1
>> cat /proc/sys/net/ipv4/conf/eth4/rp_filter
>> 0
>> cat /proc/sys/net/ipv4/conf/eth4/arp_filter
>> 1
>> cat /proc/sys/net/ipv4/conf/eth5/rp_filter
>> 0
>> cat /proc/sys/net/ipv4/conf/eth5/arp_filter
>> 1
>>
>> Even with these settings, ARP for 192.168.1.2, via eth4 (192.168.1.1)
>> interface fails.
>>
>>
>>
>>
>> On Mon, Jan 19, 2015 at 5:31 PM, Mandeep Sandhu
>>  wrote:
>>>> You'd mentioned earlier that your setup was this:
>>>>
>>>> xeth0 - 192.168.2.1
>>>> xeth2 - 192.168.2.2
>>>>
>>>> That looks to me like two network interfaces on the same subnet, though 
>>>> that's my guess since you don't show the prefix lengths. I'm guessing the 
>>>> subnet on both is 192.168.2/24.
>>>
>>> Correct. Netmask is /24.
>>>
>>>>
>>>> Unless things have changed since the last time I looked into this, for 
>>>> IPv4 Linux implements what's referred to as the "weak" address binding 
>>>> model where IP addresses are considered to belong to the host not the 
>>>> interface. That means your host may be transmitting an ARP response, but 
>>>> not out the interface you expect, particularly if in fact you have the 
>>>> same subnet assigned to more than one interface.
>>>>
>>>> You might want to tcpdump on all interfaces when you do this.
>>>
>>> I actually did that (after some googling) but there's no ARP response
>>> being transmitted out of either of the interfaces. As I mentioned
>>> before, this problem happens even with regular ethernet interfaces and
>>> not specifically with my custom hardware related ones, so looks like a
>>> routing (mis)configuration issue.
>>>
>>>>
>>>> Also, you might want to include the output of the following in future 
>>>> posts:
>>>>
>>>> ip addr show
>>>> ip route show
>>>> ip neigh show
>>>
>>> I'll now test with 2 "regular" ethernet interfaces on my test machine
>>> (eth0,eth1) and send the o/p of these commands.
>>>
>>> Thanks!
>>>
>>>>
>>>> Jeff Haran
>>>>
>>
>> ___
>> 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: Debugging an ARP issue (no resp to ARP requests)

2015-01-20 Thread Mandeep Sandhu
> This won't work.  Linux will consider both addresses as local to the
> host and will never respond to arp requests from any of those addresses.
>
> See http://en.wikipedia.org/wiki/Host_model

According to this Linux defaults to the 'weak host' model (I don't
know if Ubuntu changes this default). Although I don't know why this
will matter because I'm sending packets destined for the IP of that
specific interface (which should work in strong and weak models).

I think I'll sift through the ARP processing code to see if there are
points where it can drop a packet.

>
> You might be able to change this by tuning arp_announce/arp_ignore - But
> I don't know if that changes the behaviour wrt responses to local
> addresses...  See
> https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt for
> the meaning of these knobs.

I'm playing around with different combinations of anything even
remotely connected to ARP and routing. Nothing's changed till now.

Thanks for your time.

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debugging an ARP issue (no resp to ARP requests)

2015-01-19 Thread Mandeep Sandhu
Here's how my current setup looks like:

$ ifconfig eth4
eth4  Link encap:Ethernet  HWaddr 74:fe:48:04:e7:eb
  inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
...
$
ifconfig eth5
eth5  Link encap:Ethernet  HWaddr 74:fe:48:04:e7:e6
  inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
...

$ ip route show
default via 192.168.1.2 dev eth4
192.168.1.0/24 dev eth4  proto kernel  scope link  src 192.168.1.1
192.168.1.0/24 dev eth5  proto kernel  scope link  src 192.168.1.2

I've deliberately added a default gateway to 192.168.1.2 (so that the
ARP response is routed back through it).

$ip neigh show

(there's no neighbor entries)

cat /proc/sys/net/ipv4/conf/all/rp_filter
0
cat /proc/sys/net/ipv4/conf/all/arp_filter
1
cat /proc/sys/net/ipv4/conf/eth4/rp_filter
0
cat /proc/sys/net/ipv4/conf/eth4/arp_filter
1
cat /proc/sys/net/ipv4/conf/eth5/rp_filter
0
cat /proc/sys/net/ipv4/conf/eth5/arp_filter
1

Even with these settings, ARP for 192.168.1.2, via eth4 (192.168.1.1)
interface fails.




On Mon, Jan 19, 2015 at 5:31 PM, Mandeep Sandhu
 wrote:
>> You'd mentioned earlier that your setup was this:
>>
>> xeth0 - 192.168.2.1
>> xeth2 - 192.168.2.2
>>
>> That looks to me like two network interfaces on the same subnet, though 
>> that's my guess since you don't show the prefix lengths. I'm guessing the 
>> subnet on both is 192.168.2/24.
>
> Correct. Netmask is /24.
>
>>
>> Unless things have changed since the last time I looked into this, for IPv4 
>> Linux implements what's referred to as the "weak" address binding model 
>> where IP addresses are considered to belong to the host not the interface. 
>> That means your host may be transmitting an ARP response, but not out the 
>> interface you expect, particularly if in fact you have the same subnet 
>> assigned to more than one interface.
>>
>> You might want to tcpdump on all interfaces when you do this.
>
> I actually did that (after some googling) but there's no ARP response
> being transmitted out of either of the interfaces. As I mentioned
> before, this problem happens even with regular ethernet interfaces and
> not specifically with my custom hardware related ones, so looks like a
> routing (mis)configuration issue.
>
>>
>> Also, you might want to include the output of the following in future posts:
>>
>> ip addr show
>> ip route show
>> ip neigh show
>
> I'll now test with 2 "regular" ethernet interfaces on my test machine
> (eth0,eth1) and send the o/p of these commands.
>
> Thanks!
>
>>
>> Jeff Haran
>>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debugging an ARP issue (no resp to ARP requests)

2015-01-19 Thread Mandeep Sandhu
> You'd mentioned earlier that your setup was this:
>
> xeth0 - 192.168.2.1
> xeth2 - 192.168.2.2
>
> That looks to me like two network interfaces on the same subnet, though 
> that's my guess since you don't show the prefix lengths. I'm guessing the 
> subnet on both is 192.168.2/24.

Correct. Netmask is /24.

>
> Unless things have changed since the last time I looked into this, for IPv4 
> Linux implements what's referred to as the "weak" address binding model where 
> IP addresses are considered to belong to the host not the interface. That 
> means your host may be transmitting an ARP response, but not out the 
> interface you expect, particularly if in fact you have the same subnet 
> assigned to more than one interface.
>
> You might want to tcpdump on all interfaces when you do this.

I actually did that (after some googling) but there's no ARP response
being transmitted out of either of the interfaces. As I mentioned
before, this problem happens even with regular ethernet interfaces and
not specifically with my custom hardware related ones, so looks like a
routing (mis)configuration issue.

>
> Also, you might want to include the output of the following in future posts:
>
> ip addr show
> ip route show
> ip neigh show

I'll now test with 2 "regular" ethernet interfaces on my test machine
(eth0,eth1) and send the o/p of these commands.

Thanks!

>
> Jeff Haran
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debugging an ARP issue (no resp to ARP requests)

2015-01-19 Thread Mandeep Sandhu
On Mon, Jan 19, 2015 at 4:21 PM, Dave Tian  wrote:
> Check arp_* fields in
> https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
>

Thanks! This looks helpful.

> -daveti
>
>
> On Jan 19, 2015, at 7:11 PM, Mike Krinkin  wrote:
>
> Hi,
>
> On Mon, Jan 19, 2015 at 03:42:58PM -0800, Mandeep Sandhu wrote:
>
> Hi All,
>
> Please let me know if this is not the correct ML for such a question
> (or if there's a more appropriate list for it).
>
> I'm currently debugging an issue where Linux is not responding to ARP
> requests (testing with custom network interface h/w).
>
> I have 2 network interfaces which are basically interfaces on a custom
> network device sitting on the PCI bus.
>
> My setup looks like follows:
>
> xeth0 - 192.168.2.1
> xeth2 - 192.168.2.2
>
> xeth0/2 are the interfaces created for the custom device (via a lkm)
>
> Both these interfaces are on the local machine and are connected
> back-to-back on the custom device, so packets sent from one arrive on
> the other.
>
> I'm testing this setup by sending a single ARP pack, forced out of one
> interface, for the other interface's IP.
>
> $ sudo arping -c 1 -i xeth0 192.168.2.2
> ARPING 192.168.2.2
>
> --- 192.168.2.2 statistics ---
> 1 packets transmitted, 0 packets received, 100% unanswered (0 extra)
>
> If I start tcpdump on the receive interface (xeth2), I see the ARP
> packet arrive, but I don't see any response go out (I've attached the
> pcap file for anyone interested in looking at the received packet).
> The ARP packet's contents seem to be proper under wireshark.
>
> Is there any statistics I can look at to see if the packet was dropped
> by linux during ARP processing?
>
> I've put debug stmts in the LKM, but I don't see the kernel IP layer
> calling the xmit function for an ARP reply (however the xmit function
> for the ARP request, from xeth0, is being called).
>
>
> Have you tried to put debug prints in arp_process function?
>
>
> I don't see any drops in "netstat -s" output as well.
>
> Any hints appreciated.
>
>
> Just a random guess, but try to disable reverse path filtering (rp_filter).
>
>
> Thanks,
> -mandeep
>
>
>  w??T?g < ___
> 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
>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debugging an ARP issue (no resp to ARP requests)

2015-01-19 Thread Mandeep Sandhu
>
> Have you tried to put debug prints in arp_process function?
>

Not yet. I'm using the Ubuntu 14.10 kernel. I'm lazy and don't want to
rebuild their kernel (an config), so trying to figure out if I can
narrow down the problem without it!  :)

>>
>> I don't see any drops in "netstat -s" output as well.
>>
>> Any hints appreciated.
>
> Just a random guess, but try to disable reverse path filtering (rp_filter).

I just did actually. Unfortunately that didn't work either.

Interestingly, I tried the same experiment with 2 "regular" ethernet
interfaces on my machine and in that too the ARPs never resolve. This
indicates that this looks like a config issue and IP/routing issue?

>
>>
>> Thanks,
>> -mandeep
>
>> w??T?g  <   <   ??   ?~e ?~e??   
>>  ??
>> ___
>> 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


Debugging an ARP issue (no resp to ARP requests)

2015-01-19 Thread Mandeep Sandhu
Hi All,

Please let me know if this is not the correct ML for such a question
(or if there's a more appropriate list for it).

I'm currently debugging an issue where Linux is not responding to ARP
requests (testing with custom network interface h/w).

I have 2 network interfaces which are basically interfaces on a custom
network device sitting on the PCI bus.

My setup looks like follows:

xeth0 - 192.168.2.1
xeth2 - 192.168.2.2

xeth0/2 are the interfaces created for the custom device (via a lkm)

Both these interfaces are on the local machine and are connected
back-to-back on the custom device, so packets sent from one arrive on
the other.

I'm testing this setup by sending a single ARP pack, forced out of one
interface, for the other interface's IP.

$ sudo arping -c 1 -i xeth0 192.168.2.2
ARPING 192.168.2.2

--- 192.168.2.2 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)

If I start tcpdump on the receive interface (xeth2), I see the ARP
packet arrive, but I don't see any response go out (I've attached the
pcap file for anyone interested in looking at the received packet).
The ARP packet's contents seem to be proper under wireshark.

Is there any statistics I can look at to see if the packet was dropped
by linux during ARP processing?

I've put debug stmts in the LKM, but I don't see the kernel IP layer
calling the xmit function for an ARP reply (however the xmit function
for the ARP request, from xeth0, is being called).

I don't see any drops in "netstat -s" output as well.

Any hints appreciated.

Thanks,
-mandeep
Ôò¡wŽ½T…g<<ÿÿÔ~eÔ~eÀ¨À¨___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Wait times for patch submission

2015-01-06 Thread Mandeep Sandhu
> Ugh, that's going to require me to actually think when looking at that
> patch set, it might be a bit longer than a week or so :)

:) Sure, I'll patiently wait for your comments!

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Wait times for patch submission

2015-01-06 Thread Mandeep Sandhu
Thanks for your input. I'll keep it in mind for the future.

-mandeep


On Tue, Jan 6, 2015 at 12:29 PM, Bjørn Mork  wrote:
> Mandeep Sandhu  writes:
>
>> Hi All,
>>
>> I wanted to check with ppl who frequently post patches to LKML on how
>> long should one should wait before resending the patches in case
>> there's no response to them.
>
> That depends on lots of factors.  Like how important the patch is, what
> kind of patch management system the maintainer uses, etc, etc.
>
>> I had sent a patch on Greg KH's staging-next tree, on 16 Dec '14 to
>> LKML and the relevant maintainers.
>>
>> I got a mail from Greg's friendly bot stating that the branch was
>> closed and that the patches will be looked at once the merge window
>> closes.
>
> Which usually (always?) is true.  Note that "once the merge window
> closes" doesn't necessarily mean within days after -rc1.  It might mean
> a few weeks if the maintainer is busy doing other stuff, like travelling
> etc.  And maintainers are always busy :-)
>
> Some maintainers even have a life, which implies taking time off with
> their family at this time of the year.  You should therefore give them a
> week or two extra slack.
>
> And no, this does not count as "no response".  You got a reply giving a
> precise description of how your patches will be handled and what you
> need to do.
>
>> Do I need to resend the patches again or will they be picked up from
>> the maintainer's queue?
>
> They will most likely be picked up as promised, and you'll get another
> mail telling you which tree they were added to.
>
> I would wait until at least -rc5 in any case before considering a
> repost of something destined for the next release. That still leaves
> plenty of time before the next merge window opens.
>
>
> Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Wait times for patch submission

2015-01-06 Thread Mandeep Sandhu
>
> And normally that would have happened already, but I was on vacation for
> a few weeks and am still catching up on patches.  Stuff like code
> cleanup for staging is at the bottom of my list at the moment, as it's
> not essencial to get merged at the moment, only in time for the next
> release cycle.

Sure, although this is not a cleanup patch. It's the UIO hotplug patch
I bought to your attention a couple of weeks back.

I'll wait for review comments on it once you and others get around to
reviewing it.

Thanks and a Happy new year to all!

Regards,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Wait times for patch submission

2015-01-06 Thread Mandeep Sandhu
Hi All,

I wanted to check with ppl who frequently post patches to LKML on how
long should one should wait before resending the patches in case
there's no response to them.

I had sent a patch on Greg KH's staging-next tree, on 16 Dec '14 to
LKML and the relevant maintainers.

I got a mail from Greg's friendly bot stating that the branch was
closed and that the patches will be looked at once the merge window
closes.

Do I need to resend the patches again or will they be picked up from
the maintainer's queue?

Thanks,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: newbies CheckpatchTips for multiline statements (Breaking function calls)

2014-12-16 Thread Mandeep Sandhu
>
> btw: there's a perferred/preferred tyop too.
>
Sorry, but I just couldn't ignore the irony of this. :P

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Disable xhci_hcd USB 3.0 module

2014-12-15 Thread Mandeep Sandhu
As Greg mentioned, there's probably nothing that the software can do.

You can possibly try using different hardware for your hostone
that has a USB 2.0 root hub.

On Mon, Dec 15, 2014 at 1:32 PM, Gustavo Duarte  wrote:
> Greg,
>
> Thanks for confirm my thought.
>
>  I tried with a kernel 3.16 builded by Ubuntu guys,
> http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-utopic/linux-image-3.16.0-031600-generic_3.16.0-031600.201408031935_amd64.deb
>
>
> And the same behaviour, the Roboot lego kit can't establishes the
> communication with the PC.
>
> Do you think that with 3.18 kernel I will have a chance to resolve
> this ? or there aren't significantly changes related tu USB between
> 3.16 and 3.18 version.
>
>
> I guess that the problem is on SDK library usb communication, (libusb)
> i'm going to make a research to this side.
>
> Although this issue isn't resolved your help was very helpful, it was
> like lightning.
>
> Regards.
> Gustavo .
>
> On Mon, Dec 15, 2014 at 7:01 PM, Greg KH  wrote:
>> On Mon, Dec 15, 2014 at 06:47:21PM -0200, Gustavo Duarte wrote:
>>> 00:14.0 USB controller: Intel Corporation ValleyView USB xHCI Host
>>> Controller (rev 0e)
>>>
>>> Subsystem: CLEVO/KAPOK Computer Device 5471
>>>
>>> Kernel driver in use: xhci_hcd
>>
>> One host controller.
>>
>>> Seems like here is happening you are saying, one host-controller
>>> (xHCI) manage the three USB port, right ?
>>
>> Yes.
>>
>>> May be i have a confusion, and i sorry for that, may be what i am
>>> asking it is impossible or may be is a blunder, any way  following is
>>> my thought:
>>> "
>>> I know that there are several PC, Notebooks with BIOS with the
>>> capability to  enable/disable xHCI USB mode, where you can choice,
>>> xHCI or EHCI.
>>> For this reason i thought that could be possible, instead  by BIOS,
>>> through some kernel configuration or passing a switch parameter at
>>> boot time achieve the same behaviour.
>>> "
>>>
>>> Do you are saying that, as this notebook has only one usb
>>> host-controller, these option isn't possible ?
>>
>> Looks like it.  But I don't know what your bios looks like, poke around
>> in there and see if you can find a setting like that.  I've never heard
>> of such a thing though.  The xhci controller is a physical chip, it
>> can't work like a ehci controller.
>>
>>> So the only remainder way to resolve this, is trying with a new one kernel ?
>>
>> To see if the bug you are having with a USB 3 device is fixed, yes.  You
>> will not be able to ever get the ehci driver to work with this device no
>> matter what kernel you change to, sorry.
>>
>> greg k-h
>
> ___
> 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: How to send the [PATCH 0/x] kind of emails?

2014-12-14 Thread Mandeep Sandhu
On Sun, Dec 14, 2014 at 10:25 AM, Greg KH  wrote:
> On Sun, Dec 14, 2014 at 09:18:54AM -0800, Mandeep Sandhu wrote:
>> >
>> > Have you asked the original author about this?  There has to be some
>> > reason the patch was not accepted, right?  Try asking them what happened
>>
>> No, because the email address recorded in the patch is no longer valid.
>
> If that's the case, then I can't accept an invalid "From:" line on a
> patch, sorry.  I need an address of someone that will be responsible for
> it.

Got it. Although I think Eric might be active on LKML, albeit with a
different address. I'm hoping he'll pitch in once I submit the patch
with your suggestions.

Thanks again,
-mandeep


>
> So in that case, put your address as a "From:" and in the body say,
> "Originally written by  but forward ported by me" or something to
> that affect.
>
> thanks,
>
> greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to send the [PATCH 0/x] kind of emails?

2014-12-14 Thread Mandeep Sandhu
>
> Have you asked the original author about this?  There has to be some
> reason the patch was not accepted, right?  Try asking them what happened

No, because the email address recorded in the patch is no longer valid.

> to see if they remember.  I can't remember what happened with a specific
> patch yesterday, I deal with too many patches to be able to remember
> anything, but usually the author has a bit better recollection.

I could not find any NACK or any sort of comment on the original patch
submission. The only email I saw related to these patches was that it
didn't apply cleanly on the previous patch-set (also submitted by the
same author, and merged in by you). You had mentioned thta since the
patch didn't apply cleanly, you had deleted the patch-set and had
asked for it to be re-submitted (which the original author did).

>
> It's ok to submit other people's patches, but it's a nice idea to ask
> them about it before doing so.

I was hoping that Eric Biederman might still be there on LKML and that
he might jump in once I post the patches! :)

I'll add a 'Tested-by' to each of the commits and submit the patch-set.

Thanks,
-mandeep


>
> good luck,
>
> greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to send the [PATCH 0/x] kind of emails?

2014-12-12 Thread Mandeep Sandhu
On Fri, Dec 12, 2014 at 8:02 PM, Greg KH  wrote:
> On Fri, Dec 12, 2014 at 02:29:22PM -0800, Mandeep Sandhu wrote:
>> Thanks Greg!
>>
>> One more thing. Should the 'Tested-by:' tag be added in every commit
>> manually, or only one of them is enough (the last patch really
>> implements the functionality and the rest are 'preparatory' commits)?
>
> "Tested-by" is only for people who test the patch, not for the people
> who wrote the patch.  It is implied that the person who wrote the patch
> also tested it, otherwise they shouldn't be sending the patch in the
> firat place, right?

Right, although in my case, I'm not the original author of this patch.
This is the uio hotplug patch that I talked to you about on this ML a
few days back (which somehow missed inclusion almost 4 years back).

I'm simply following your suggestion, that is re-submitting the patch
(after making some minor modifications to it for making it work with
newer kernels). The original patch author is "Eric W. Biederman". I
have tested this patch for my use-case (with a PCIE hotplug device)
and I have also written a small "fake hotplug" driver which validates
this patch (https://github.com/mandeepsandhu/uio-hotplug-test).

Let me know if this is not the appropriate way to submit the patch (if
only the original author should submit it instead).

Thanks for your time.

Regards,
-mandeep

>
> Hope this helps,
>
> greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to send the [PATCH 0/x] kind of emails?

2014-12-12 Thread Mandeep Sandhu
Thanks Greg!

One more thing. Should the 'Tested-by:' tag be added in every commit
manually, or only one of them is enough (the last patch really
implements the functionality and the rest are 'preparatory' commits)?

-mandeep


On Fri, Dec 12, 2014 at 2:27 PM, Greg KH  wrote:
> On Fri, Dec 12, 2014 at 02:05:50PM -0800, Mandeep Sandhu wrote:
>> How does one send this kind of summary email? Is it generated manually
>> or through some git format-patch/send-email foo magic?
>>
>> I have 4 patches that I have to submit. I'd like to send a summary
>> email (0/4) explaining the changes.
>
> git send-email --compose
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to send the [PATCH 0/x] kind of emails?

2014-12-12 Thread Mandeep Sandhu
Ok got it. The answer was right there at the end of the git send-email
man page! I should've 'scrolled' harder! :P

$ git format-patch --cover-letter -M origin/master -o outgoing/
$ edit outgoing/-*
$ git send-email outgoing/*

Regards,
-mandeep


On Fri, Dec 12, 2014 at 2:05 PM, Mandeep Sandhu
 wrote:
> How does one send this kind of summary email? Is it generated manually
> or through some git format-patch/send-email foo magic?
>
> I have 4 patches that I have to submit. I'd like to send a summary
> email (0/4) explaining the changes.
>
> Thanks,
> -mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to send the [PATCH 0/x] kind of emails?

2014-12-12 Thread Mandeep Sandhu
How does one send this kind of summary email? Is it generated manually
or through some git format-patch/send-email foo magic?

I have 4 patches that I have to submit. I'd like to send a summary
email (0/4) explaining the changes.

Thanks,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Query on git usage for creating patch with incremental commits

2014-12-12 Thread Mandeep Sandhu
As others have pointed out, you need 'git rebase' here. With an
interactive rebase, you can cherry-pick what you want to do with each
commit (keep, edit, squash etc). It can also help you apply your
changes to a different  branch (using the '-- onto' option).

HTH,
-mandeep



On Fri, Dec 12, 2014 at 6:58 AM, Kumar Amit Mehta  wrote:
> Hi,
>
> I know that it's not a typical Linux kernel related query but I reckon
> that people involved in Linux kernel testing/development might have
> gotten into similar situation. So, please bear with me for this rather
> generic framework related query.
>
> The scenario:
> 1: Cloned linux-next at time T1
> $ git clone blahblah
>
> 2: Created a branch called development at T2
> $ git checkout -b development
>
> 3: Made change1 in development branch and did a commit at T3
> $ git commit -a
>
> 4: Made another commit in development branch and did another commit
> at time T4, but during this development phase, *some* of the changes
> that I made during my previous commit at time T3 were wrong, so had to
> remove *some* of the changes
> $ git commit -a
>
> 5: Now I create a branch called test, based off the master
> $ git checkout -b test origin/master
>
> 5: So my test branch(and also the master branch) is two commits behind the
> development branch. Now I wish to create a patch, based on my changes in
> development branch and apply that patch to my test branch for further
> testing.
>
> $ git format-patch origin/master -o patches
> The above command creates two patches, which I need to apply in an
> increasing order(0001 ---> 0002), otherwise, the patch won't work.
>
> So far so good, but what If, I am not particularly proud of the first
> patch, but have to send that anyway, If my patches are to be applied.
> Another approach would be to create another branch, say development-again,
> based of origin/master and make the necessary changes and then just
> create one patch file. But I was wondering that while doing development,
> don't we make commits in our working branches, which we think is
> correct, only to find it ridiculous later (say after few more commits
> in future) ? And what to do in such scenario ? Or how to use git to
> solve such scenario.
>
> Thanks,
> Kumar
>
> ___
> 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: How to handle Hotplug with UIO userspace driver

2014-12-08 Thread Mandeep Sandhu
Sorry, sent it too soon.

Here's the attached driver and userspace app for simulating a crash.
You can run make to build both.

Thanks,
-mandeep


On Mon, Dec 8, 2014 at 3:24 PM, Mandeep Sandhu
 wrote:
> Hi Greg,
>
>>> I saw a patch for this very situation (UIO & hotplug) being discussed on 
>>> LKML
>>> almost 4 yrs back, although I don't see it in my kernel version - 3.16.0
>>> (Ubuntu 3.16.0-24-generic).
>>> The LKML link:
>>>
>>> https://lkml.org/lkml/2010/9/20/21
>>>
>>> Wouldn't this solve the issue? I wonder why it didn't make it into mainline?
>>
>> No idea, that UIO maintainer must be really lazy and never apply patches :)
>>
>> Try that series on your kernel and see what happens.  If it works,
>> please resend that patch series.
>
> I tried out a dummy uio driver with a userspace program accessing the
> mmaped space (attached). On doing an unregister of the uio device, I
> see a crash/bug being triggered. Sometimes the kernel continues to
> run, sometimes failing during rmmod of my module, sometimes locks up
> during reboot (trying this on VirtualBox VM) and other times there's
> no crash at all (but I'm just getting lucky).
>
> Although with the patch applied, the user process gets a SIGBUS and
> exits when I do an uio_unregister_device() call in my driver. So I
> guess this patch is needed.
>
>
> A generic question, if I have to apply the patches and do a sanity
> build, which branch should I be applying the patch to? linux-next?
> linux-stable?
>
> Thanks,
> -mandeep
>
>
>>
>> thanks,
>>
>> greg k-h


Makefile
Description: Binary data
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define WAIT_FOR_INTERRUPT

int main()
{
int uiofd, intr_cnt = 0;
void *map_addr;
fd_set readset;

uiofd = open("/dev/uio0", O_RDWR);
if (uiofd < 0) {
perror("uio open:");
return errno;
}

long page_size = getpagesize();
map_addr = mmap(NULL, page_size,
PROT_READ | PROT_WRITE,
MAP_SHARED, uiofd, 0);

// Hammer away!
while (1) {
#ifdef WAIT_FOR_INTERRUPT
FD_ZERO(&readset);
FD_SET(uiofd, &readset);
if (select(uiofd + 1, &readset, NULL, NULL, NULL) <= 0) {
perror("select:");
break;
}
if (FD_ISSET(uiofd, &readset)) {
if (read(uiofd, &intr_cnt, 4) != 4) {
perror("uio read:");
break;
}
printf("intr count %d\n", intr_cnt);
memset(map_addr, 0, page_size);
}
#else
memset(map_addr, 0, page_size);
#endif
}

munmap(map_addr, page_size);
close(uiofd);
return 0;
}

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mandeep Sandhu");
MODULE_DESCRIPTION("Dummy UIO kernel driver");

static struct uio_info* info;
static struct platform_device *pdev;
static struct task_struct *ts;
static struct timer_list fake_intr_timer;

static int msec_unreg_delay = 3000; // 3 secs
static int msec_uio_intr_delay = 1000; // 1 sec

void unregister_uio(void)
{
if (info) {
pr_info("Unregistering uio\n");
uio_unregister_device(info);
kfree((void *)info->mem[0].addr);
kfree(info);
info = 0;
}
pr_info("Delting fake interrupt timer\n");
del_timer(&fake_intr_timer);
}

int kthread_fn(void *data)
{
pr_info("Sleeping for %d secs\n", (msec_unreg_delay)/1000);
msleep(msec_unreg_delay);

if (kthread_should_stop())
return 0;

unregister_uio();
pr_info("Exiting thread\n");
ts = 0;
return 0;
}

void fake_intr_timer_cb(unsigned long data)
{
if (!ts)
return;

pr_info("Firing fake interrupt\n");
uio_event_notify(info);
// Setup timer to fire again
mod_timer(&fake_intr_timer,
   jiffies + msecs_to_jiffies(msec_uio_intr_delay));
}

static int uio_dummy_open(struct uio_info *info, struct inode *inode)
{
pr_info("%s called\n", __FUNCTION__);
return 0;
}

static int uio_dummy_release(struct uio_info *info, struct inode *inode)
{
pr_info("%s called\n", __FUNCTION__);
return 0;
}

static int __init uio_dummy_init(void)
{
printk(KERN_INFO "Dummy uio driver!\n");

pdev = platform_device_register_simple("dummy_platform_device",
0, NULL, 0);
if (IS_ERR(pdev)) {
pr_err("Failed to register platform device.\n");
   

Re: How to handle Hotplug with UIO userspace driver

2014-12-08 Thread Mandeep Sandhu
Hi Greg,

>> I saw a patch for this very situation (UIO & hotplug) being discussed on LKML
>> almost 4 yrs back, although I don't see it in my kernel version - 3.16.0
>> (Ubuntu 3.16.0-24-generic).
>> The LKML link:
>>
>> https://lkml.org/lkml/2010/9/20/21
>>
>> Wouldn't this solve the issue? I wonder why it didn't make it into mainline?
>
> No idea, that UIO maintainer must be really lazy and never apply patches :)
>
> Try that series on your kernel and see what happens.  If it works,
> please resend that patch series.

I tried out a dummy uio driver with a userspace program accessing the
mmaped space (attached). On doing an unregister of the uio device, I
see a crash/bug being triggered. Sometimes the kernel continues to
run, sometimes failing during rmmod of my module, sometimes locks up
during reboot (trying this on VirtualBox VM) and other times there's
no crash at all (but I'm just getting lucky).

Although with the patch applied, the user process gets a SIGBUS and
exits when I do an uio_unregister_device() call in my driver. So I
guess this patch is needed.


A generic question, if I have to apply the patches and do a sanity
build, which branch should I be applying the patch to? linux-next?
linux-stable?

Thanks,
-mandeep


>
> thanks,
>
> greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to handle Hotplug with UIO userspace driver

2014-11-26 Thread Mandeep Sandhu
>
>
> Try that series on your kernel and see what happens.  If it works,
> please resend that patch series.
>
>
Sure. Will do.

Thanks
-mandeep


> thanks,
>
> greg k-h
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to handle Hotplug with UIO userspace driver

2014-11-26 Thread Mandeep Sandhu
>
> > While the kernel driver has no problem with hot-removal, I see that if I
> > "unregister" our UIO driver in response to the removal, then the mapping
> for
> > the hardware's physical memory would become "invalid" (done by UIO on
> > unregsiter). This could possibly cause the user-space process to crash
> due to
> > illegal memory access.
>
> You should just get 0xff on the memory reads, right?  You can catch the
> signal for invalid memory accesses.
>

Wouldn't I get an illegal memory access, as UIO would've removed the
mappings that it setup when I registered the UIO driver? I saw the
userspace process segfault after removal.


>
> > Is there a "standard" way to handle this scenario, i.e for hotpluggable
> > hardware using UIO?
>
> Your kernel driver knows when the device is removed, so have it tell
> userspace this.  Or, just tie into libudev and have your userspace
> program be notified when the device goes away.
>

Right. This is what I'm trying to do using a udev "remove" rule. Although
the question still remains, what will happen if the device is being
actively accessed _before_ the signal reaches the process. Is it safe to do
"uio_unregister_device" while a userspace process is accessing the device?

I saw a patch for this very situation (UIO & hotplug) being discussed on
LKML almost 4 yrs back, although I don't see it in my kernel version -
3.16.0 (Ubuntu 3.16.0-24-generic).
The LKML link:

https://lkml.org/lkml/2010/9/20/21

Wouldn't this solve the issue? I wonder why it didn't make it into mainline?


>
> Do you have a pointer to the source of your uio kernel driver anywhere?
>

Not yet, as this is still under active development (we don't have the h/w
to test yet :/ ). Maybe once things stabilize a little, we'll probably
open-source it along with the h/w too! :)

Thanks,
-mandeep



>
> thanks,
>
> greg k-h
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to handle Hotplug with UIO userspace driver

2014-11-26 Thread Mandeep Sandhu
Hi All,

We're working on a custom PCIe based hardware, which can be hotplugged into
the system.

We're using the UIO approach of having a minimal kernel driver which
basically handles the interrupt and provides a mmap of the device memory to
userspace and userspace driver which mmap's the provided memory and manages
the device.

We're using systemd and udev rules to spawn off a user process whenever the
hardware is plugged into the system.

Now my question is, how can we gracefully inform the userspace process if
someone pulls out the hardware (sitting on a PCI slot). Even with full
hotplug support, there can always be a case of "surprise removal", where
someone yanks the board without going through the whole "attention button"
routine.

While the kernel driver has no problem with hot-removal, I see that if I
"unregister" our UIO driver in response to the removal, then the mapping
for the hardware's physical memory would become "invalid" (done by UIO on
unregsiter). This could possibly cause the user-space process to crash due
to illegal memory access.

Is there a "standard" way to handle this scenario, i.e for hotpluggable
hardware using UIO?

Basically, we'd want to "unregister" the UIO device only after the
userspace process is informed of the removal so that it could unmap/close
the device and exit gracefully.

We could try doing it using some systemd trick, where we put a dependency
on one of the UIO created files (/dev/uioX), so that when the file is
destroyed, systemd could kill/shutdown the process. Although, there's no
guarantee that the userspace process won't try to access the mmaped space
during that interval, so this isn't a reliable solution either.

Any hints, thoughts?

Thanks.,
-mandeep
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [PATCH] staging: rtl8723au: Fix brace coding style issues reported by checkpatch

2014-10-28 Thread Mandeep Sandhu
>
> > it's pointless.  Increase it to a 21st century value or kill it.
> >
> >
> > --
> > Greg Donald
>
> But, but, but, what about all the kernel developers who are writing kernel
> code on VT100s and storing their sources on 80 column punch cards?
>

Lol, I agree!

There's nothing 21st century about long lines! As screen resolutions
increase ("Retina 5k" alert!), 1 line for you might, be 2 or more for
another. So in this regard, the old school 80 col is just right. Just
increase your font size so that it fits nicely in your editor from end to
end! :P


>
> Not everybody can afford these newfangled disk drives, ya know. 8^)
>
> Jeff Haran
>
>
> ___
> 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: Checkpatch Patches

2014-09-16 Thread Mandeep Sandhu
> I am fixing them first and them sending them out. I am going to listen now and
> only do them correctly.

Nick, you're very close to being banned from kernelnewbies too, so
please give some thought to other people's advise or else this might
be your last email to kernelnewbies.

As a first step, DON'T send patches as attachments, send them INLINE
in PLAIN TEXT. You need to demonstrate an understanding of this basic
instruction or else nobody will be able to help you. And frankly, you
need to stop fixing anything in the kernel till you get some level of
proficiency in basic programming and working collaboratively in
opensource projects.

> Nick
>
> ___
> 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: Loosing stdin/stdout over serial consoleafter bootup

2014-09-10 Thread Mandeep Sandhu
>
> according to my understanding if it was a problem of kernel command
> line or a missing config in the kernel , then you wont have got the
> output while booting. but since you are getting the output while
> booting and the output stops once the control is handed over to your
> bash, that implies it is something with the configuration.

Well, my problem is that the 'controlling tty' is somehow NOT the
serial console even if I boot the kernel with console=ttyS0,115200n.
So thats why I was wondering if there some kernel config that could
change that or help me debug it further.

Could be a misbehaving BIOS too. Don't know for sure.

> ofcourse i can be wrong , but if i was in your position now , i would
> have looked at configuration for busybox compilation.

Yeah, thats were I'm poking around right now. Busybox's inittab has a
slightly different interpretation of the commands (eg: the id field is
interpreted as a terminal console (tty0/ttyS0 etc)).

I also suspect the board's BIOS of playing foul. Although I've no idea
how or why.

>
> i said about filesystem , because you have not mentioned in your first
> mail that you are running busybox. you mentioned x86 board and bash ,
> so it could have been any linux distribution .

Busybox can run off a filesystem too. Although if there was some error
mounting the rootfs I guess I should've seen some error from the
kernel?

Thanks for your time!

Regards,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Loosing stdin/stdout over serial consoleafter bootup

2014-09-09 Thread Mandeep Sandhu
>
> are you really seriously expecting an answer within 2 hours of posting
> your question, and that too a question not related to any kernel
> problem ?

And how are you so sure about that? It could very well be an incorrect
kernel command line or a missing config in the kernel. So don't jump
to conclusions.

>>> However, once the kernel starts init (i.e bash), I stop seeing any
>>> output. There's no error, no crash anywhere. It just looks like the
>>> stdin/stdout of the application (in this case bash) is not connected
>>> to the serial console.
>
> this is a configuration issue . check if you have a file /etc/inittab .
> usually the setting will be there - but it again depends on the
> filesystem you are using.

This is a busybox build and it's spawning a shell on startup:

::askfirst:-/bin/onie-console

Where onie-console is:

cat bin/onie-console
#!/bin/sh

cat /etc/issue
exec /bin/sh -l

This is being run from the initrd image.

And how is this related to the filesystem?

Thanks for your time.

Regards,
-mandeep

>
> thanks
> sudip
>
>>>
>>> I'm sure it's a config issue, but I can't fathom what I need to
>>> change? Any hints?
>>>
>>> Thanks,
>>> -mandeep
>>
>> ___
>> 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: Loosing stdin/stdout over serial consoleafter bootup

2014-09-08 Thread Mandeep Sandhu
Anyone?

On Mon, Sep 8, 2014 at 3:30 PM, Mandeep Sandhu
 wrote:
> Hi All,
>
> I'm having a strange problem of loosing stdout output over serial console.
>
> I'm booting a kernel (3.14.16) on a x86_64 based board with a serial
> port. The board has Grub and Linux (with a minimal initrd) installed
> on a SATA HDD and starts linux with the following cmdline parameters
> from GRUB:
>
> console=tty0 console=ttyS0,115200n8 init=/bin/bash
>
> Grub loads the kernel fine and I can see the various debug messages on 
> minicom.
>
> However, once the kernel starts init (i.e bash), I stop seeing any
> output. There's no error, no crash anywhere. It just looks like the
> stdin/stdout of the application (in this case bash) is not connected
> to the serial console.
>
> I'm sure it's a config issue, but I can't fathom what I need to
> change? Any hints?
>
> Thanks,
> -mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Loosing stdin/stdout over serial consoleafter bootup

2014-09-08 Thread Mandeep Sandhu
Hi All,

I'm having a strange problem of loosing stdout output over serial console.

I'm booting a kernel (3.14.16) on a x86_64 based board with a serial
port. The board has Grub and Linux (with a minimal initrd) installed
on a SATA HDD and starts linux with the following cmdline parameters
from GRUB:

console=tty0 console=ttyS0,115200n8 init=/bin/bash

Grub loads the kernel fine and I can see the various debug messages on minicom.

However, once the kernel starts init (i.e bash), I stop seeing any
output. There's no error, no crash anywhere. It just looks like the
stdin/stdout of the application (in this case bash) is not connected
to the serial console.

I'm sure it's a config issue, but I can't fathom what I need to
change? Any hints?

Thanks,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Better testing when patching divers/staging/ - howto?

2014-09-05 Thread Mandeep Sandhu
>
> I/O is usually your limiting factor on kernel builds, not CPU time.  You
> want to keep those CPUs "full" of stuff to do, so give them things to
> process while the i/o is completing from other tasks.

Yes, this makes sense as compilation is also quite I/O bound due to
reading files to compile from disk.

>
> But as always, try it out on your system to see what works best for you,
> maybe your system is CPU bound on kernel builds as you are running out
> of a tmpfs (hint, even then I've found that you want to have more jobs
> than the number of processors...)

I will. But thanks for the tip! :)

-mandeep


>
> thanks,
>
> greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Better testing when patching divers/staging/ - howto?

2014-09-05 Thread Mandeep Sandhu
>
> Also do a faster make, with the -j option.  Pass in 2x the number of CPU
> cores you have, so if you have 2 cores do:
> make -j4
>
> to get a _much_ faster build.
>

Isn't the usual "wisdom" to run as many jobs as the number of CPUs
(like so grep processor /proc/cpuinfo | wc -l)?

Wouldn't more of jobs simply contend for CPU time as there are more
processes than processors?

Thanks,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Curious about corner case in btrfs code

2014-08-26 Thread Mandeep Sandhu
Then setup a test system which will reproduce hitting this corner case
and instrument your code to see is there's any gain at all.



On Tue, Aug 26, 2014 at 4:14 PM, Nick  wrote:
>
>
> On 08/26/2014 06:58 PM, Mandeep Sandhu wrote:
>> If it's a corner case, it won't be hit often enough right? And if it
>> was hit often enough, it wouldn't be corner case!? :)
>>
>> These 2 are mutually exclusive!
>>
>>
>> On Tue, Aug 26, 2014 at 3:47 PM, Nick  wrote:
>>> After reading through the code in inode.c today , I am curious about the 
>>> comment and the following code I will paste
>>> below. I am curious if this corner case is hit often enough for me to write 
>>> a patch to improve the speed of this
>>> corner case. Furthermore , compress_file_range is the function name, in 
>>> case you can't guess by the pasted code.
>>> Regards Nick
>>> 411 /*
>>> 412  * we don't want to send crud past the end of i_size through
>>> 413  * compression, that's just a waste of CPU time.  So, if the
>>> 414  * end of the file is before the start of our current
>>> 415  * requested range of bytes, we bail out to the uncompressed
>>> 416  * cleanup code that can deal with all of this.
>>> 417  *
>>> 418  * It isn't really the fastest way to fix things, but this is a
>>> 419  * very uncommon corner.
>>> 420  */
>>> 421 if (actual_end <= start)
>>> 422 goto cleanup_and_bail_uncompressed;
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> I get that my question is if this corner case is hit, enough for me to write 
> a patch to optimize it.
> In addition the comment states it isn't but want to known for standard 
> compression workloads in btrfs
> if it's hit enough for me to work on this and how much speed degradation are 
> me we doing my not writing
> it better.
> Nick

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Curious about corner case in btrfs code

2014-08-26 Thread Mandeep Sandhu
If it's a corner case, it won't be hit often enough right? And if it
was hit often enough, it wouldn't be corner case!? :)

These 2 are mutually exclusive!


On Tue, Aug 26, 2014 at 3:47 PM, Nick  wrote:
> After reading through the code in inode.c today , I am curious about the 
> comment and the following code I will paste
> below. I am curious if this corner case is hit often enough for me to write a 
> patch to improve the speed of this
> corner case. Furthermore , compress_file_range is the function name, in case 
> you can't guess by the pasted code.
> Regards Nick
> 411 /*
> 412  * we don't want to send crud past the end of i_size through
> 413  * compression, that's just a waste of CPU time.  So, if the
> 414  * end of the file is before the start of our current
> 415  * requested range of bytes, we bail out to the uncompressed
> 416  * cleanup code that can deal with all of this.
> 417  *
> 418  * It isn't really the fastest way to fix things, but this is a
> 419  * very uncommon corner.
> 420  */
> 421 if (actual_end <= start)
> 422 goto cleanup_and_bail_uncompressed;
>
> ___
> 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: Help with btrfs project

2014-08-20 Thread Mandeep Sandhu
Agree with Jason here.

If you don't find his questions palatable, just _ignore_ them instead
of sending rants and sarcastic emails which just wastes more of your
own time. That way the SNR of this list will improve! :)

On Wed, Aug 20, 2014 at 8:46 AM, Jason Conklin  wrote:
> Guys, stop it. Nick has told us he has Asperger syndrome; as such, he
> is not likely to understand facetious or flippant remarks for what
> they are. The time you've spent responding to Nick's emails would be
> much better used reading a little about autism spectrum disorders
> [1,2] and the kinds of difficulty and confusion they cause in more
> normal ("neurotypical") contexts, for both AS people and the people
> they interact with. Otherwise, just move on.
>
> I am not a psychologist or an expert on autism spectrum disorders, but
> I know enough to recognize that his behavior on this and other lists
> is consistent with several aspects of those disorders. The sad thing
> is that he's getting treated as a malicious troll or a fool, when it's
> pretty clear (to me, anyway) that he's fascinated by the kernel and
> just trying to learn as well as he knows how.
>
> Without going into autism spectrum intricacies or speculating on
> Nick's particular traits, I'll note that Aspergers is "characterized
> by significant difficulties in social interaction and nonverbal
> communication" (from Wikipedia) -- which we have seen repeatedly in
> Nick's frequently inappropriate and unresearched questions and
> misunderstanding/misuse of the good advice he has received.
>
> The resulting frustration is understandable. I acknowledge that the
> format of this and especially the working kernel lists is simply not
> equipped to handle Nick's sort of engagement. The best practice, if
> you're frustrated by Nick's emails, is probably to follow the protocol
> for feeding trolls -- ie, don't -- even though his motivations are
> different from what I'd consider a "real" troll's. You simply cannot
> expect him to respond (neuro)typically to your input.
>
> I don't intend to discuss this here anymore, but I really hope the
> above can provide a little context to help the community make more
> fruitful decisions in response to Nick's questions, or at least temper
> your frustrations.
>
> Jason Conklin
>
>
> [1] http://bit.ly/1odpfrd (Wikipedia: Autism spectrum)
>
> [2] http://bit.ly/1rmgrHg (Wikipedia: Asperger syndrome)
>
> ___
> 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: Why I can't map memory with mmap

2014-08-18 Thread Mandeep Sandhu
I sent the previous mail too early!

I got it to work for root user by setting "/proc/sys/vm/nr_hugepages" to 20
as suggested in Documentation/vm/hugetlbpage.txt. Now I'm able to mmap it
and it reflects the same in /proc/meminfo as well! :)

HTH,
-mandeep



On Mon, Aug 18, 2014 at 1:23 PM, Mandeep Sandhu  wrote:

> I tried your program and got the same result, i.e "Resource temporarily
> unavailable" for an ordinary user and "Cannot allocate memory" if run as
> root.
>
> However, reading the Huge TLB pages doc
> (Documentation/vm/hugetlbpage.txt), I saw the following para which might
> explain the error:
> ...
> Once a number of huge pages have been pre-allocated to the kernel huge page
> pool, a user with appropriate privilege can use either the mmap system call
> or shared memory system calls to use the huge pages. See the discussion of
> Using Huge Pages, below.
>
> The administrator can allocate persistent huge pages on the kernel boot
> command line by specifying the "hugepages=N" parameter, where 'N' = the
> number of huge pages requested. This is the most reliable method of
> allocating huge pages as memory has not yet become fragmented.
> ...
> ...
>
> I don't have my kernel booted with it, so that might explain why mmap fails 
> for MAP_HUGETLB.
>
> I can't restart my machine with the new flag right now, but maybe you can try.
>
> HTH,
>
> -mandeep
>
>
>
>
> On Mon, Aug 18, 2014 at 11:30 AM, Kevin O'Gorman 
> wrote:
>
>> Now I'm befuddled.  I modified the source so that it was easy to try
>> different combinations.  If I sudo it, I can map a 1GiB (1<<30) private
>> anonymous region if I sudo the program.  I cannot find any combination with
>> MAP_HUGETLB that works at all.
>>
>> Here it is in  working form, with an anonymous map and no backing file.
>> The mmap request is for a single byte, so it works for ordinary users  Try
>> uncommenting the MAP_HUGETLB line, and I'd love to hear about a version
>> that works, even if it's only for root.
>>
>> Since I'm aiming for a huge memory region, I figured HUGETLB would make
>> sense to limit the overhead.
>>
>>  CUT HERE 
>> /**
>>  * @file
>>  * "Find out the limits on locked memory"
>>  * Last Modified: Mon Aug 18 11:21:23 PDT 2014
>>  * @author Kevin O'Gorman
>>  */
>>
>> #define _GNU_SOURCE /* enable some of the mmap flags */
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> /* for getrlimit(2) */
>> #include 
>> #include 
>>
>> /* for open(2) */
>> #include 
>> #include 
>> #include 
>>
>> int
>> main(int argc, char *argv[])
>> {
>>   void *where;
>>   size_t length = 1;
>>   struct rlimit rlim;
>>   int flags = 0;
>>   int fd = -1;
>>
>> //  fd = open("solvedtaq", O_RDWR);  if (fd == -1) perror("open");
>>   printf("fd is %d\n", fd);
>>
>> //  flags |= MAP_HUGETLB;
>>   flags |= MAP_PRIVATE;
>>   flags |= MAP_LOCKED;
>>   flags |= MAP_ANONYMOUS;
>>
>>   if (getrlimit(RLIMIT_MEMLOCK, &rlim) == 0) {
>> printf("RLIMIT_MEMLOCK: hard: %lld, soft: %lld\n", (long
>> long)rlim.rlim_max, (long long)rlim.rlim_cur);
>>   } else {
>> perror("getrlimit failed");
>>   }
>>
>>   where = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0);
>>   if (where != MAP_FAILED) {
>> printf("Mapped at %p\n", where);
>>   } else {
>> perror("Mapping failed");
>>   }
>>
>>   return EXIT_SUCCESS;
>> }
>>  CUT HERE 
>>
>>
>>
>> On Mon, Aug 18, 2014 at 10:24 AM, Kevin O'Gorman 
>> wrote:
>>
>>>
>>> On Mon, Aug 18, 2014 at 9:46 AM,  wrote:
>>>
>>>> On Mon, 18 Aug 2014 08:15:12 -0700, "Kevin O'Gorman" said:
>>>>
>>>> > maybe someone here can help me figure out how to map a big (really
>>>> big)
>>>> > work area and lock it in memory.
>>>>
>>>> What problem are you trying to solve by doing this?  It usually doesn't
>>>> make
>>>> sense to lock more than a small chunk in memory - that's mostly for
>>>> crypto
>>>> programs like PGP that are paranoid about keys being written to swap
>>>> spaces,
>>>>

Re: Why I can't map memory with mmap

2014-08-18 Thread Mandeep Sandhu
I tried your program and got the same result, i.e "Resource temporarily
unavailable" for an ordinary user and "Cannot allocate memory" if run as
root.

However, reading the Huge TLB pages doc (Documentation/vm/hugetlbpage.txt),
I saw the following para which might explain the error:
...
Once a number of huge pages have been pre-allocated to the kernel huge page
pool, a user with appropriate privilege can use either the mmap system call
or shared memory system calls to use the huge pages. See the discussion of
Using Huge Pages, below.

The administrator can allocate persistent huge pages on the kernel boot
command line by specifying the "hugepages=N" parameter, where 'N' = the
number of huge pages requested. This is the most reliable method of
allocating huge pages as memory has not yet become fragmented.
...
...

I don't have my kernel booted with it, so that might explain why mmap
fails for MAP_HUGETLB.

I can't restart my machine with the new flag right now, but maybe you can try.

HTH,

-mandeep




On Mon, Aug 18, 2014 at 11:30 AM, Kevin O'Gorman  wrote:

> Now I'm befuddled.  I modified the source so that it was easy to try
> different combinations.  If I sudo it, I can map a 1GiB (1<<30) private
> anonymous region if I sudo the program.  I cannot find any combination with
> MAP_HUGETLB that works at all.
>
> Here it is in  working form, with an anonymous map and no backing file.
> The mmap request is for a single byte, so it works for ordinary users  Try
> uncommenting the MAP_HUGETLB line, and I'd love to hear about a version
> that works, even if it's only for root.
>
> Since I'm aiming for a huge memory region, I figured HUGETLB would make
> sense to limit the overhead.
>
>  CUT HERE 
> /**
>  * @file
>  * "Find out the limits on locked memory"
>  * Last Modified: Mon Aug 18 11:21:23 PDT 2014
>  * @author Kevin O'Gorman
>  */
>
> #define _GNU_SOURCE /* enable some of the mmap flags */
> #include 
> #include 
> #include 
> #include 
> #include 
>
> /* for getrlimit(2) */
> #include 
> #include 
>
> /* for open(2) */
> #include 
> #include 
> #include 
>
> int
> main(int argc, char *argv[])
> {
>   void *where;
>   size_t length = 1;
>   struct rlimit rlim;
>   int flags = 0;
>   int fd = -1;
>
> //  fd = open("solvedtaq", O_RDWR);  if (fd == -1) perror("open");
>   printf("fd is %d\n", fd);
>
> //  flags |= MAP_HUGETLB;
>   flags |= MAP_PRIVATE;
>   flags |= MAP_LOCKED;
>   flags |= MAP_ANONYMOUS;
>
>   if (getrlimit(RLIMIT_MEMLOCK, &rlim) == 0) {
> printf("RLIMIT_MEMLOCK: hard: %lld, soft: %lld\n", (long
> long)rlim.rlim_max, (long long)rlim.rlim_cur);
>   } else {
> perror("getrlimit failed");
>   }
>
>   where = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0);
>   if (where != MAP_FAILED) {
> printf("Mapped at %p\n", where);
>   } else {
> perror("Mapping failed");
>   }
>
>   return EXIT_SUCCESS;
> }
>  CUT HERE 
>
>
>
> On Mon, Aug 18, 2014 at 10:24 AM, Kevin O'Gorman 
> wrote:
>
>>
>> On Mon, Aug 18, 2014 at 9:46 AM,  wrote:
>>
>>> On Mon, 18 Aug 2014 08:15:12 -0700, "Kevin O'Gorman" said:
>>>
>>> > maybe someone here can help me figure out how to map a big (really big)
>>> > work area and lock it in memory.
>>>
>>> What problem are you trying to solve by doing this?  It usually doesn't
>>> make
>>> sense to lock more than a small chunk in memory - that's mostly for
>>> crypto
>>> programs like PGP that are paranoid about keys being written to swap
>>> spaces,
>>> and a *very* few highly performance oriented programs.  99.8% of the
>>> time,
>>> the kernel will do a reasonable job of making sure the right pages are in
>>> memory.
>>>
>>> Plus, programmers almost always over-estimate what they *really* need to
>>> lock
>>> down.  The end result is that performance ends up being *worse*, because
>>> they
>>> lock out more than needed, leaving all the rest of the processes on the
>>> system
>>> fighting over a too-small pool of pages.  Really sucks when you actually
>>> have
>>> to read  from disk every I/O because you no longer have an in-core file
>>> cache :)
>>>
>>> I'm solving a huge alpha-beta search problem, and want a huge cache
>> table tocheck permutations.  That's why I increased RAM from 8 to 32 GB,
>> and would
>> be happy to use the extra 24GB all for the cache.  (Cache table is like a
>> hash table but with collisions causing replacement rather than chaining).
>>
>> Even in my small tests, the cache is giving me speedups in the
>> neighborhood of
>> a million, so I'm going big. Because this is about speed, I do not *ever*
>> want it to
>> swap.
>>
>>
>>> > I wrote a little test program to try this out, and it fails.  As a
>>> regular
>>> > user, perror() tells me some "resource is temporarily unavailable".  As
>>> > root, it says it "cannot allocate memory".  I'm only asking for 1 byte.
>>>
>>> >   where = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_PRIVATE |
>>> > M

Re: [PATCH] usb: Fix switch statement in ohci-tmio.c

2014-08-14 Thread Mandeep Sandhu
>> Look I got off on the wrong start and I am starting to improve my repo but 
>> seems
>
> If you think you're improving your rep with these poor patches, you're 
> delusional.
>
>> impossible if people are just going to forget about my good patches.
>
> We'll discuss that when you actually submit one that isn't a steaming
> pile of dingo's kidneys.
>
> Do yourself a favor - try to resist the temptation to post a patch for at
> least 30 to 60 days, *no matter how correct you think it is*.
>

Plz start listening to what people are telling you. Don't post patches
here. If you want to make them, fine. Keep them in your local machine
for now. Heed to the advice of seniors here otherwise people will just
start ignoring you _completely_ and you won't get any help after that.

Also, I've observed that you're not trying to understand what the code
is doing. You're looking at every build error/bug as a C programming
problem (which too unfortunately you're not understanding completely)
and have no clue of the context in which it's written. Thats why
Valdis and many others are finding so many faults in your 'patches'.
They are wrong at both levels!

Please go through some C tutorials and get a good grasp of the
language. Only _then_ attempt to get your hands dirty with kernel
code.

This is my last advice. After this, I will delete all patch related
emails from you without reading it.

Good luck,
-mandeep




> ___
> 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: Bad Patches and Issues with other devolopers

2014-08-06 Thread Mandeep Sandhu
-1

I don't support a ban for Nick on this list. If he's genuinely
affected by a learning problem then we need to take that into account
before jumping to a conclusion.

Nick,

Advice for you is to NOT worry about whether you're part of
kernelnewbies/vger lists or not. Just concentrate on learning as much
as possible and 'doing the right thing'. Everything else will fix
itself.

When you encounter a problem, post your questions here. There are a
lot of people who'll be willing to help you, provided you've shown
understanding and commitment from your side too.

Good luck,
-mandeep






On Wed, Aug 6, 2014 at 9:31 AM, Josh Carlson  wrote:
> +1 lmfao!
>
> -Josh
>
> On 08/06/2014 09:35 AM, Robert P. J. Day wrote:
>> On Wed, 6 Aug 2014, Nick Krause wrote:
>>
>>> Seems I am banned from the [LKML] list is there any way around this
>>> or not?
>>good lord, man ... when you're *banned* from a particular venue, the
>> proper and productive response is to examine your behaviour, then do
>> what it takes to correct it, *not* immediately ask if there's a way
>> to circumvent the ban.
>>
>>at this point, i suggest it's time to ban you from *this* list for
>> the simple reason that your participation has nothing to do with
>> furthering anyone's knowledge of the linux kernel; rather, it has
>> devolved into a discussion about your unacceptable behaviour, and this
>> is most emphatically *not* the proper mailing list for that.
>>
>>if there's a voting process, i would vote that nick krause be
>> removed from this mailing list.
>>
>> rday
>>
>
>
> ___
> 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: Bad Patches and Issues with other devolopers

2014-08-05 Thread Mandeep Sandhu
Hi Nick,

I came across some G+ posts from kernel developers discussing you and
your recent patch submissions. I must say you're pretty (in)famous! :)

Jokes aside, why not just follow on the advice given to you by so many
people, i.e pick an area of interest (in the various kernel
subsystems) for yourself, first pick really small ossues (but not the
code formatting ones as they only tend to generate noise for the
maintainer and not really fix anything), create the patch, see if the
kernel builds with. TEST IT, most importantly (if you don't have the
requisite hw then either acquire one, or pick another issue where you
CAN test it). Basically check everything thats mentioned here:

https://www.kernel.org/doc/Documentation/SubmittingPatches
http://kernelnewbies.org/OPWfirstpatch

Trust me, if you _do_ go through this process and submit a 'good'
patch, all past issues that you've had with other developers will be
forgotten.

Don't be in a rush to get 'something' in the kernel. I know its a big
deal to get things in one of the coolest piece of software on this
planet, but you'll need a lot perseverance and patience to be a kernel
contributor.

HTH,
-mandeep


On Tue, Aug 5, 2014 at 10:42 AM, Nick Krause  wrote:
> I have sent out just ten bad patches and the developers seem very
> annoyed with me and
> think I am trolling. If someone on this list can find a way for me to
> improve my relationship
> with them and let me continue my work here that would be great.
> Nick
>
> ___
> 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: DMA over USB

2014-07-01 Thread Mandeep Sandhu
You might want to ask this question to the USB experts on the
linux-usb ML - linux-...@vger.kernel.org

HTH,
-mandeep

On Tue, Jul 1, 2014 at 10:10 PM, Raghavendra  wrote:
> Hello,
>
> I have a query regarding DMA(Direct Memory Access) for the usb devices.
>
> The understanding of DMA actions over PCI is straight forward. PCI
> devices support bus mastering capability, such that the PCI devices
> could take the ownership of the bus and perform access to the memory
> directly, and a software support exists for the same in Linux.
>
> As far as USB devices are concerned, they don’t have the bus mastering
> capability like the PCI devices.
> But the USB URB structure have a field named 'dma_addr_t transfer_dma',
> used for DMA access. The USB driver allocate the DMA buffers coherently
> and pass the DMA address to the URBs during its initialization.
> As far as Linux is concerned, how the DMA action being taking place for
> USB devices. As per my understanding, the USB host controller is taking
> care of the DMA operations. But I require a little more insight into it.
>
> Further more, if it is possible for the USB devices, then can this
> support be also extended towards low-end protocols such as I2C or SPI?
>
> Thanks,
> Raghavendra
>
> ---
> [ C-DAC is on Social-Media too. Kindly follow us at:
> Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
>
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email
> is strictly prohibited and appropriate legal action will be taken.
> ---
>
>
> ___
> 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: git merge issues

2014-06-11 Thread Mandeep Sandhu
> Now my question is that do I need to solve the merging issue manually or
> is there any way to solve this using git?

This is in no way related to the Linux kernel. You should be asking
this on the git mailing list.

Short answer - you will have to manually fix the conflict. Git could
not do it automatically and hence it's asking you to fix it. After
fixing the conflict, do 'git add ' and then 'git commit'.

HTH,
-mandeep


>
> Thank you.
> Raghavendra
>
> ---
> [ C-DAC is on Social-Media too. Kindly follow us at:
> Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
>
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email
> is strictly prohibited and appropriate legal action will be taken.
> ---
>
>
> ___
> 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: Can a Bottom half be scheduled from a kernel thread

2014-05-13 Thread Mandeep Sandhu
> For example, if there is some work which is prepared ready by a kernel
> thread (but thread dont want to process it immediately, rather want to
> deffer it for sometime) and the intention is to process this "prapared work"
> at some later time. In the situation like this, can we use the tasklet to do
> this?

Isn't the purpose of the (kernel) thread itself is to DO deferred
work? Tasklets, if I remember, are run only once at *some* later stage
of processing an interrupt.

Why can't use another kernel thread itself (or maybe even a timer) to
schedule your work?

See this link which explains the difference between the 2 succinctly:

http://www.makelinux.net/ldd3/chp-7-sect-6

HTH,
-mandeep


>
>
>
>
>
> On Tue, May 13, 2014 at 6:28 AM, Pranay Srivastava 
> wrote:
>>
>>
>> On May 13, 2014 2:36 AM, "Vishwas Srivastava" 
>> wrote:
>> >
>> > Hi All,
>> > This may sound a dumb question. I just want to know if a
>> > tasklet can be scheduled from a kernel thread.
>>
>> You can do tasklet_schedule in case I am getting your question.
>>
>> > what are the pros and crons of doing so?
>>
>> Don't sleep or schedule the tasklet code. It needs to be atomic since it
>> runs via TASKLET_SOFTIRQ.
>>
>> > thanks,
>> > Vishwas S
>> >
>> > ___
>> > 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
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Eudyptula Challenge

2014-05-05 Thread Mandeep Sandhu
+1 to this question.

I too started off early, but now I'm busy with my current work and
paused on the assignments.

-mandeep

On Mon, May 5, 2014 at 5:25 PM, Narendra Joshi  wrote:
> Will the Eudyptula Challenge be always around? I want to do the challenge
> problems but I am busy these days. So I want to start doing them some time
> later. Will I be able to?
>
> --
> narendra
>
> ___
> 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: thread context switching

2014-03-18 Thread Mandeep Sandhu
On Tue, Mar 18, 2014 at 10:24 PM,   wrote:
> On Tue, 18 Mar 2014 19:01:50 +0300, Nada Saif said:
>
>> I want to measure thread context switching in c, How I can do that?

Looks suspiciously like an interview-type question? :)

>
> What are you trying to measure, exactly, and why?  The answer depends on
> the details of the question.
>
> However, my first go-to solution would see if 'perf' can cough up the
> numbers you need.  It's able to slurp out all sorts of timing data from
> the kernel (though some data and trace points require CONFIG_* variables
> to be set in the kernel build).
>
> ___
> 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: A new way to dive into the kernel!

2014-03-12 Thread Mandeep Sandhu
I'm using gmail on the web.

You can send plain text mails from it if thats what you're worried about.

HTH,
-mandeep


On Wed, Mar 12, 2014 at 9:25 PM, Asutosh Das  wrote:
> which email client are you guys using please ?
>
> On 12 March 2014 21:23, Ronald Dahlgren  wrote:
>> And now the second task has arrived. Thanks to whomever kicked the machine
>> into action :-)
>>
>> Ron Dahlgren
>> http://www.dahlgren.so | @ScaleItRon
>>
>> On Mar 12, 2014 8:28 AM, "Ronald Dahlgren" 
>> wrote:
>>>
>>> I signed up last month and received and completed my first task. I got a
>>> congratulations email for the first task, but have not received any
>>> subsequent assignments. Any idea what I should do about that?
>>>
>>> Ron Dahlgren
>>> http://www.dahlgren.so | @ScaleItRon
>>>
>>> On Mar 10, 2014 11:22 PM, "Aruna Hewapathirane"
>>>  wrote:
>>>>
>>>> It seems too many people signed up at the moment... causing the scripts
>>>> to malfunction. Should be resolved in a day or two is what I was told. I
>>>> have so far received four tasks. Thank you !
>>>>
>>>> Aruna
>>>>
>>>>
>>>> On Tue, Mar 11, 2014 at 2:14 AM, Srivardhan M S 
>>>> wrote:
>>>>>
>>>>> Yes... Just sent the solution for the 1st assignment... You  not
>>>>> gettting? What is the issue?
>>>>>
>>>>> Thank-you,
>>>>> Sri
>>>>>
>>>>> On Tue, Mar 11, 2014 at 11:19 AM, Mandeep Sandhu
>>>>>  wrote:
>>>>> > Yes.
>>>>> >
>>>>> > Just remember to send a plain text mail.
>>>>> >
>>>>> > HTH,
>>>>> > -mandeep
>>>>> >
>>>>> >
>>>>> > On Tue, Mar 11, 2014 at 10:36 AM, sanjeev sharma
>>>>> >  wrote:
>>>>> >> Hello All,
>>>>> >>
>>>>> >> Have you guys getting your assignment's ?
>>>>> >>
>>>>> >> Regards
>>>>> >> Sanjeev Sharma
>>>>> >>
>>>>> >>
>>>>> >> On Wed, Mar 5, 2014 at 10:50 AM, Mallesh Koujalagi
>>>>> >>  wrote:
>>>>> >>>
>>>>> >>> Good info, thanks for sharing
>>>>> >>>
>>>>> >>>
>>>>> >>> On Tue, Mar 4, 2014 at 8:38 PM, Amit Saha 
>>>>> >>> wrote:
>>>>> >>>>
>>>>> >>>> On Wed, Mar 5, 2014 at 2:19 PM, Mandeep Sandhu
>>>>> >>>>  wrote:
>>>>> >>>> > Came across this in Greg (KH)s G+ feed.
>>>>> >>>> >
>>>>> >>>> > http://eudyptula-challenge.org/
>>>>> >>>> >
>>>>> >>>> > Thought I'd share it here too in case someone missed it.
>>>>> >>>> >
>>>>> >>>> > Looks like a fun and interesting way to start off doing stuff in
>>>>> >>>> > the
>>>>> >>>> > kernel!
>>>>> >>>>
>>>>> >>>> Interesting! Thanks for sharing.
>>>>> >>>>
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> http://echorand.me
>>>>> >>>>
>>>>> >>>> ___
>>>>> >>>> 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
>>>>> >>>
>>>>> >>
>>>>> >
>>>>> > ___
>>>>> > 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
>>>>
>>>>
>>>>
>>>> ___
>>>> 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
>>
>
>
>
> --
> Thanks & Regards
> ~/Asutosh Das
> # (91) 8297 00 1980

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Does register_chrdev function make device file under /dev ?

2014-03-11 Thread Mandeep Sandhu
On Tue, Mar 11, 2014 at 1:31 PM, Kim Chan  wrote:
>
> Yeah, I know mknod command. I just wanted to know if the register_chrdev
> makes the file or not.

It doesn't. Also note that this is the old way of registering a char
device. New code should use cdev_add() etc.

> To my understanding, device file is needed when a user program wants to
> access the device and we don't need to generate the device file for us to
> use the device in kernel. Is my understanding correct?

Yes, device nodes are needed for userspace code to access a device
(the good ol "devices are also files" Unix paradigm! :)).

I'm not sure how an in-kernel access will work (maybe via directly
getting the corresponding cdec structure).

>
> For example, busybox (a user program) starts shell on tty2-4 by default. (as
> the assumed default inittab below)
> tty2::askfirst:-/bin/sh
> tty3::askfirst:-/bin/sh
> tty4::askfirst:-/bin/sh
> I have had some mknod commands before in /etc/init.d/rcS to make tty2~tty4
> device files, but when I remove them for test, I can see busybox (almost
> sure it's coming from busybox) complaining that it cannot find the tty2~tty4
> device files.

Correct. You will have to create those nodes manually.

>
> I am trying to open a shell on my LCD (is it going to be tty2 ? I don't
> know) and I'm not sure if I have to make vcs1 vcs2 vcs3 files. And I don't
> know how to switch to LCD shell. during the boot, the texts come out on the
> LCD but I cannot see the texts (printf) from busybox. and cannot see the
> shell on LCD. When I press the keyboad, it looks like it's connected to
> tty1(I can see using prints on uart window). Can anybody tell me some
> direction?

I think you need to point getty or a shell to the correct tty before
you can see o/p on the screen. Do you know which device file you're
supposed to create for the LCD? If so, just use that in your inittab.
Something like:

::askfirst:-/bin/sh

HTH,
-mandeep


> 
> From : "Kernel" 
> Sent : 2014-03-11 14:44:09 ( +09:00 )
> To : Kim Chan 
> Cc : kernelnewbies@kernelnewbies.org 
> Subject : Re: Does register_chrdev function make device file under /dev ?
>
>
>
> On Mar 10, 2014, at 10:25 PM, 김찬  wrote:
>
> Hi,
>
> This should be a basic question.
> Does the regisetr_chrdev function make the device file under /dev directory?
> I am running linux on our embedded system and inside vcs_init,
> register_chrdev is called as below.
>
> int __init vcs_init(void)
> {
> unsigned int i;
> if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
> panic("unable to get major %d for vcs device", VCS_MAJOR);
>
> I can see the function is returning ok but I don't see any vcs* file under
> /dev.
> Does it only register the device on /sys or /proc directory and not under
> /dev?
> Thanks in advance.
>
> Chan
>
>
>
> You have to create a device file using 'mknod'
>
> Ex: mknod -m 666 /dev/vcs c  
>
>
> ___
> 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
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: A new way to dive into the kernel!

2014-03-10 Thread Mandeep Sandhu
Yes.

Just remember to send a plain text mail.

HTH,
-mandeep


On Tue, Mar 11, 2014 at 10:36 AM, sanjeev sharma
 wrote:
> Hello All,
>
> Have you guys getting your assignment's ?
>
> Regards
> Sanjeev Sharma
>
>
> On Wed, Mar 5, 2014 at 10:50 AM, Mallesh Koujalagi
>  wrote:
>>
>> Good info, thanks for sharing
>>
>>
>> On Tue, Mar 4, 2014 at 8:38 PM, Amit Saha  wrote:
>>>
>>> On Wed, Mar 5, 2014 at 2:19 PM, Mandeep Sandhu
>>>  wrote:
>>> > Came across this in Greg (KH)s G+ feed.
>>> >
>>> > http://eudyptula-challenge.org/
>>> >
>>> > Thought I'd share it here too in case someone missed it.
>>> >
>>> > Looks like a fun and interesting way to start off doing stuff in the
>>> > kernel!
>>>
>>> Interesting! Thanks for sharing.
>>>
>>>
>>> --
>>> http://echorand.me
>>>
>>> ___
>>> 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
>>
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Assigning an unique name to USB CDC device in /dev

2014-03-05 Thread Mandeep Sandhu
You need persistent device naming rules in udev.

The udev rules will basically match cretain device attributes you
specify in the rules file and then create device nodes/symlinks for
it. So, first you need to find what those _unique_ attributes are for
your device, and then write it as a udev rule.

See this link for an example on how to do it for usb devices:

http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

Thats just one example. I'm sure there are many howtos out there which
explain how to write udev rules.

HTH,
-mandeep




On Wed, Mar 5, 2014 at 12:18 PM, Srinivas Ganji
 wrote:
> Dear All,
>
> We have a USB CDC device which we are connecting it to the Ubuntu system.
> Then, we are accessing the device using an application by opening the device
> with /dev/ttyACM0 node. The system may have multiple USB CDC devices already
> connected before connecting my device, sometimes. In such cases, my
> application fails to open the device, because, this time the assigned node
> is other than /dev/ttyAMC0, but in my application the device node is
> /dev/ttyAMC0 only. Due to these reasons, I want to assign my own device node
> in the /dev directory like /dev/mydev. This will enable my application to
> identify my device very easily.
>
> The requirement is same as described in the link -
> http://marc.info/?l=linux-usb&m=130216901901572&w=2
> The answer is available at
> http://marc.info/?l=linux-usb&m=130217684009490&w=2
>
> I have tried in different ways as I have also looked at the following
> sources. But, still, there is NO luck. When I insert another USB CDC device,
> it got /dev/ttyACM0 instead of getting ttyACM1.
> http://www.reactivated.net/writing_udev_rules.html
> https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html
> http://unix.stackexchange.com/questions/77476/point-usb-phone-to-specific-dev-ttyacm-using-udev
> https://www.pjrc.com/teensy/49-teensy.rules
>
> The kernel version and distribution details are as follows.
> Kernel Version --- 3.5.0-17-generic
> Distribution details are as follows.
> RELEASE=14
> CODENAME=nadia
> EDITION="MATE 64-bit"
> DESCRIPTION="Linux Mint 14 Nadia"
>
> I have created a file, named 11-ttyACM.rules, under /etc/udev/rules.d
> directory. The contents of the file as follows.
> KERNEL=="ttyAMC0", SUBSYSTEM=="tty", ATTRS{serial}=="__0X00124B000148CC78",
> SYMLINK+="mydev"
>
> I got the above information from the following command
> udevadm info -q all -n /dev/ttyACM0 --attribute-walk
>
> This is what I did. But, no luck. If I insert a different serial numbered
> device, then it is assigning ttyACM0 to that device. But, after this udev
> rule, it should not assign, I think.
>
> Please someone, who already used/knows udev rules, suggest me.
>
> Thanks.
>
> Regards,
> Srinivas.
>
> ___
> 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


A new way to dive into the kernel!

2014-03-04 Thread Mandeep Sandhu
Came across this in Greg (KH)s G+ feed.

http://eudyptula-challenge.org/

Thought I'd share it here too in case someone missed it.

Looks like a fun and interesting way to start off doing stuff in the kernel!

HTH,
-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Updating a driver quirk in kernel

2014-01-29 Thread Mandeep Sandhu
Is this driver loaded as a kernel module? If so, you only need to rebuild
the module against your target kernel and distribute the new module to the
various machines.

If it's a builtin driver, then it'll be a little more involved. If
distributing the new kernel is not feasible have a look at KSplice like
features for hot-patching your kernel.

HTH,
-mandeep



On Wed, Jan 29, 2014 at 12:49 PM, venkat  wrote:

> Os : Debian 6 Kernel Version : 2.6.32
>
> I have been recently working with Linux application and now we have some
> little hard-disk issues where my motherboard doesn't support AHCI
> through bios. On various Google searches i found that i can force Linux
> kernel force load driver to AHCI mode.
>
> i have just now started my kernel walk through and i am very new for
> handling issues.
>
> THS IS THE QUIRK WHICH I FOUND WILL WORK
> :http://tartarus.org/~ds/quirk-ich-force-ahci.patch
> 
>
> I download the kernel and its respective headers and did a complete
> kernel build.since its Debian updated it in the client machine and found
> it was working as expected
>
> linux-image-2.6.32_2.6.32-2_i386.deb -- 26MB
> linux-firmware-image_2.6.32-2_all.deb -- 5k
> but now i need to apply the patch in all my client machines which i
> located n remote locations where 26 mb in the network is very high
>
> Is there a way where only this quirk can be updated in client in a
> reduce size like some KO file update.
>
> Is this the only way way to update the driver?? need some guidelines on
> the same.
>
> i also saw :http://www.cyberciti.biz/faq/add-rem...ernel-modules/
> 
>
> in my case can someone guide me with some pointers how this has to be done
>
> Please guide
>
> --
> Regards
> Venkat.S
>
>
> ___
> 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: kernel driver access application memory

2014-01-16 Thread Mandeep Sandhu
On Wed, Jan 15, 2014 at 11:45 PM, m silverstri <
michael.j.silvers...@gmail.com> wrote:

> Hi,
>
> If my application allocate memory for input and output buffers,  and
> pass the pointer to a kernel driver (via v4l2 queue buffer operation),
> can the kernel driver access it? Do I need to setup DMA before teh
> kernel driver can read/write to it?
>

You can transfer data to & from kernelspace/userspace by using
copy_to/from_user() API.

However, for DMA I think you might also want to lock the user pages in
memory so that they are not invalidated when the owning process is
scheduled out. This is a very high-level gist, but there a lot of resources
out there which show how this can be done.

HTH,
-mandeep



>
> Thank you.
>
> ___
> 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: Recovering Linux system from hung state via software

2013-12-04 Thread Mandeep Sandhu
You could also look at using existing s/w for monitoring processes like monit.

I don't know your exact usecase but you could make your process as a
'service' and have something like systemd or upstart monitor it. These
tools will typically 'restart' the hung process on detection.

-mandeep


On Fri, Nov 29, 2013 at 5:58 AM, Vipul Jain  wrote:
> Hi Kernel alias,
>
> I am a newbie and I am trying to figure out ways where in I can recover the
> Linux in below two scenarios:
> 1. my specific process hangs.
> 2. kernel gets hung partially or completely.
>
> I have done some reading and seems like there is softlockup and hardlockup
> mechanisms in Linux source base that I can use but not sure, if yes I have
> below questions:
> 1. Which kernel version is minimum required for this?
> 2. How do I know that soft and hard lockup are enabled in my kernel?
> 3. How can I customize the behavior of default action that been taken?
> 4. Can I use these two lockup mechanism to find out if my process is hung
> or not?
> 5. Any pointers to any docs that can help will be appreciated.
>
> I will greatly appreciate any help here.
>
>
> Regards,
> Vipul.
>
> ___
> 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: Recovering Linux system from hung state via software

2013-12-04 Thread Mandeep Sandhu
> assuming one mother process is monitoring 10 child process, so inside each
> child process, simply just setup a PERIODIC (eg, per 5 sec) mechanism to
> toggle a binary variables through IPC means.   It will be reset when the
> mother process go around checking all the variable status and, if not reset
> it therefore implies that the particular process might be hung.it can
> wait further, or continue checking other process.   at the end of checking
> ALL the process, if everything is OK, it should feed the kernel watchdog
> timer.   if the kernel watchdog timer is not reset, the kernel module will
> then reboot the system.   (ie, reboot is from kernel module).

Hold on! Why should we reboot the whole system if only some of these
processes are misbehaving?!?! Why should other processes suffer due
this? Wouldn't it be better to just kill the erroneous process (like
how most OS's anyway do, eg: "Force Quit" in Ubuntu, or chrome tabs).

Or are these processes the only ones running on the system?

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Issue while unloading modules via modprobe

2013-12-03 Thread Mandeep Sandhu
> echo $? show 1 (EPERM? most probably, operation not permitted for common
> module).
>

Hmmm...strange. What does 'dmesg' show when this happens? Is anything
related to an error printed there?

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Issue while unloading modules via modprobe

2013-12-03 Thread Mandeep Sandhu
>
> error =  system("modprobe -rv A");
>
> This returns an error = 256.

What does 'perror' show (if anything) ?

Also, if you try the same via a shel, whats the return value ('echo
$?') printed?

BTW, why are you using the '-v' option when invoking modprobe programatically?

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Updating the kernel

2013-11-18 Thread Mandeep Sandhu
Yes, Ksplice offers this feature. Though check with them if your
specific distro is supported. Or if you're compiling your own kernel
then I guess you'll have to send them the new image which they convert
to a reboot-less image which can be applied to a running system.

-mandeep

On Tue, Nov 19, 2013 at 10:55 AM, Shraddha Kamat  wrote:
> Is it possible to keep the kernel updated to upstream without ever
> rebooting the system ? Ksplice ??
>
> Regards,
> Shraddha
>
>
> ___
> 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: Best practice to lock a read/write to a HW register

2013-11-14 Thread Mandeep Sandhu
On Thu, Nov 14, 2013 at 4:02 PM, Luca Ellero  wrote:
> Hi all,
> can someone please show me which is the best practice to lock a
> read/write to a hardware register.
> In other words if, in a driver, I want to modify a bit in a HW register,
> I have to read the register, set/reset the relevant bit and write back
> the reg.
> But what can I do to be sure that no other code modifies the register
> between my read and write?
> Is spin_lock() suitable for this purpose?

If IRQ handlers can touch this register, then I think you'll have to
disable interrupts as well (spin_lock_irq*() ?).

HTH,
-mandep

> Thanks
> Best regards
> Luca
>
>
> ___
> 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: What is the best distro for starting linux kernel development?

2013-11-13 Thread Mandeep Sandhu
> Why not ask him? :-D

Straight from the horse's mouth! :)

-mandeep

PS: Put your fire-retardant suit and fire away on LKML! :P

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What is the best distro for starting linux kernel development?

2013-11-13 Thread Mandeep Sandhu
On Wed, Nov 13, 2013 at 5:00 PM, Anuz Pratap Singh Tomar
 wrote:
> Linus Torvalds and Alan Cox use Fedora(or other redhat distros), though Alan
> talked about shifting to other distros due to his annoyance with Fedora.

Nit -picking here...but Linus does not Fedora...if anything, I think,
he _hates_ Fedora and Gnome (3)! :)

A more informed answer on Quora:
http://www.quora.com/Linux/What-Linux-distribution-does-Linus-Torvalds-use-on-his-MacBook-Air

I saw a G+ post of his where he was very pleased with the Samsung
pixel running ChromeOS. Though that was not for development purpose
(only reading stuff).

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What is the best distro for starting linux kernel development?

2013-11-13 Thread Mandeep Sandhu
On Wed, Nov 13, 2013 at 3:40 PM, Naman Shekhar Mishra
 wrote:
> Hi mentors,
> I have been studying the Linux kernel for some time and now I am going to
> try and get my hands hands dirty with the kernel. Can you please tell me
> what is the best distro for this? I have experience with Gentoo and LFS but

If you're comfortable with Gentoo then I guess you're ready for kernel
development! :P (kidding!) The reason I say this is because I heard
(I've not used Gentoo personally) that you get to build/install all
packages from scratch before using them! :)

You can also have a look at the popular ones like Ubuntu, Fedora or
Mint (dunno much about Mint though). They come with good package
managers and that makes installing stuff easy. So whether you want to
install eg binutils or a new browser or even the kernel sources, the
package manager will help you get all the stuff + it's dependencies.

HTH,
-mandeep


> would they be good if I just want to get involved in  kernel development
> (and not the maintenance overhead that comes with these distros)? It would
> be useful for me if you could tell me the distro you use.
>
> Thanks and regards,
> Naman
>
> ___
> 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: ALIGN MACRO understanding

2013-11-08 Thread Mandeep Sandhu
On Fri, Nov 8, 2013 at 1:53 PM, anish singh  wrote:
> On Nov 6, 2013 10:38 PM, "Mandeep Sandhu"  wrote:
>>
>> On Thu, Nov 7, 2013 at 11:04 AM, sdptr...@gmail.com  
>> wrote:
>> > While going through kernel source , I came across this ALIGN macro
>> >
>> > #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
>> >
>> > and
>> >
>> > #define __ALIGN_KERNEL(x, a)__ALIGN_KERNEL_MASK(x,
>> > (typeof(x))(a) - 1)
>> >
>> > #define __ALIGN_KERNEL_MASK(x, mask)(((x) + (mask)) & ~(mask))
>> >
>> >
>> > What does this macro do? I have read this article
>> > http://stackoverflow.com/questions/13122846/align-macro-kernel but it was
>> > not of much help.
>>
>> Try the above calculation for a small number, and align it to a 4 byte
>> boundary. That'll clear things up as to how this macro is working.
>
> #ALIGN MACRO EXPLANATION
>
> So let me try it:
> What we are looking for is a function or macro
> which can give a aligned result when given any
> input i.e. even if it is already aligned we want to
> give the same number.
>
> align(input_no, align_to)
> align(120,4) = 120 not 124 ---> very important
>
> One way of writing it is keep multiplying 4 repetively
> until you get a number more than 120 i.e. brute force.
>
> Effectively we are looking for next multiple of 4 which
> is greater than the number given.
>
> Second way is to use logic so that we don't need to
> resort to brute force.
> align(120, 4) = 120
> align(121, 4) = 124
> align(122, 4) = 124
> align(123, 4) = 124
>
> 121+?(4) = 125
> so we have 125 and from 125 we can somehow(explained below) get 124.
> 122+?(4) = 126
> so we have 126 and from 126 we can somehow get 124
> 123+?(4) = 127
> so we have 127 and from 127 we can somehow get 124
> 120+?(4) = 124
> so here is the problem, we will return 124 in this case right?
>
> So how do we take care of this condition?
> 120+3 will not crossover to 124 and we can somehow get 120 from 123.
> 121+3=124
> 122+3=125
> 123+3=126
>
> So we are making sure that from one boundary i.e. 120 in this case,
> we are not crossing over to another boundary i.e. 124 when input is 120.
> And how are we doing that is by adding (n-1) and that is the reason
> we don't add n.
> Now the part come of anding with ~(n-1).As Mandeep explained that
> all power of 2 numbers when subtracted with 1 gives the result where
> all MSB bits are set to 1 & LSB set to 0(We use the same logic
> to find out total bits set in a number^^) as below:
> ~(4-1) = 0xFC(1100)
> ~(8-1) = 0xF8(1000)
> 
> 
>
> We know that any number which is a multiple of 4 should have last two
> bits set to 0 right(4 itself is the first multiple of 4 which has last two bit
> set to 0)? Take an example and it would become very clear
> to you.Same thing applies to multiple of 8.
>
> How do we achieve that?So here the comes the ANDING with ~(n-1) because
> if you see {~(4-1) = 1100} this then we have here last two bits set to 0.
> And this is the reason we AND with ~(n-1) so that we can clear last two bits.

I think this is a good point that I did NOT stress enough upon in my
last mail, i.e setting the last 'n' bits to 0 makes the resulting
number a multiple of 2^n.

Now the only thing that the addition further does is that it ensures
that the resulting number is greater than the number we asked the
alignment for BUT less than the next higher multiple of 'n'. So this
basically sets the MSB in the correct position.

>
> If anyone thinks otherwise I would appreciate to add more.

Good explanation!

-mandeep

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALIGN MACRO understanding

2013-11-06 Thread Mandeep Sandhu
On Thu, Nov 7, 2013 at 11:04 AM, sdptr...@gmail.com  wrote:
> While going through kernel source , I came across this ALIGN macro
>
> #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
>
> and
>
> #define __ALIGN_KERNEL(x, a)__ALIGN_KERNEL_MASK(x,
> (typeof(x))(a) - 1)
>
> #define __ALIGN_KERNEL_MASK(x, mask)(((x) + (mask)) & ~(mask))
>
>
> What does this macro do? I have read this article
> http://stackoverflow.com/questions/13122846/align-macro-kernel but it was
> not of much help.

Try the above calculation for a small number, and align it to a 4 byte
boundary. That'll clear things up as to how this macro is working.

So for example, lets align '6' to a '4' byte boundary. This should result in 8.

ALIGN(6, 4) = __ALIGN_KERNEL((6), (4))

__ALIGN_KERNEL(6, 4) =  __ALIGN_KERNEL_MASK(6, (typeof(6)) (4) - 1)

typeof(6) is 'int' & 4 - 1 = 3.

__ALIGN_KERNEL_MASK(6, (int) 3) = (((6) + (3)) & ~(3))

Assuming only 4 bits for simplicity):
6 + 3 = 9 = 1001
~3 = 1100

__ALIGN_KERNEL_MASK(6, (int) 3) = (((6) + (3)) & ~(3)) = 1001 & 1100 = 1000 = 8

Since alignment is a power of 2, subtracting 1 from it sets all bits
after the (original) MSB to 1 (eg: 4 = 100 & 3 = 011).

Adding this 'mask' (3) ensures that the resulting number is at least
larger than the next multiple of 'a' that is greater than x (so in our
case 9 > 8, and 8 is a multiple of 4 which is > 6 (x)).

Now bitwise AND-ing with the 1s compliment of mask ensures that all
bits, except the MSB, will be set to 0, thus resulting in a number
aligned at a multiple of 'a'. In our case, the MSB was set when we did
the addition.

Hope this makes it a little clear.

-mandeep




>
>
> ___
> 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: What to do with branches after submitting patches?

2013-10-11 Thread Mandeep Sandhu
On Fri, Oct 11, 2013 at 3:55 PM, Prabhakar Lad
wrote:

> On Fri, Oct 11, 2013 at 3:55 PM, Prabhakar Lad
>  wrote:
> > On Fri, Oct 11, 2013 at 3:34 PM, Mandeep Sandhu
> >  wrote:
> >>
> >>> >
> >>> > Is it possible to use a github repository and just send a "please
> pull
> >>> > from g...@github.com" message to the kernel mailinglist, or will
> I
> >>> > be beaten for this?
> >>> >
> >>> You cannot directly send a pull request until the patches are reviewed,
> >>> once the the driver maintainer and other folks in the ML are happy, the
> >>> maintainer will pull your patches and get it merged in mainline kernel.
> >>
> >>
> >> If using github, I think send pull requests is a way to initiate a
> review.
> >> It does not mean that that pull request will be merged as-is. As you
> point
> >> out, if there are review comments, the reviewee will address those
> comments
> >> and send another pull request till the reviewer is satisfied. After
> that the
> >> reviewer just has to 'merge' the latest pull request.
> >>
> >
> > For reviewing patches on the mailing list you don't send pull request,
> > ! patches needs
> > to be sent to ML to be reviewed !.
> >
> > For example look at [1] which is pull request to Linus. The pull request
> will
> > just have the patch description(it doesnt have the diff), and the link
> > to pull the patches from. People dont have time to go to your link and
> > review the
> > patches there and reply on your pull request.
> > "So you need to send patches to ML for review and not pull request"
>

As I said above, this is the "github" workflow, not what Linux development
might be using for handling contributions. Submitting patches to LKML might
be the way it's done for Linux. I was merely pointing to the fact that if
using github, pull requests are sufficient for doing reviews.

Hope that clarifies things.

-mandeep
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What to do with branches after submitting patches?

2013-10-11 Thread Mandeep Sandhu
> >
> > Is it possible to use a github repository and just send a "please pull
> > from g...@github.com" message to the kernel mailinglist, or will I
> > be beaten for this?
> >
> You cannot directly send a pull request until the patches are reviewed,
> once the the driver maintainer and other folks in the ML are happy, the
> maintainer will pull your patches and get it merged in mainline kernel.
>

If using github, I think send pull requests is a way to initiate a review.
It does not mean that that pull request will be merged as-is. As you point
out, if there are review comments, the reviewee will address those comments
and send another pull request till the reviewer is satisfied. After that
the reviewer just has to 'merge' the latest pull request.

This, of course, is the github flow, not a general workflow for reviews.

HTH,
-mandeep


>
> Regards,
> --Prabhakar Lad
>
> ___
> 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: Changing location of disk/filesystem cache

2013-10-10 Thread Mandeep Sandhu
On Thu, Oct 10, 2013 at 6:00 PM, Greg Freemyer wrote:

>
>
> Mandeep Sandhu  wrote:
> >On Thu, Oct 10, 2013 at 5:00 PM, Ulka Vaze  wrote:
> >
> >> Hi,
> >> disk cache is same as filesystem  cache. Also called buffer cache.
> >> This is implemneted below fs layer.
> >> It is basically a cache of disk blocks  mainatined in RAM. (In pages)
> >> called buffers.
> >>
> >
> >Ok. So this won't contain "files" but rather "blocks" many of which
> >will
> >represent a single file?
>
> The buffer cache knows nothing about files.  It may happen to contain the
> blocks that correspond to a complete file, but the buffer cache doesn't
> have any way to know that.
>
> >> The purpose of this cache is to improve performance as disk devices
> >are
> >> slow.
> >> You can access this cache from the kernel.
> >> Block layer accesses this from the request structure and commits
> >blocks on
> >> disk.
> >> There are more layers in between like IOschedulers / SCSI etc.
> >>
> >
> >Where does the mapping for file to disk pages/blocks exist? Is it in
> >the
> >inode or dentry entries or something else?
>
> That is a very filesystem dependent question.
>
> In general dentry entries point to inodes and inodes point to blocks of
> pointers.  Those pointers point to actual data blocks.
>
> You need to discuss a specific filesystem type to even start to discuss
> anything specific.
>
> Ie. Does the fat filesystem have an equivalent of inodes?
>
> >> How  does your device accesses files ?
> >>
> >
> >The device itself runs stripped down version of a fairly recent Linux
> >version (3.x). It has DMA capabilities to transfer content to/from the
> >hosts memory from/to it's own.
>
> If 3.x is really current you have 2 more options at least: dm-cache and
> bcache.
>
> I don't know much about either, but they are going to be better options
> for I think than the traditional buffer cache.
> Greg
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>

Ulka, Greg,

Thanks a lot for your inputs.

I have a lot of reading up to do, so I'll come back if have any specific
doubts.

Thanks again.

Regards,
-mandeep
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Changing location of disk/filesystem cache

2013-10-10 Thread Mandeep Sandhu
On Thu, Oct 10, 2013 at 5:00 PM, Ulka Vaze  wrote:

> Hi,
> disk cache is same as filesystem  cache. Also called buffer cache.
> This is implemneted below fs layer.
> It is basically a cache of disk blocks  mainatined in RAM. (In pages)
> called buffers.
>

Ok. So this won't contain "files" but rather "blocks" many of which will
represent a single file?


> The purpose of this cache is to improve performance as disk devices are
> slow.
> You can access this cache from the kernel.
> Block layer accesses this from the request structure and commits blocks on
> disk.
> There are more layers in between like IOschedulers / SCSI etc.
>

Where does the mapping for file to disk pages/blocks exist? Is it in the
inode or dentry entries or something else?


>
> How  does your device accesses files ?
>

The device itself runs stripped down version of a fairly recent Linux
version (3.x). It has DMA capabilities to transfer content to/from the
hosts memory from/to it's own.


> Is it aware of files or you just copy raw data.
>

It can understand both.


> More clarity on this can help.
>

Thanks for your inputs.

Regards,
-mandeep
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Changing location of disk/filesystem cache

2013-10-10 Thread Mandeep Sandhu
Hi All,

I have a newbie question on disk/filesystem caches, so please bear with me!
:)

* Is disk cache the same as filesystem cache? Or there's nothing like a
filesysten cache and all disk I/O, irrespective of what FS is being
accessed, is cached in a "disk cache"?

* Is this caching done at the VFS layer?

* Can the location of a disk cache be changed, i.e instead of caching it in
memory (main RAM) can it be made to cache the files in a specific device?

To give some idea on why I'm asking these questions, I'll explain my
problem a little here (I myself have only started working on it so I don't
have all the details worked out yet).

I'm working on a special device which sits across the PCIe bus and accesses
files (or it's data) and does some processing with it. It transmits this
data out via a special high-speed link to another device (thats some black
hole for me right now). The transmit speed is in the 300-400 Gbps range.
This device also a lot of local memory, which is ~ 80GB.The PCIe interface
however supports transfer speeds which are much lower, i.e in the 5-8 Gbps
range.

In order to reduce latency in transmitting this content, I was thinking if
there's a way to make the disk cache content available in this device's
local memory.

Instead of writing a custom module for that, I was wondering if there
already exists a way in the kernel where a cache device can be specified
and the kernel uses that to store the cached file content?

Any ideas on making the cached content available inside the device are
welcome! :)

Regards,
-mandeep
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: some basic doubts / confusion regarding linux kernel / OS

2013-10-03 Thread Mandeep Sandhu
On Thu, Oct 3, 2013 at 10:38 PM, ajay saini wrote:

> Hi,
>
> I had some confusion/doubts regarding Linux kernel / OS and I want to be
> completely sure that my understanding is right for below, and need your
> inputs (would be really glad for your help):
>
> - There are functions defined in linux kernel. Some of these functions
> have a line "EXPORT_SYMBOL();"  after them.
>These are the functions which are exported, so they can be directly
> called from a linux kernel module - right ? (we just need to include header
> files which define
>them in our kernel module)
>

Yes. They are used during dynamic loading of modules. More here:
http://stackoverflow.com/questions/6670589/use-of-export-symbol


>
> - There are some functions defined in linux kernel, which are not static
> and are not exported, like "migrate_pages" in migrate.c and it is
> mentioned in
>include/linux/migrate.h file.
>Is there a way to call these functions, directly from kernel module ??
> (even if I include the header file) ??
>If no, What is the technique used there, which prevents the module
> from calling this function (even though I have included the header file)??
>

The  compiler? :)


> - We have kernel header files defined in include/linux/ and there are user
> space header files (the C libraries).
> Can a user space program include kernel header file and call a kernel
> function directly?? No , right ??
> Again, what is there which prevents a user space program from doing
> so?? How this technique is implemented ??
>

Kernel fxn's can't be called directly, you'll have to use either the syscal
interface or one of the many (indirect) userspace-kernel communication
mechanisms.

Again, the "technique" here is that you compiler will barf if you try and
use kernel functions directly as it won't find the definitions of those
functions during linking. CMIIW.

HTH,
-mandeep


> - I understand that, a struct page exists for each physical page in RAM.
> And this linked list of struct pages are stored together at the beginning
> of a zone. After this
>   storage, does the real data (content) of pages is stored.
>   Now each of these pages must be pointing to the data area/page which
> they define ? Which is this field in the struct page, which points to this
> data area, a physical
>   address + length of the page ?
>
> Thanks,
> Ajay
>
> ___
> 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: anyone compiling busybox with "arm-eabi-" cross compile toolchain???

2013-09-20 Thread Mandeep Sandhu
On Fri, Sep 20, 2013 at 12:19 PM, sandeep kumar
wrote:

> Hi All
>
> i am facing some build errors with busy box compilation with
> CROSS_COMPILE=arm-eabi-
>
> Busybox version: 1.21.1
>
> Error: In file included from include/libbb.h:13:0,
>  from include/busybox.h:8,
>  from applets/applets.c:9:
> include/platform.h:138:20: fatal error: limits.h: No such file or directory
>
> Looks like i missed some include path..can anyone who tried this help me??
>

Verify if your toolchain dir does indeed have this file (limits.h). Then
check the include paths in the Makefile if they are pointing to the right
dirs.

Most likely your include paths are incorrect. Could be a problem with how
you configured busybox.

HTH,
-mandeep



>
> --
> 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: BSP and the kernel

2013-09-18 Thread Mandeep Sandhu
BSP stands for board support packageso it'll contain stuff to make the
kernel run on that specific h/w (eg: header files detailing the memory map
of the attached devices etc.).

If you have a builtin driver for the attached h/w, then yes, that code will
be compiled into your vmlinux image. If its a module then it might be
outside, depending on whether you've put in some sort of rootfs or not.

HTH,
-mandeep




On Wed, Sep 18, 2013 at 6:10 PM, arun kumar  wrote:

> Does the BSP has any role to play in the kernel build process.
> is the Image "Vmlinux" dependent on BSP in any way?
>
> ___
> 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: Yaffs2 on None-ECC MTD

2013-08-20 Thread Mandeep Sandhu
> Just report back the list:  I've managed to mount root from NFS, by
> which I can use pure Linux way to prepare my root filesystems to yaffs2
> and enable HW ECC in MTD layer only. Then I can ignore the mismatch
> between u-boot and kernel in the ways they handing NAND OOB area.
>

But your boot-loader still needs to read the NAND flash for loading the
kernel image. Won't it be a problem if uboot doesn't understand ECC? What
if some blocks have gone bad, uboot might load a corrupted kernel image.

CMIIW.

-mandeep


> Thanks.
>
> --
> I can't go back to yesterday - because I was a different person then
>
> ___
> 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: Network Driver From Scrach

2013-08-06 Thread Mandeep Sandhu
There's a nice write-up about the n/w stack here:

http://media.wix.com/ugd//295986_a3dcb13a2f46d15cb75abab021a239da.pdf

It'll give you a start in understanding how the packet traverses the stack.

-mandeep



On Tue, Aug 6, 2013 at 10:52 PM, Robert Clove  wrote:

> Hi All,
>
> I want to first understand and then write a network driver for simple
> Ethernet device (actually instead of inbuilt network driver i want to run
> my network driver).
>
> Actually the new driver should have PF_RING enable/support and Net filter
> usage.
> Although we can copy the driver too but i want to understand some driver
> and write my own so that i get clear understanding about network driver.
>
> Now can you please help me how should i proceed?
> First should i see how the packet flows in the kernel or how should i go
> and please provide some good links to study.
>
>
> Thanks
>
>
> ___
> 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: "implicit declaration of " error

2013-07-19 Thread Mandeep Sandhu
On Fri, Jul 19, 2013 at 3:38 PM, Ritesh Ranjan wrote:

> I keep getting "implicit declaration of " error quite
> often. So I'm assuming I am not adding the correct header files when I
> am writing the module.
>
> eg. I wanted to create a kernel thread using
> ktheard_create/kthread_run, but couldn't find which header to include.
> While I was looking for solutions I stumbled upon ctags. It mostly
> gets the job done, but not always. I couldn't find the proper header
> to use for open(inode,file); even though ctags pointed me to
> , I still get the implicit declaration error.
>
> Is there any way of finding exactly which headers to include when one
> is trying to use a function? A detailed explanation would be really
> great.
>

For the specific header:
http://lxr.free-electrons.com/ident?i=kthread_run

Generally, Ctags is pretty good at finding things. In case you're not
getting the right def of a fxn, check the tag list in case there are
multiple functions defined with the same name. I forgot the vi command (I
think it was "ts" or "tl"), but it'll list down the various defs it found
for the fxn. You can then navigate to the specific file of your interest.

HTH,
-mandeep



>
> ___
> 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: Inline Macro issue

2013-07-15 Thread Mandeep Sandhu
On Mon, Jul 15, 2013 at 6:03 PM, Saket Sinha wrote:

> Mandeep:
>
> Even this hasnt helped..though it was a btight idea. :(
>

And what _exact_ error does the compiler give if you use the new (modified)
macro?

The re-def error should not be there as the variable "new1" is within the
local scope now.

-mandeep



>
>
> P.S.-I can give my system on remote via Team Viewer, if you want to try.
>
> Regards,
> Saket Sinha
>
>
> On Mon, Jul 15, 2013 at 5:39 PM, Mandeep Sandhu <
> mandeepsandhu@gmail.com> wrote:
>
>> How about:
>>
>> #define push_root() \
>>  recursive_mutex_lock(&context->id_lock);\
>>  context->uid = current->fsuid;  \
>>  context->gid = current->fsgid;  \
>> do {\
>> struct cred *new1 = prepare_creds();   \
>>
>> //make changes to any member of this structure \
>>
>> commit_creds(new1);\
>> } while(0);
>>
>> HTH,
>>
>> -mandeep
>>
>>
>>
>>
>> On Mon, Jul 15, 2013 at 5:27 PM, Saket Sinha wrote:
>>
>>> Here is the macro
>>>
>>> https://github.com/HeisSpiter/hepunion/blob/master/fs/hepunion/hepunion.h#L393
>>>
>>> Now this driver is at 2.6.18 kernel. I have to upgrade it to 3.8.3.
>>> As I have said
>>> "current" in kernel is a global macro, that always point to the "struct
>>> task_struct * " of the currently executing task (for details on
>>> task_struct, ref Robert Love, pg 24-27).
>>>
>>>
>>> https://github.com/HeisSpiter/hepunion/blob/master/fs/hepunion/hepunion.h#L397
>>>
>>> Now if you look at thse two lines-
>>>
>>> current->fsuid = 0; \
>>> current->fsgid = 0
>>>
>>> Now task struct does not contain fsuid and fsgid, instead you have
>>> struct cred containing fsuid and fsgid.
>>> http://lxr.free-electrons.com/source/include/linux/cred.h#L102
>>>
>>> So normal method is
>>> struct cred *new1;
>>> new1 =prepare_creds();
>>> //make changes to any member of this structure
>>> commit_creds(new1);
>>>
>>> Now this above action I need to perform through a macro, in order to
>>> bring minimal changes to the driver.
>>>
>>> Now, I have told everything. Can someone suggest something that might
>>> work.
>>>
>>> Regards,
>>> Saket Sinha
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Jul 15, 2013 at 5:07 PM, Mandeep Sandhu <
>>> mandeepsandhu@gmail.com> wrote:
>>>
>>>>
>>>> On Mon, Jul 15, 2013 at 4:50 PM, Saket Sinha 
>>>> wrote:
>>>>
>>>>> Mandip:
>>>>> Error is expected error or declaration at the end of input
>>>>>
>>>>
>>>> Without looking at the code, it's difficult to comment further.
>>>>
>>>> Can you attach a small compilable example which exhibits the error?
>>>>
>>>> -mandeep
>>>>
>>>>
>>>>
>>>>>  Anish:
>>>>> that '\' should not be there first of all and even if I put it same
>>>>> error
>>>>>
>>>>>
>>>>
>>>
>>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Inline Macro issue

2013-07-15 Thread Mandeep Sandhu
How about:

#define push_root() \
recursive_mutex_lock(&context->id_lock);\
context->uid = current->fsuid;  \
context->gid = current->fsgid;  \
do {\
struct cred *new1 = prepare_creds();   \
//make changes to any member of this structure \
commit_creds(new1);\
} while(0);

HTH,

-mandeep




On Mon, Jul 15, 2013 at 5:27 PM, Saket Sinha wrote:

> Here is the macro
>
> https://github.com/HeisSpiter/hepunion/blob/master/fs/hepunion/hepunion.h#L393
>
> Now this driver is at 2.6.18 kernel. I have to upgrade it to 3.8.3.
> As I have said
> "current" in kernel is a global macro, that always point to the "struct
> task_struct * " of the currently executing task (for details on
> task_struct, ref Robert Love, pg 24-27).
>
>
> https://github.com/HeisSpiter/hepunion/blob/master/fs/hepunion/hepunion.h#L397
>
> Now if you look at thse two lines-
>
> current->fsuid = 0; \
> current->fsgid = 0
>
> Now task struct does not contain fsuid and fsgid, instead you have
> struct cred containing fsuid and fsgid.
> http://lxr.free-electrons.com/source/include/linux/cred.h#L102
>
> So normal method is
> struct cred *new1;
> new1 =prepare_creds();
> //make changes to any member of this structure
> commit_creds(new1);
>
> Now this above action I need to perform through a macro, in order to bring
> minimal changes to the driver.
>
> Now, I have told everything. Can someone suggest something that might work.
>
> Regards,
> Saket Sinha
>
>
>
>
>
> On Mon, Jul 15, 2013 at 5:07 PM, Mandeep Sandhu <
> mandeepsandhu@gmail.com> wrote:
>
>>
>> On Mon, Jul 15, 2013 at 4:50 PM, Saket Sinha wrote:
>>
>>> Mandip:
>>> Error is expected error or declaration at the end of input
>>>
>>
>> Without looking at the code, it's difficult to comment further.
>>
>> Can you attach a small compilable example which exhibits the error?
>>
>> -mandeep
>>
>>
>>
>>>  Anish:
>>> that '\' should not be there first of all and even if I put it same error
>>>
>>>
>>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Inline Macro issue

2013-07-15 Thread Mandeep Sandhu
On Mon, Jul 15, 2013 at 4:50 PM, Saket Sinha wrote:

> Mandip:
> Error is expected error or declaration at the end of input
>

Without looking at the code, it's difficult to comment further.

Can you attach a small compilable example which exhibits the error?

-mandeep



> Anish:
> that '\' should not be there first of all and even if I put it same error
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Inline Macro issue

2013-07-15 Thread Mandeep Sandhu
On Mon, Jul 15, 2013 at 3:54 PM, Saket Sinha wrote:

> Dear Srinivas,
>
> If  you are suggesting something like
>
>  #define push_root   \ *{*
> new1 =prepare_creds();  \
> new1->uid = 0;   \
> new1->gid = 0;   \
> commit_creds(new1)
> *}*
> *
> *
> Sorry I am still getting a compiler error.
>

What errors is the compiler giving?

Last time you mentioned that it's saying new1 has multiple def's.

Is it possible your macro has a declaration of new1 in it. So if you use
the macro in the same scope, you'll get re-def errors.

You can also try and look at the intermediate file for your source code,
i.e after the pre-processing is done (*.i files).

I don't remember the exact gcc option. Try --save-temps and look at the
.i file.

HTH,
-mandeep



>
> Regards,
> Saket Sinha
> *
> *
>
>
> On Mon, Jul 15, 2013 at 2:25 PM, Srinivas Ganji <
> srinivasganji.ker...@gmail.com> wrote:
>
>> A small suggestion, use begin { and end } braces for declaring your
>> macro. May be I am wrong, but you can try this. Then, the declaration
>> become local to that block.
>>
>> Regards,
>> Srinivas
>>
>>
>> On Mon, Jul 15, 2013 at 1:03 AM, Saket Sinha wrote:
>>
>>> "current" in kernel is a global macro, that always point to the "struct
>>> task_struct * " of the currently executing task (for details on
>>> task_struct, ref Robert Love, pg 24-27).
>>>
>>>  Now I have a macro called push root which has the following purpose-
>>> "to push  root user and group to current context so to set current uid
>>> and gid to 0."
>>>
>>>  Now in kernel 3.8.3, I would do something like
>>>
>>> struct cred *new1;
>>> new1 =prepare_creds();
>>> new1->uid = 0;
>>> new1->gid = 0;
>>> commit_creds(new1);
>>>
>>> So macro definition of push root, according to what I have proposed
>>> above, should be
>>> #define push_root   \
>>> new1 =prepare_creds();  \
>>> new1->uid = 0;   \
>>> new1->gid = 0;   \
>>> commit_creds(new1)
>>>
>>> But I am getting errors like multiple declaration of new1 etc.
>>>
>>> Even if I declare prepare_creds outside macro definition like
>>>
>>> new1 =prepare_creds();
>>> #define push_root   \
>>> new1->uid = 0;   \
>>> new1->gid = 0;   \
>>> commit_creds(new1)
>>>
>>> I think I am  facing the issue that the macros are inlined during
>>> compilation, so when the compiler wants to replace them, it raises issues.
>>>
>>> I could think of two ways to solve this issue-
>>>
>>> 1. define a new macro like #define prep_root() which defines the var
>>> once for all, and that I have to put it at the begin of each function
>>> needing push_root. This is not a very good method.
>>>
>>> 2. I should still try to go with inlined functions but how ?
>>>
>>> Can someone suggest anything
>>>
>>> Regards,
>>> Saket Sinha
>>>
>>> ___
>>> 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
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: forum spam filtering

2013-06-10 Thread Mandeep Sandhu
Thanks Rik!

Will this also filter those pesky LinkedIn invites? :)

-mandeep


On Tue, Jun 11, 2013 at 8:52 AM, Rik van Riel  wrote:

> Over the past year, the forum has deteriorated to the point of being
> unusable.  Today I installed (and fixed) a module that allows phorum
> to use spamassassin, and tweaked & trained spamassassin to deal with
> forum posts (no email headers, etc).
>
> Over the past few hours, I have seen spammers beat their heads against
> the spam filter, sometimes submitting the same message several times
> before giving up.
>
> I have also made a few test posts of my own to the forum. It looks like
> non-spam messages are let through.
>
> In short, the forum should be usable again. If something happens to
> break, please let me know and I will fix it.
>
> http://forum.kernelnewbies.org/
>
> --
> All rights reversed.
>
> ___
> 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


  1   2   >