Re: memblock structure

2016-07-06 Thread Silvan Jegen
On Wed, Jul 06, 2016 at 06:12:50PM +0530, Ronit Halder wrote:
> There are three memblock_type members memory , reserved and physmem in
> memblock structure.
> What is the significance of each member?

According to

https://github.com/0xAX/linux-insides/blob/master/mm/linux-mm-1.md

they describe the type of the memory memory block.


Cheers,

Silvan


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


Re: Kernel panic after insmod

2016-06-27 Thread Silvan Jegen
Am 2016-06-26 18:38, schrieb Aruna Hewapathirane:
> And completely off-topic what are the options for some of us who very 
> much
> wish to attend the Linux conference North America (
> http://events.linuxfoundation.org/events/linuxcon-north-america ) but
> simply cannot afford the standard registration fee of US$950 ?

Let me give you my thoughts on this.

I, too, think the price is rather steep. The reason for that is that the 
Linux Foundation is not expecting individuals to pay the registration 
fee (though I did it before. If you do, I would recommend to first 
become a member of the Linux Foundation because the registration fee 
reductions you get that way pay for the member fee about three times 
over). Rather, it is the company you work for that is expected to pay 
for you going there.


> And I notice Microsoft is a Diamond sponsor ? Interesting !

Probably due to Microsoft profiting off of Linux running on Azure. It's 
a very good thing in any case!


Cheers,

Silvan

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


Re: unable to find function definition

2016-04-26 Thread Silvan Jegen
On Tue, Apr 26, 2016 at 11:24:43AM -0400, valdis.kletni...@vt.edu wrote:
> On Tue, 26 Apr 2016 15:31:51 +0200, Silvan Jegen said:
> 
> > A simple but naive approach would be a grep command like this.
> >
> > grep "function_pointer =" `find . -iname '*.c' -o -iname '*.h'`
> 
> Two better ways:
> 
> grep -r "function_pointer =' [A-Za-z]*
> 
> find * -name '*.[ch]' | xargs grep 'function pointer ='
> 
> Hint 1:  Globbing * rather than . is a win at the top level of the
> kernel source, because * won't match .git, which is a gigabyte or so
> of stuff that you don't want to grep through

Good idea!

There may also be cases where there is no space before the assignment so
using a regexp like this may be better.

grep 'function_pointer ?='


> Hint 2: You want -name rather than -iname because there shouldn't be any
> *.C or *.H files in the tree, and avoiding case-insensitive matches is a bit
> faster.

True, this was mostly muscle memory.


> And another winner if you have a git tree (which of course you should):
> 
> git grep 'function_pointer ='

Looks useful but I hope they did not implement their own version of
grep...


> One gotcha is that in some places, the kernel does evil pre-processor
> stuff like:
> 
> #define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
> #define ATOMIC_LONG_PFX(x)  atomic ## x
> 
> #endif
> 
> #define ATOMIC_LONG_READ_OP(mo) 
> static inline long atomic_long_read##mo(const atomic_long_t *l) { 
>   
> ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l;
>   return 
> (long)ATOMIC_LONG_PFX(_read##mo)(v); }
> ATOMIC_LONG_READ_OP()
> ATOMIC_LONG_READ_OP(_acquire)
> 
> (this example from include/asm-generic/atomic-long.h, but similar ## abuse
> happens elsewhere as well...)

Yeah, I don't think there is much you can do about these cases...


Cheers,

Silvan



signature.asc
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: unable to find function definition

2016-04-26 Thread Silvan Jegen
Am 2016-04-26 14:56, schrieb Jay Aurabind:
> On 26 April 2016 at 16:15, Silvan Jegen  wrote:
>> Am 2016-04-26 10:50, schrieb Gadre Nayan:
>>> 
>>> Ctags can help. Ctags -R on the entire source.
>> 
>> 
>> In the Kernel Makefile there is actually a target for this. It's 
>> called
>> either 'tags' or 'tag' so
>> 
>> make tags [or tag]
>> 
>> should create the ctag file for you.
> 
> I use ctags with vim. Mostly it takes me to declaration of the
> function pointer. Then i go grep for that function and look for its
> assignment. I was wondering if there is some plugin or script which
> can find assignments to such function pointers.

A simple but naive approach would be a grep command like this.

grep "function_pointer =" `find . -iname '*.c' -o -iname '*.h'`


Cheers,

Silvan

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


Re: unable to find function definition

2016-04-26 Thread Silvan Jegen
Am 2016-04-26 10:50, schrieb Gadre Nayan:
> Ctags can help. Ctags -R on the entire source.

In the Kernel Makefile there is actually a target for this. It's called 
either 'tags' or 'tag' so

make tags [or tag]

should create the ctag file for you.


Cheers,

Silvan


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


Re: single, comprehensive kernel data types document?

2016-04-15 Thread Silvan Jegen
Am 2016-04-15 14:37, schrieb John Chludzinski:
> Never use stdint.h? Wasn't that the intent of stdint.h ... for kernel
> code? For embedded code?

I could be wrong about this but the reason for not using it may be that 
there is no standard C library where the Kernel lives. Thus using types 
from stdint.h would be confusing. Also, the string "u16" is much shorter 
than "uint16_t" and thus must surely be faster! :P


Cheers,

Silvan

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


Re: Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version)

2016-03-08 Thread Silvan Jegen
On Tue, Mar 08, 2016 at 11:35:26AM -0800, Greg KH wrote:
> On Tue, Mar 08, 2016 at 08:15:26PM +0100, Silvan Jegen wrote:
> > Heyho
> > 
> > I bought a Mad Catz Fightstick TE2 for Xbox One because I wanted to play
> > some fighting games on Linux. I chose this stick because it has gotten good
> > reviews and I assumed that the Kernel driver should work because there are
> > already drivers for Xbox One controllers in drivers/input/joystick/xpad.c.
> > 
> > It turns out that the driver does not work and dmesg just shows
> > 
> > [12293.077720] usb 1-1.2.1: new full-speed USB device number 9 using 
> > ehci-pci
> > 
> > when plugging it in. Simply adding the line
> > 
> > { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", 0, XTYPE_XBOXONE },
> > 
> > (where the two Hex values are VENDOR_ID and PRODUCT_ID) to xpad_device[]
> > in xpad.c does not help either (which I naively hoped it would).
> 
> Try asking this on the linux-in...@vger.kernel.org mailing list, the
> developers there should be able to help you out better than this one
> can.

Thanks, I will try that! I had a look at the mail archive of linux-input
before sending this one and thought the question may be too newbish...


Cheers,

Silvan


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


Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version)

2016-03-08 Thread Silvan Jegen
Heyho

I bought a Mad Catz Fightstick TE2 for Xbox One because I wanted to play
some fighting games on Linux. I chose this stick because it has gotten good
reviews and I assumed that the Kernel driver should work because there are
already drivers for Xbox One controllers in drivers/input/joystick/xpad.c.

It turns out that the driver does not work and dmesg just shows

[12293.077720] usb 1-1.2.1: new full-speed USB device number 9 using ehci-pci

when plugging it in. Simply adding the line

{ 0x0738, 0x4a01, "Mad Catz FightStick TE 2", 0, XTYPE_XBOXONE },

(where the two Hex values are VENDOR_ID and PRODUCT_ID) to xpad_device[]
in xpad.c does not help either (which I naively hoped it would).

I realized that the stick does not conform to the USB HID interface
after looking more closely at the lsusb -v output (pasted below).


Bus 001 Device 007: ID 0738:4a01 Mad Catz, Inc. 
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass  255 Vendor Specific Class
  bDeviceSubClass   255 Vendor Specific Subclass
  bDeviceProtocol   255 Vendor Specific Protocol
  bMaxPacketSize064
  idVendor   0x0738 Mad Catz, Inc.
  idProduct  0x4a01 
  bcdDevice0.34
  iManufacturer   1 MADCATZ
  iProduct2 FIGHTSTICK
  iSerial 3 BCA2F0E774D2
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   32
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower  200mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass 71 
  bInterfaceProtocol208 
  iInterface  0 
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   4
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   4
Device Status: 0x0002
  (Bus Powered)
  Remote Wakeup Enabled


The Fightstick seems to use a "Vendor Specific Class" and not the HID
interface.

The device is relatively simple having only about 10 buttons and a digital
stick and the Xbox One driver for Windows works for it so xpad.c should
be able to deal with it I assume. Worst case I would have to reverse-
engineer the USB protocol it uses on my Window installation though I
hope that will not be necessary given that the much more sophisticated
Xbox One controller works on Linux already.

What I would like to know is if it is possible to use the xpad.c
infrastructure in this case and maybe some pointers on where to go from
here (I have looked at [0],[1] and [2] but want to check if somebody
has dealt with a similar case already and can give me a hint). Thanks!


Cheers,

Silvan

[0] 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/input?id=refs/tags/v4.5-rc7
[1] https://lwn.net/Kernel/LDD3/
[2] 
http://matthias.vallentin.net/blog/2007/04/writing-a-linux-kernel-driver-for-an-unknown-usb-device/


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


Re: What are the differences between the -next tree and the -mm tree?

2015-12-08 Thread Silvan Jegen
Hi Giovanni

Thanks for these explanations!

Just one correction below.


Am 2015-12-08 11:56, schrieb Giovanni Gherdovich:
> I am not a kernel developer but I think I can answer this.
> 
> This is how I understand it:
> 
> Short version:
> 
> -next is a very special Linux branch managed by Linus Torvalds

I think it is Stephen Rothwell that manages linux-next (look at the 
author of the tags here[0]).


[0] http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git


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


Re: staging: wlan-ng: p80211conv.h: warning I don't understand

2015-11-12 Thread Silvan Jegen
Am 2015-11-12 04:54, schrieb Greg KH:
> On Thu, Nov 12, 2015 at 02:33:07AM +, Gavin O'Leary wrote:
>> Hello all,
>> 
>> I am new to the realm of linux kernel development. I've been sending 
>> in small
>> patches to fix check-patch warnings. I was fixing up the file listed 
>> in the
>> subject when I came across this warning.
>> 
>> drivers/staging/wlan-ng/p80211conv.c:622: WARNING: Possible 
>> unnecessary 'out of
>> memory' message
>> 
>> Source Code:
>> 
>> if (rxmeta == NULL) {
>> netdev_err(wlandev->netdev,
>>"%s: Failed to allocate rxmeta.\n", 
>> wlandev->name);
>> result = 1;
>> goto exit;
>> }
>> 
>> What is this warning about? How do I go about fixing it?
> 
> A "meta" comment, if you don't understand the warning, why would you
> want to do anything about it?

I assume he/she wants to learn and help. Supporting him/her in that 
endeavor is the right thing to do.


Cheers,

Silvan

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


RE: Kernel thread scheduling

2015-04-17 Thread Silvan Jegen
Am 2015-04-16 23:41, schrieb Jeff Haran:
> I often read emails on this list from people looking to help and get
> started in kernel development. Well, here's a good place to start.
> Submit patches to fix some of those Coverity identified kernel bugs.
> Some of them will be false positives, but some of them will be the
> real thing.

I totally agree.

If there are people that do not want to use non-free software for static 
code analysis (even as a service) they can instead go for smatch[0]. 
Smatch is part of the 0-day Kernel test infrastructure[1] of Intel and 
is open source software.

I've written a short blog post on how to use smatch here[2]. Any 
feedback and/or criticism would be appreciated.


Cheers,

Silvan

[0] http://smatch.sourceforge.net/
[1] https://lists.01.org/mailman/listinfo/kbuild
[2] http://sillymon.ch/posts/smatchusage.html

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


Re: Kernel thread scheduling

2015-04-16 Thread Silvan Jegen
On Thu, Apr 16, 2015 at 02:42:07PM -0400, Ruben Safir wrote:
> On 04/16/2015 02:32 PM, John de la Garza wrote:
> > On Thu, Apr 16, 2015 at 10:56:46AM -0400, Ruben Safir wrote:
> >> I'm trying to find rb_node's structure and I can't find it with ctags or
> >> in the http://lxr.linux.no website.
> >>
> >>
> >> How do you search these things out?
> > 
> 
> 
> That is truly beautiful.  Is that documented anywhere in plain english?

If you mean the tag search functionality, yes. See below.


> > I run:
> > make ctags

Documentation for this you can find by running "make help" at the root
of the Kernel source tree.


> > run vim
> > 
> > type:
> > :ts rb_node

This functionality is documented in Vim itself. To access the relevant
documentation just run

:help tags

There is also the "cscope" program that can give you information about
which functions call and are being called by which other functions. It
has its own man page.


Cheers,

Silvan

> > 
> > then I scanned the list for things that are from include/linux
> > 
> > and found this
> >  20 F   srb_node   include/linux/rbtree.h
> >struct rb_node {
> > 
> > I select 20 and it takes me to include/linux/rbtree.h
> > 
> > and puts me at the line containing this:
> > 
> > struct rb_node {
> > unsigned long  __rb_parent_color;
> > struct rb_node *rb_right;
> > struct rb_node *rb_left;
> > } __attribute__((aligned(sizeof(long;
> >   /* The alignment might seem pointless, but allegedly CRIS needs it */
> > 
> > ___
> > 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: Download patch from email.

2015-02-15 Thread Silvan Jegen
On Sun, Feb 15, 2015 at 08:11:51AM +0200, Elazar Leibovich wrote:
> I use "|".
> 
> $ cd ~/linux-source
> $ mutt
> (select email with patch)
> |git am
> 
> Git applies the patch to the current directory

Ah, I knew about '|' but I did not know that git am can read from stdin
as well, nice!


> Last note, from gmail, one can use the "show original" menu item, and
> save/copy-paste the text from there. git am would understand that.

Yes, I do that when I am not on my computer... I think all webmail
clients I have used do have a 'Show original' (or similar) option whose
text you can just copy paste.


Cheers,

Silvan


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


Re: Download patch from email.

2015-02-14 Thread Silvan Jegen
On Sat, Feb 14, 2015 at 03:48:53AM +, Anand Moon wrote:
> I have configured mutt as email client.
> 
> https://github.com/narkoleptik/dotfiles/blob/master/.muttrc
> 
> But my configuration don't allow me to download Linux patch's from
> email.

I use mutt's standard functionality to get patches from emails which I
did not have to configure IIRC. Depending on whether the patches have
been sent inline (within the email text itself) or attached to the email
I use two different methods.

Inline patches:
I use 'C' (if there are multiple patches you can tag all the mail
messages first and then use ';C') to copy all the mail messages to a
mailbox file. This mailbox file can then be read by the 'git am' command
which applies all the patches (including the commit messages) to your
git tree.

Attached patches:
Select the mail message, click 'v' and save the attached patches to disk
with 's'.

Hope that helps. I would like to hear if other people have more
efficient workflows (using custom scripts for example)!


Cheers,

Silvan


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


Re: New member

2015-01-26 Thread Silvan Jegen
Am 2015-01-26 04:45, schrieb valdis.kletni...@vt.edu:
> On Sun, 25 Jan 2015 16:29:00 -0800, "Robert P. J. Day" said:
> 
>>   what's wrong with ftrace? but seriously, you know what newcomers
>> might get some value out of doing if they want to contribute? writing
>> some really, really good documentation or tutorials.
> 
> If somebody were to do a really good "Top 25 perf/ftrace 
> tricks/recipes"
> for the best incantations for common use cases, they'd have a hard time
> buying themselves a beer at a gathering of Linux geeks. ;)

Actually, I was interested in writing something along these lines but in 
practice, Brendan Gregg (who is amazing) probably has you covered.

http://www.brendangregg.com/linuxperf.html


Cheers,

Silvan

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


Re: How to use git-send-email for deep threading

2015-01-19 Thread Silvan Jegen
Am 2015-01-19 09:20, schrieb Sunil Shahu:
> Two Solution Files (Makefile and .c driver file)
> └─> [PATCH 01/02] Patch 1 on earlier solution file
> └─> [PATCH 02/02] Patch 2 on earlier solution file
> 
> I tired using different options in git send-email, but what I get is
> incorrect linking of mails.
> Two Solution Files (Makefile and .c driver file)
> [PATCH 01/02] Patch 1 on earlier solution file
>      └─> [PATCH 02/02] Patch 2 on earlier solution file
> I am not able to send two files using git send-email for the first
> email. I have to use --force to send any source file. Even in this,
> only first file is attached in mail.

You should not attach patches to your mails but send them inline.


> I also tried send first file using web browser mail client and then
> sending patches using git send-email, but it also do not work as
> expected.
> I have read git-send-email documentation but not able to comprehend
> how I can achieve my requirement from it. Can someone please give
> pointers on how I can send email correctly as per my requirement using
> git-send-email?

In general, you should be using git format-patch to prepare your patches 
to be sent by git send-email. The git-format-patch(1) man page should be 
helpful.


Cheers,

Silvan

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


Re: Contributing via kernel-janitors

2015-01-16 Thread Silvan Jegen
Hi

Am 2015-01-14 17:07, schrieb Dr. George E. Moore:
> I'm certainly willing to lend my support to this work; hwever, I could
> use some guidance.

Another way to contribute is to run the smatch C static code analyzer 
tool on the Kernel which you can find here

http://smatch.sourceforge.net/

There are thousands of issues being reported (of which quite a lot are 
false positives, mind you).


Cheers,

Silvan

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


Re: broken network connection

2014-11-07 Thread Silvan Jegen
Am 2014-11-06 22:30, schrieb Jim Davis:
> On Thu, Nov 6, 2014 at 2:07 PM, Grzegorz Dwornicki  
> wrote:
> 
>> To do this I'm using ctrl+c on host 2. What functions are
>> called to clean broken socket on host 1? What functions are called to
>> clean up socket on host 2?
> 
> Have you tried running strace on the nc processes?

Additionally you can use the Kernel's ftrace[0] functionality to figure 
out which functions are being called in the kernel (instead of getting 
only the system calls returned like with strace).


[0] https://www.kernel.org/doc/Documentation/trace/ftrace.txt

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


RE: lots of connections in SYN_RECV state

2014-11-06 Thread Silvan Jegen
2014-11-06 16:15,Puneet Agarwal:
> Is there a way to check the reason, why they do not answer to the 
> SYN-ACK's?

I don't think so. After all, they just don't answer and they won't tell 
you why (AFAIK there is no way to ask them why either)...

You could try to check for patterns in the incoming IP addresses to see 
from how many different places these connections are being made. I think 
that way it should be possible to figure out from which geographic 
location these problematic connections are coming from as well. What you 
would do with these findings I am not sure though.

If these connection negatively impact the performance of your servers 
you should definitely look into to countermeasures mentioned in the RFC 
here.

http://tools.ietf.org/html/rfc4987


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


Re: lots of connections in SYN_RECV state

2014-11-06 Thread Silvan Jegen
Hi

Am 2014-11-06 14:27, schrieb Puneet Agarwal:
> I have a couple of servers, for the past few days I am seeing lots of
> connections in SYN_RECV state in netstat commands output.

This *could* be the result of a SYN-flood attack on your server.


> Is there a solution to this problem?

The Wikipedia page mentions some countermeasures (if it indeed is an 
attack and not a networking stack issue).

http://en.wikipedia.org/wiki/SYN_flood

Maybe you could check from which IP addresses these SYNs come from and 
investigate why they do not answer to the SYN-ACK request of your 
server.


Cheers,

Silvan

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