WARNING: at net/ipv4/tcp.c

2015-04-20 Thread Abhijeet Bhatikar
Hello,

 

I am getting this trace from my driver which I ported from 2.6.32-431 to
3.10.0-123 kernel.

The driver works just fine on 2.6.32-431 kernel but not on 3.10.0-123 after
porting.

Ping works fine on 3.10.0-123 but I get this trace when I run ssh or tcp
traffic.

Please find the attached wireshark traces of both machines in between ssh
was tried.

Please help.

 

Patch:

 

--- a/src/kernel/xyvnic/xyvnic.c

+++ b/src/kernel/xyvnic/xyvnic.c

@@ -230,7 +230,11 @@ xyvnic_worker_thread(void *arg)

 * Once unconditional, we will always notify when
the

 * link returns (and when we restart the driver).

 */

+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0))

netif_notify_peers(sp->dev);

+#else

+   netdev_notify_peers(sp->dev);

+#endif

/*

 *  You may get a series of:

 *  NOHZ: local_softirq_pending

@@ -429,7 +433,11 @@ xyvnic_probe(void)

dev->netdev_ops = &xyvnic_netdev_ops;

dev->mtu = STUB_MTU;

dev->hard_header_len = ETH_HLEN + 2;

+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))

dev->features = NETIF_F_NO_CSUM;

+#else

+   dev->features = NETIF_F_HW_CSUM;

+#endif

netif_napi_add(dev, &sp->napi, xyvnic_poll, 256);

SET_ETHTOOL_OPS(dev, &xyvnic_ethtool_ops);

 

Trace:

 

[ 8904.486918] [ cut here ]

[ 8904.492910] WARNING: at net/ipv4/tcp.c:1669 tcp_recvmsg+0xd1c/0xe90()

[ 8904.500614] recvmsg bug 2: copied AFA498B3 seq AFA498B3 rcvnxt AFA49EDC
fl 0

[ 8904.508914] Modules linked in: fuse btrfs zlib_deflate raid6_pq xor vfat
msdos fat ext4 mbcache jbd2 binfmt_misc bridge stp llc xyvnic(POF)
xybridge(POF) sg nfsv3 nfs fscache iTCO_wdt iTCO_vendor_support raid1
dm_mirror dm_region_hash dm_log dm_mod coretemp kvm_intel ipmi_devintf kvm
crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul
sb_edac glue_helper ablk_helper lpc_ich ses cryptd i2c_i801 pcspkr edac_core
mfd_core enclosure ioatdma ipmi_si ipmi_msghandler shpchp acpi_cpufreq wmi
mperf acpi_pad nfsd auth_rpcgss nfs_acl lockd sunrpc xfs libcrc32c sd_mod
sr_mod cdrom crc_t10dif crct10dif_common mlx4_en usb_storage ast syscopyarea
sysfillrect ixgbe sysimgblt i2c_algo_bit drm_kms_helper ttm mdio ahci e1000e
libahci dca drm mpt3sas ptp crc32c_intel libata mlx4_core i2c_core

[ 8904.588598]  raid_class pps_core scsi_transport_sas

[ 8904.593575] CPU: 2 PID: 26342 Comm: ssh Tainted: PF   W
O--   3.10.0-123.20.1.el7.6.xrs7.x86_64 #1

[ 8904.605399] Hardware name: Seagate CS6000AC/Type2 - Board Product Summit
Point, BIOS SummitPoint.v03.0005 12/12/2014

[ 8904.617329]  880451583c18 eae1daff 880451583bd0
815e2b0c

[ 8904.626232]  880451583c08 8105dee1 880464f16100


[ 8904.635139]  88045b0c 88045b0aa610 
880451583c70

[ 8904.644060] Call Trace:

[ 8904.647954]  [] dump_stack+0x19/0x1b

[ 8904.654551]  [] warn_slowpath_common+0x61/0x80

[ 8904.662017]  [] warn_slowpath_fmt+0x5c/0x80

[ 8904.669200]  [] ? _raw_spin_lock_bh+0x12/0x50

[ 8904.676556]  [] tcp_recvmsg+0xd1c/0xe90

[ 8904.683359]  [] inet_recvmsg+0x7b/0xa0

[ 8904.690037]  [] sock_aio_read.part.7+0x146/0x160

[ 8904.697559]  [] ? set_fd_set+0x21/0x30

[ 8904.704183]  [] sock_aio_read+0x21/0x30

[ 8904.710855]  [] do_sync_read+0x8d/0xd0

[ 8904.717411]  [] vfs_read+0x145/0x170

[ 8904.723752]  [] SyS_read+0x58/0xb0

[ 8904.729891]  [] system_call_fastpath+0x16/0x1b

[ 8904.737044] ---[ end trace e338b9f1a546ee37 ]---

[ 8904.742782] [ cut here ]

[ 8904.748524] WARNING: at net/ipv4/tcp.c:1657 tcp_recvmsg+0x4f7/0xe90()

[ 8904.756103] recvmsg bug: copied AFA498B3 seq AFA49EB3 rcvnxt AFA49EDC fl
0

[ 8904.764108] Modules linked in: fuse btrfs zlib_deflate raid6_pq xor vfat
msdos fat ext4 mbcache jbd2 binfmt_misc bridge stp llc xyvnic(POF)
xybridge(POF) sg nfsv3 nfs fscache iTCO_wdt iTCO_vendor_support raid1
dm_mirror dm_region_hash dm_log dm_mod coretemp kvm_intel ipmi_devintf kvm
crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul
sb_edac glue_helper ablk_helper lpc_ich ses cryptd i2c_i801 pcspkr edac_core
mfd_core enclosure ioatdma ipmi_si ipmi_msghandler shpchp acpi_cpufreq wmi
mperf acpi_pad nfsd auth_rpcgss nfs_acl lockd sunrpc xfs libcrc32c sd_mod
sr_mod cdrom crc_t10dif crct10dif_common mlx4_en usb_storage ast syscopyarea
sysfillrect ixgbe sysimgblt i2c_algo_bit drm_kms_helper ttm mdio ahci e1000e
libahci dca drm mpt3sas ptp crc32c_intel libata mlx4_core i2c_core

[ 8904.843667]  raid_class pps_core scsi_transport_sas

[ 8904.848645] CPU: 2 PID: 26342 Comm: ssh Tainted: PF   W
O--   3.10.0-123.20.1.el7.6.xrs7.x86_64 #1

[ 8904.860468] Hardware name: Seagate CS6000AC/Type2 - Board Product Summit
Point, BIOS SummitPo

Re: process tracking

2015-04-20 Thread Ruben Safir
On Mon, Apr 20, 2015 at 11:58:17PM +0200, Mustafa Hussain wrote:
> I have reading recently how CFS works and I want to detect processes that
> is not used and have the policy SCHED_NORMAL,
> 
> Can i do this by tracking load_weight for each process if the load dose not
> change over the time can i consider this process is not used ?

it has nothing to do with the load_weight.  I can be corrected on this
but it is configuration.

There are functions that can be coded that adjust the class of priority
for a thread or process such as 

/**
 * sched_setscheduler - change the scheduling policy and/or RT priority
 * of a thread.
 * @p: the task in question.
 * @policy: new policy.
 * @param: structure containing the new RT priority.
 *
 * Return: 0 on success. An error code otherwise.
 *
 * NOTE that the task may be already dead.
 */
int sched_setscheduler(struct task_struct *p, int policy,
   const struct sched_param *param)
{
return _sched_setscheduler(p, policy, param, true);
}
EXPORT_SYMBOL_GPL(sched_setscheduler);

in linux/kernel.sched/core.c


download the Kernel Source Code and take a look

Ruben


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


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


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


Re: Achieve multi-threading in MIPS assembly

2015-04-20 Thread Valdis . Kletnieks
On Tue, 21 Apr 2015 01:05:19 -, "Chaturvedi, Akash" said:

> I am writing MIPS assembly code for a 'Word guessing game'.

Why?

gcc -O2 will almost certainly generate faster code than you can (unless you're
*really* good at MIPS assembler, in which case you wouldn't have posted).


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


Achieve multi-threading in MIPS assembly

2015-04-20 Thread Chaturvedi, Akash
Greetings All,


I am writing MIPS assembly code for a 'Word guessing game'. I want to play a 
background music in the game at the time user plays. I am using MARS emulator 
for running and testing my code.


As I need to do two task at the same time (game instructions and play music). 
Can someone please help me in achieving multi-threading using MIPS instructions 
(Like pthread_create in C). Or if there another way I can do two task 
simultaneously in MIPS assembly.


Thanks,
Akash
UT Dallas
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How do _you_ read the linux source?

2015-04-20 Thread Miles Fidelman
Robert P. J. Day wrote:
> On Sun, 19 Apr 2015, nick wrote:
>
>> On 2015-04-19 09:57 PM, r0...@simplecpu.com wrote:
>>> The following question gets asked a lot, "I know C, but reading the
>>> kernel source is hard, what should I do?" and the common response is 
>>> "ctags."
>>> It's a lot like asking "how can I build a house?" and receiving the response
>>> "screwdriver."
>>> There is obviously more to it then learning C and installing ctags.
>>> As a newbie myself, I recently had to overcome this problem, Here's what I
>>> did:
> ... snip ...
>
>>> The problem a lot of newbies are having is in 'separating the trunk
>>> from the leaves.' So my question is this: Experienced kernel developers, how
>>> do _you_ read source code? How do you separate the trunk from the leaves?
>>> What do you do when you read code you're not familiar with? How do you 
>>> learn?
>>> What's your algorithm?
>*sigh* ... this is the wrong question, in the same way that asking,
> "how do i start writing kernel code?" is the wrong question. someone
> once made the brilliant analogy that asking how to start contributing
> to the kernel is akin to asking, "i want to write a book ... what
> should i write about?" if you don't already know what interests you,
> no one else can help you start writing.



Maybe it's the wrong question, but it's sure stimulating a lot of good 
(as in informative) answers.

Miles Fidelman



-- 
In theory, there is no difference between theory and practice.
In practice, there is.    Yogi Berra


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


Re: How do _you_ read the linux source?

2015-04-20 Thread r00nk
> On Sun, 19 Apr 2015, nick wrote:
>
>> On 2015-04-19 09:57 PM, r0...@simplecpu.com wrote:
>> >The problem a lot of newbies are having is in 'separating the trunk
>> > from the leaves.' So my question is this: Experienced kernel
>> developers, how
>> > do _you_ read source code? How do you separate the trunk from the
>> leaves?
>> > What do you do when you read code you're not familiar with? How do you
>> learn?
>> > What's your algorithm?
>
>   *sigh* ... this is the wrong question, in the same way that asking,
> "how do i start writing kernel code?" is the wrong question...

How to start isn't what I'm trying to ask. Like, if this were
mountain climbing, I'm not asking how to start climbing. I've
gotten to the point where I've developed my own technique to climb,
now I'm asking others how they climb, so I can learn/improve my own
technique based on theirs.

>   it seems that there is a regular supply of posters whose opening
> question is something like, "i'm interested in the kernel ... how do i
> get started?" i submit that it's not the mandate of this list to
> answer that question. rather, i submit that it's the mandate of this
> list to answer questions you have *after* you get started and have
> shown that you've invested the time to dig in on your own.

Right, I'm not asking how to get started, I'm asking how you (not I)
go about digging, to see if your method is better then mine. I have
already done a fair amount of digging myself (knock on wood).

I think that meta-cognition is a important part of any skill set.
I'm trying to learn the way skilled kernel developers think, because
learning how skilled people think generally leads into valuable
insights for that said skill.

In my (admittedly small) personal experience, trying to get an idea
of how kernel developers think is difficult. There are a few places
that sort of do it (Documentation/CodingStyle, Documentation/*, lkml),
but those are a bit more geared to management then skill.
I figured rather then trying to parse those and come up with a model
that probably isn't true, I'd just directly ask. I dunno. Maybe its
not an appropriate question for this mailing list.


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


Re: How do _you_ read the linux source?

2015-04-20 Thread Ruben Safir
On Tue, Apr 21, 2015 at 02:16:49AM +0200, Milton Krutt wrote:
> > On Sun, Apr 19, 2015 at 06:57:49PM -0700, r0...@simplecpu.com wrote:
> > >   The problem a lot of newbies are having is in 'separating the trunk
> > > from the leaves.' So my question is this: Experienced kernel developers, 
> > > how
> > > do _you_ read source code? How do you separate the trunk from the leaves?
> > > What do you do when you read code you're not familiar with? How do you 
> > > learn?
> > > What's your algorithm?
> 
> Maybe it could help to firstly focus on data structures/types rather than 
> functions;
> and I would discourage to read code like a book, I mean from left to right and
> from top to bottom. And, take a subsystem/part (even if it's very small) of 
> interest
> and just focus on it. For instance, I guess there is plenty of documentation 
> on how
> linux boots up: read it, and search through the source where what you have 
> read is done.
> 


Booting is so messed up that it might not be the place to start.  Asking
how to read the code is a non-sensible question.  Its like asking how do
you speak French.  The answer is, I speak it.  You don't know how to
speak it?  Well staring at incomrehesible code aint helping you any.

It requires one to interact with it, and that requires background.  

So the question is, I just do and if I can't understand it I roll up my
sleeves and research, ask, discuss, and work with it.

There is no forrest... there is no trees.  

> compile your own kernel, if you haven't done it yet!
> 
> HTH
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


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


Re: How do _you_ read the linux source?

2015-04-20 Thread Milton Krutt
> On Sun, Apr 19, 2015 at 06:57:49PM -0700, r0...@simplecpu.com wrote:
> > The problem a lot of newbies are having is in 'separating the trunk
> > from the leaves.' So my question is this: Experienced kernel developers, how
> > do _you_ read source code? How do you separate the trunk from the leaves?
> > What do you do when you read code you're not familiar with? How do you 
> > learn?
> > What's your algorithm?

Maybe it could help to firstly focus on data structures/types rather than 
functions;
and I would discourage to read code like a book, I mean from left to right and
from top to bottom. And, take a subsystem/part (even if it's very small) of 
interest
and just focus on it. For instance, I guess there is plenty of documentation on 
how
linux boots up: read it, and search through the source where what you have read 
is done.

compile your own kernel, if you haven't done it yet!

HTH

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


process tracking

2015-04-20 Thread Mustafa Hussain
I have reading recently how CFS works and I want to detect processes that
is not used and have the policy SCHED_NORMAL,

Can i do this by tracking load_weight for each process if the load dose not
change over the time can i consider this process is not used ?
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Write and understand Assembly code in .S file for ARM

2015-04-20 Thread John de la Garza
On Sun, Apr 19, 2015 at 05:46:20PM +0530, harshkdev wrote:
> Hi,
> 
> Please refer some online tutorials or pdf books to write and understand 
> assembly code written in .S file.

this helped me:

http://thinkingeek.com/2013/01/09/arm-assembler-raspberry-pi-chapter-1/

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


Re: How do _you_ read the linux source?

2015-04-20 Thread Ruben Safir
On 04/20/2015 12:32 PM, Jeff Haran wrote:
> I'll put in another plug for Coverity's source code browser here.
> 
> https://scan.coverity.com/
> 
> To use it you need to sign-up for an account, but that is free and it's much 
> better for browsing large projects than ctags, cscope, grep, etc., IMHO.


if you want to learn nothing and sit behind a proprietary software wall
to access your free software.



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


RE: How do _you_ read the linux source?

2015-04-20 Thread Jeff Haran
> -Original Message-
> From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-
> boun...@kernelnewbies.org] On Behalf Of r0...@simplecpu.com
> Sent: Sunday, April 19, 2015 6:58 PM
> To: kernelnewbies@kernelnewbies.org
> Subject: How do _you_ read the linux source?
> 
> The following question gets asked a lot, "I know C, but reading the kernel
> source is hard, what should I do?" and the common response is "ctags."
> It's a lot like asking "how can I build a house?" and receiving the response
> "screwdriver."

I'll put in another plug for Coverity's source code browser here.

https://scan.coverity.com/

To use it you need to sign-up for an account, but that is free and it's much 
better for browsing large projects than ctags, cscope, grep, etc., IMHO.

Jeff Haran


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


Re: Question about assembly in set bit function for x86 architecture

2015-04-20 Thread Bjørn Mork
valdis.kletni...@vt.edu writes:
> On Sun, 19 Apr 2015 19:08:17 -0400, Nicholas Krause said:
>
>> The reason I am asking is that is assembly worth my time to learn for this
>> part of the kernel, I understand  it's use in boot code but outside of that 
>> and
>> cache memory lines in architecture directories there is very little, 95 
>> percent
>> of the kernel is written in C.  In addition due to this the only practical
>> reason I  can thing of is for debugging,  how useful is assembly for kernel
>> debugging is my other question about this topic.
>
> We're not going to bail you out here, Nick.  Either learn enough assembly
> to answer your question, or don't obsess over one line of code and assume
> it works.

It's not necessary to limit this advice by language or specific lines of
code.

NO part of the kernel can be understood without investing some time
trying to learn. But fear not - there is a shortcut available for those
(assuming there might be more than one) who refuse to learn:

  Assume it works.


OK, I'll admit taking that route more than once myself :-)


Bjørn 

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


RE: Question about assembly in set bit function for x86 architecture

2015-04-20 Thread Jeff Haran
> -Original Message-
> From: kernelnewbies-bounces+jharan=bytemobile@kernelnewbies.org
> [mailto:kernelnewbies-
> bounces+jharan=bytemobile@kernelnewbies.org] On Behalf Of nick
> Sent: Sunday, April 19, 2015 1:51 PM
> To: kernelnewbies
> Subject: Question about assembly in set bit function for x86 architecture
> 
> Greetings All,
> I am wondering what the below code in the asm modifier does:
> static inline void set_bit(int nr, void *addr) {
>  asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr)); } This would be 
> very
> helpful as I am new to  x86 assembly and don't even known what
> register(s)/instruction(s) this touches and therefore this is impossible for 
> me
> to look up in the Intel Manuals. If someone either tells me the
> registers/instructions this uses or explains the code that would be very
> helpful.
> Nick

You are dealing with 2 levels of complexity here. First, there's what the 
actual generated assembly code is doing. For that you'll want to get the Intel 
manuals but you can get started with the Wikipedia on x86 assembly. Be 
forewarned, there's two different standards for the syntax here, AT&T's and 
Intel's, so you'll want to become familiar with the differences between them so 
you know which one you are reading.

The second level is the embedded assembly-in-C syntax, which is the glue that 
links C to assembly. What I do whenever I need to read this stuff is I go ahead 
and compile the code in question then use objdump -S on the .o file to dump the 
assembly intermixed with the C source. That means I don't have to decipher what 
that second level is doing. With the original C source and the generated 
assembly, I can usually figure out what it's doing.

Jeff Haran


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


Re: Question about assembly in set bit function for x86 architecture

2015-04-20 Thread Valdis . Kletnieks
On Sun, 19 Apr 2015 19:08:17 -0400, Nicholas Krause said:

> The reason I am asking is that is assembly worth my time to learn for this
> part of the kernel, I understand  it's use in boot code but outside of that 
> and
> cache memory lines in architecture directories there is very little, 95 
> percent
> of the kernel is written in C.  In addition due to this the only practical
> reason I  can thing of is for debugging,  how useful is assembly for kernel
> debugging is my other question about this topic.

We're not going to bail you out here, Nick.  Either learn enough assembly
to answer your question, or don't obsess over one line of code and assume
it works.



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


Re: How do _you_ read the linux source?

2015-04-20 Thread Valdis . Kletnieks
On Mon, 20 Apr 2015 07:45:37 +0200, Christoffer Holmstedt said:

> Thank you Nick, I'm just getting started with linux kernel development
> and have been looking around for books both more general and specific
> to networking. One thing in common several books I've found have is
> that they are based on the 2.6 version of the kernel (or older). Some
> parts have changed but are entire chapters in the above mentioned
> books too old to make sense when working on version linux kernel 4.1
> and beyond?

The details have changed.  The basic concepts haven't.  In fact, the *basic*
concepts change so slowly that reading Bach's book on the SYSV kernel or
McKusic & Liefler on the BSD kernel will teach you a lot.

In fact, I'll go out on a limb and say that reading how *other* systems have
solved the same issues is a Good Thing. Knowing just "Linux solved it this way"
is one thing, but knowing "Linux solved it this way, but BSD took a different
approach because X, and IBM's VM/SP did Y instead to avoid the issue entirely"
is a whole different level of understanding.


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


Re: How do _you_ read the linux source?

2015-04-20 Thread Greg KH
On Sun, Apr 19, 2015 at 06:57:49PM -0700, r0...@simplecpu.com wrote:
>   The problem a lot of newbies are having is in 'separating the trunk
> from the leaves.' So my question is this: Experienced kernel developers, how
> do _you_ read source code? How do you separate the trunk from the leaves?
> What do you do when you read code you're not familiar with? How do you learn?
> What's your algorithm?

I print out the source code, using a huge font as to take up lots of
space, bind it all together, and relax in a bathtub full of warm bubbles
and drink wine while reading the code and scribbling comments in the
margins with a colored soap shard.  After falling asleep due to the wine
and warm bath, wake up in a few hours freezing cold, surrounded by soggy
pieces of paper with all of the ink washed off.  But my brain has
absorbed it all and I can then resume coding from where I left off.



I use vgrep[1], that's it, no ctags needed.

Reality isn't romantic, there is no magic solution to hard tasks.

greg k-h

[1] https://github.com/vrothberg/vgrep

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


Re: How do _you_ read the linux source?

2015-04-20 Thread nick


On 2015-04-20 01:45 AM, Christoffer Holmstedt wrote:
> 2015-04-20 5:11 GMT+02:00 nick :
>> There were a few things I did when starting to learn the kernel
>> 1. Read Robert Love's Linux Kernel Development, I don't care how much you 
>> think
>> you known about the kernel read and trace the actual kernel code with this 
>> book!!
>> 2.Read a book on device drivers and the Linux networking stack, I
>> read Linux networking internals for this
> 
> Thank you Nick, I'm just getting started with linux kernel development
> and have been looking around for books both more general and specific
> to networking. One thing in common several books I've found have is
> that they are based on the 2.6 version of the kernel (or older). Some
> parts have changed but are entire chapters in the above mentioned
> books too old to make sense when working on version linux kernel 4.1
> and beyond?
> 
What you need to do is look at the source code and see what has changed this 
writing
of the book. This is what I do when reading kernel programming books or 
documentation.
Further more around way is to read the logs of the networking mailing lists for 
the
kernel to see what has changed recently.
Nick

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


Re: How do _you_ read the linux source?

2015-04-20 Thread Robert P. J. Day
On Sun, 19 Apr 2015, nick wrote:

> On 2015-04-19 09:57 PM, r0...@simplecpu.com wrote:
> > The following question gets asked a lot, "I know C, but reading the
> > kernel source is hard, what should I do?" and the common response is 
> > "ctags."
> > It's a lot like asking "how can I build a house?" and receiving the response
> > "screwdriver."
> > There is obviously more to it then learning C and installing ctags.
> > As a newbie myself, I recently had to overcome this problem, Here's what I
> > did:

... snip ...

> > The problem a lot of newbies are having is in 'separating the trunk
> > from the leaves.' So my question is this: Experienced kernel developers, how
> > do _you_ read source code? How do you separate the trunk from the leaves?
> > What do you do when you read code you're not familiar with? How do you 
> > learn?
> > What's your algorithm?

  *sigh* ... this is the wrong question, in the same way that asking,
"how do i start writing kernel code?" is the wrong question. someone
once made the brilliant analogy that asking how to start contributing
to the kernel is akin to asking, "i want to write a book ... what
should i write about?" if you don't already know what interests you,
no one else can help you start writing.

  in the same way, asking "how do i read kernel code?" is akin to
walking into a library and asking, "i want to read something ... where
do i start?" if you don't already know what part of the kernel
interests you, then you should be asking yourself why you should be
reading kernel code in the first place.

  it seems that there is a regular supply of posters whose opening
question is something like, "i'm interested in the kernel ... how do i
get started?" i submit that it's not the mandate of this list to
answer that question. rather, i submit that it's the mandate of this
list to answer questions you have *after* you get started and have
shown that you've invested the time to dig in on your own.

  unless you've demonstrated the interest and ability to do at least a
*little* homework and research before asking questions, you're
probably not going to get much help here, and you might ask yourself
why you're interested in the first place.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: wait queues

2015-04-20 Thread Ruben Safir
On 04/19/2015 09:54 PM, Fred Chou wrote:
> Could this be a lost wake-up problem?

that is what it is supposed to solve.  It doesn't help to understand the
code though.

Ruben

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


Re: User space API for reading register information

2015-04-20 Thread Ricardo Ribalda Delgado
Hello

> On 15-04-20 16:07:27, manty kuma wrote:
>> In my application, I wish to see the stack pointer allocated to me and if
>> possible the backtrace as well. Is it possible by any standard API?


man 3 backtrace

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


Re: Question about assembly in set bit function for x86 architecture

2015-04-20 Thread Alexander Kuleshov
2015-04-20 5:11 GMT+06:00 Anuz Pratap Singh Tomar :
>
>
> On Mon, Apr 20, 2015 at 12:08 AM, Nicholas Krause 
> wrote:
>>
>>
>>
>> On April 19, 2015 5:13:20 PM EDT, Anuz Pratap Singh Tomar
>>  wrote:
>> >On Sun, Apr 19, 2015 at 9:51 PM, nick  wrote:
>> >
>> >> Greetings All,
>> >> I am wondering what the below code in the asm modifier does:
>> >> static inline void set_bit(int nr, void *addr)
>> >> {
>> >>  asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
>> >> }
>> >> This would be very helpful as I am new to  x86 assembly and don't
>> >> even known what register(s)/instruction(s) this touches and therefore
>> >this
>> >> is impossible for me to look up in the Intel Manuals. If someone
>> >either
>> >> tells me the registers/instructions this uses or explains the code
>> >that
>> >> would be very helpful.
>> >> Nick

What's the problem to read it in the intel manual or just to use
google 
[https://www.google.com/search?channel=fs&q=btsl+instruction&ie=utf-8&oe=utf-8]
which will give you answer with first link instead of spend time of
community for such questions?

>> 95 percent of the kernel is written in C

This is true. But kernel is big, and are you really sure that somebody
will want to expain you rest of 5% of the
kernel? I am not sure about it.

Yes kernel is big and complex. It contains many tricks which even hard
to find explanation in the interntet. But,
if you want to read/develop kernel, you need learning to learn, but
not just ask. It's important.

Heed the advice of Anuz, he gave the perfect advice.

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


Re: User space API for reading register information

2015-04-20 Thread victorascroft
Hi,

On 15-04-20 16:07:27, manty kuma wrote:
> Hi,
> Is there an Linux User space API to get the register information?

Which register and why do you want to access this register?

> 
> 
> In my application, I wish to see the stack pointer allocated to me and if
> possible the backtrace as well. Is it possible by any standard API?

Since you are doing application development, gdb should serve very well 
for such things. Looking at backtrace and such. This has got nothing per 
se to do with kernel.

Look up articles on how to use gdb for application debugging.
http://rsquared.sdf.org/gdb/

> 
> Best Regards,
> Manty

- Sanchayan.

> ___
> 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


User space API for reading register information

2015-04-20 Thread manty kuma
Hi,
Is there an Linux User space API to get the register information?


In my application, I wish to see the stack pointer allocated to me and if
possible the backtrace as well. Is it possible by any standard API?

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