RE: x86_64_defconfig and i386_defconfig: What is the difference?

2014-09-12 Thread Rajat Jain
Thanks,

One more question. Can I continue to use my same 64bit compiler when compiling 
images for both?

In the other words, Are both of these ok?

Make CROSS_COMPILE=my-compiler-path- i386_defconfig
Make CROSS_COMPILE=my-compiler-path- all

Make CROSS_COMPILE=my-compiler-path- x86_64_defconfig
Make CROSS_COMPILE=my-compiler-path- all

Where my-compiler-path is the gcc compiler that I use to generate 64 bit code.

Thanks,

Rajat


From: Peter Teoh [mailto:htmldevelo...@gmail.com]
Sent: Friday, September 12, 2014 6:10 PM
To: Rajat Jain
Cc: linux-new...@vger.kernel.org; kernelnewbies
Subject: Re: x86_64_defconfig and i386_defconfig: What is the difference?



On Tue, Sep 9, 2014 at 3:58 PM, Rajat Jain 
mailto:rajatj...@juniper.net>> wrote:
Hi,

Can someone tell me if the i386 one is to be used when we want to build for a 
32bit machine and the x86_64 is to be used for 64 bit machine?


i386 or 32-bit machines?   i think it don't exists anymore, but what likely is 
correct: i386-compatible machine.

The i386 config is for 32-bit OS, ie, the entire binaries must be build for 
32-bit architecture.

So choose the correct config provided u have the correct userspace 
files/libraries to support it.


Thanks,

Rajat

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



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


EPROBE_DEFER and how it is supposed to work

2014-09-09 Thread Rajat Jain
Hi,

I'm not a newbie, but I am trying to understand the semantics of deferred 
probing.

My question is generic, but for an example:

Let's say I have a platform driver "A" for a device "a", that requires device 
"b" (controlled by driver "B") to be operational first. Both A &B can be built 
as part of kernel, or as modules independently.  As far as I could tell, there 
is no way to specify the ORDER in which the drivers' probe routines should be 
called. I took a look at modprobe / depmod, but it seems to be of relevance for 
modules only that are loaded from user space. My questions:

1) Is there a way to specify that "Kernel should call A's probe routine only 
after B's probe routine"?

2) How I currently do this: In A's probe routine, I currently check if the 
device "b" is available. If not, I return -EPROBE_DEFER. This mostly works ok. 
However, I'm curious about the case where the driver B is not built as part of 
the kernel but A is. After getting an _EPROB_DEFER from a B's probe routine, 
when will the kernel try again? And for how long would it keep on trying? I 
verified that if I load the driver B manually from user space, the A's probe 
routine does not get called (if it gets called now - it would have returned 
success!).

Thanks,

Rajat

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


RE: x86_64_defconfig and i386_defconfig: What is the difference?

2014-09-09 Thread Rajat Jain
Hi,

> -Original Message-
> From: valdis.kletni...@vt.edu [mailto:valdis.kletni...@vt.edu]
> Sent: Tuesday, September 09, 2014 7:28 AM
> To: Matthias Brugger
> Cc: Rajat Jain; linux-new...@vger.kernel.org; kernelnewbies
> Subject: Re: x86_64_defconfig and i386_defconfig: What is the difference?
> 
> On Tue, 09 Sep 2014 16:06:07 +0200, Matthias Brugger said:
> 
> > > Can someone tell me if the i386 one is to be used when we want to
> > > build for a 32bit machine and the x86_64 is to be used for 64 bit machine?
> >
> > You can build the kernel with any architecture for any architecture.
> > This is called cross-compiling. The homepage [0] should explain you
> > how to do that.
> 
> Right, but you still need to use a .config appropriate for the target machine,
> which is what I think Rajat was asking about.

Right.

I'm trying to generate x86 images for someone else to test, who's going to test 
it on a standard / generic x86 machine:

https://lkml.org/lkml/2014/9/9/35

What I was not sure is that which config should I use to generate an image for 
a "standard x86 machine". Now I do understand (I provided him 2 images - 1 for 
the 32 bit (using i386_defconfig) and another for 64 bit (using 
x86_64_defconfig).

Thanks,

Rajat


> 
> A defconfig is usually only known verified to boot on a few (possibly one)
> examples of that architecture hardware.  For embedded ARM, it may be one
> specific development board or hardware device.  For x86, I think they try to
> keep it "will probably kind of sort of boot on generic PC hardware with a
> common distro, but anything fancylike a webcam or better graphics than "vga
> tty emulation" may not work".
> 
> A defconfig is pretty much just a proof of concept starting point for an 
> actual
> working config for a given hardware system.

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


RE: x86_64_defconfig and i386_defconfig: What is the difference?

2014-09-09 Thread Rajat Jain
Hi,

Thank you all for your responses. I got the answer I was looking for:

> Hello Rajat,
> 
> Indeed, the i386 is for 32bits kernels, and x86_64 for 64 bits ones. If you
> generate the configurations using "make ARCH=x86 defconfig" and "make
> ARCH=i386 defconfig", you can easily compare the resulting configurations :
> 
> .config from i386_defconfig :
> #
> # Automatically generated file; DO NOT EDIT.
> # Linux/i386 3.17.0-rc1 Kernel Configuration # # CONFIG_64BIT is not set
> CONFIG_X86_32=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y
> CONFIG_OUTPUT_FORMAT="elf32-i386"
> CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
> ...
> 
> .config from x86_64_defconfig :
> #
> # Automatically generated file; DO NOT EDIT.
> # Linux/x86 3.17.0-rc1 Kernel Configuration # CONFIG_64BIT=y
> CONFIG_X86_64=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y
> CONFIG_OUTPUT_FORMAT="elf64-x86-64"
> CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
> ...
> 
> As you can see, i386 is the 32 bits variant of the x86 architecture. There 
> are of
> course many more differences between these two configurations.
> 
> Regards,
> 
> Hubert

Thanks all again,

Rajat


> -Original Message-
> From: valdis.kletni...@vt.edu [mailto:valdis.kletni...@vt.edu]
> Sent: Tuesday, September 09, 2014 7:28 AM
> To: Matthias Brugger
> Cc: Rajat Jain; linux-new...@vger.kernel.org; kernelnewbies
> Subject: Re: x86_64_defconfig and i386_defconfig: What is the difference?
> 
> On Tue, 09 Sep 2014 16:06:07 +0200, Matthias Brugger said:
> 
> > > Can someone tell me if the i386 one is to be used when we want to
> > > build for a 32bit machine and the x86_64 is to be used for 64 bit machine?
> >
> > You can build the kernel with any architecture for any architecture.
> > This is called cross-compiling. The homepage [0] should explain you
> > how to do that.
> 
> Right, but you still need to use a .config appropriate for the target machine,
> which is what I think Rajat was asking about.
> 
> A defconfig is usually only known verified to boot on a few (possibly one)
> examples of that architecture hardware.  For embedded ARM, it may be one
> specific development board or hardware device.  For x86, I think they try to
> keep it "will probably kind of sort of boot on generic PC hardware with a
> common distro, but anything fancylike a webcam or better graphics than "vga
> tty emulation" may not work".
> 
> A defconfig is pretty much just a proof of concept starting point for an 
> actual
> working config for a given hardware system.

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


x86_64_defconfig and i386_defconfig: What is the difference?

2014-09-09 Thread Rajat Jain
Hi,

Can someone tell me if the i386 one is to be used when we want to build for a 
32bit machine and the x86_64 is to be used for 64 bit machine?

Thanks,

Rajat

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


MODULE_ALIAS - Explain with this example?

2013-12-10 Thread Rajat Jain
Hi,

Can some one please help me understand what does the use of MODULE_ALIAS() 
achieve?

In the simple char driver "drivers/char/hw_random/omap-rng.c", I see the 
following in addition to the regular stuff.

/* work with hotplug and coldplug */
MODULE_ALIAS("platform:omap_rng");

Can some one tell me what is the above indicating?

Thanks,

Rajat


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


Ordering / preemption of work in a workqueue preempt?

2013-11-15 Thread Rajat Jain
Hi,

I have a single work queue, on which I have scheduled a worker function [using 
queue_work(wq, fn)] in interrupt context. 

I get the interrupt twice before the work queue gets a chance to run, and hence 
the same function will get queued twice (with different private context - 
arguments etc) which is fine and expected.

Questions:

1) Is it possible that the instance that was queued by 2nd interrupt, can get 
to run BEFORE the instance that was queued by 1st interrupt? In other words, is 
reordering possible?

2) Is it possible that one running instance of the function, can get preempted 
by second instance of the same work queue? I read through 
http://lwn.net/Articles/511421/ and it talks about same work queue cannot run 
on different CPU, but I have doubt about single CPU. If If I am writing a 
worker function, does my code have to be ready that it can be preempted by 
another instance of the same function?

Please note that I understand that my worker function can preempted by other 
processes, my doubts are related to the same workqueue.

Thanks,

Rajat


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


How to find out which part of code is changing a particular data structure.

2013-11-07 Thread Rajat Jain
Hi folks,

I have a memory location (One of the fields in a kernel data structure) and I 
want to track down the code that changes the value of that particular location. 
Some thing like a "watchpoint".

And this is early while I am still booting up. Can some one tell me if it is 
possible to do so?

Thanks,

Rajat

 


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


RE: [PCIe spec question] How to get PCI express link up / link down notifications?

2013-10-04 Thread Rajat Jain
Hi,

I found the answer to my original question. I found the "Data Link Layer State 
Changed Enable" bit in the Slot Control register which seems to provide 
interrupt on link state changes.

6.7.3.3. Data Link Layer State Changed Events 
==
The Data Link Layer State Changed event provides an indication that the state 
of the Data Link Layer Link Active bit in the Link Status register has changed. 
Support for Data Link Layer State Changed events and software notification of 
these events are required for hot-plug capable Downstream Ports. If this event 
is supported, the Port sets the status field associated with the event
5 when the value in the Data Link Layer Link Active bit changes.

Thanks a bunch!

Rajat


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


RE: [PCIe spec question] How to get PCI express link up / link down notifications?

2013-10-03 Thread Rajat Jain
Hello Greg,

> 
> On Fri, Oct 04, 2013 at 01:40:49AM +, Rajat Jain wrote:
> > Hello,
> >
> > I have a HW which is not compliant with the PCI Express hot-plug (as
> > described in the PCI express spec) because the HP signals from the
> > downstream port are simply not connected. And I have a PCI express
> > endpoint, that in the course of its life, will routinely undergo
> > power-off and power-on on cycles. Hence the PCIe link to this device
> > is expected to come down, and come up as part of regular operation.
> 
> What hardware is this?  Why not ask the manufacturer of it as they are
> the ones in control of this type of thing.

OK, Understood :-).

Actually my question was generic. For e.g. say I have a topology where root 
port connects to a PCIe switch-1 that in turn connects to a PCIe switch-2. My 
question is if the PCIe link between the switch-1 and switch-2 goes down or up 
for some reason (say a power fault, or due to RESET pin assertion on the switch 
etc), is there a way to get notification interrupt at the root port or CPU? 
Essentially I am looking for a notification from downstream port of switch-1, 
that it saw a change in the link status.

> 
> > I'm reading the PCI express spec trying to understand if it is
> > possible to get notification interrupts, whenever the PCIe link to
> > this device goes down or goes up. Can someone please help me
> > understand if it is possible?
> 
> Notification where?

Notification to the CPU via the root port.

Thanks a bunch,

Rajat

> 
> thanks,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majord...@vger.kernel.org More majordomo info
> at  http://vger.kernel.org/majordomo-info.html
> 



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


[PCIe spec question] How to get PCI express link up / link down notifications?

2013-10-03 Thread Rajat Jain
Hello,

I have a HW which is not compliant with the PCI Express hot-plug (as described 
in the PCI express spec) because the HP signals from the downstream port are 
simply not connected. And I have a PCI express endpoint, that in the course of 
its life, will routinely undergo power-off and power-on on cycles. Hence the 
PCIe link to this device is expected to come down, and come up as part of 
regular operation.

I'm reading the PCI express spec trying to understand if it is possible to get 
notification interrupts, whenever the PCIe link to this device goes down or 
goes up. Can someone please help me understand if it is possible?

In the link control register, I only see the capability to generate interrupts 
when "link bandwidth" changes and looking at the text, I doubt if Link down or 
link up counts as "link bandwidth change". Is there a way to generate and 
interrupt / notification when the Link goes up or down?

Thanks,

Rajat Jain




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


RE: where can i find PCI rfc document

2011-02-17 Thread Rajat Jain
I assume you are trying to look up PCI specification. Here it is (you can 
create a member login for free):

http://www.pcisig.com/specifications/conventional/

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


RE: iomem and ioports

2011-02-17 Thread Rajat Jain
Some places i have seen that directly IO port is typecasted to  (__iomem * ) 
and used as it is i.e. returned value is given to ioread and iowrite 
functions.Kindly explain why in some cases we dont add offset and in some cases 
we add??
Is it because in some board we need to memory map the port number and then 
read/write and in some boards we don't need to do that as we can directly 
access the port using arch specific functions??
 

RAJAT> I would think so.

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


RE: iomem and ioports

2011-02-16 Thread Rajat Jain

Hi,

This code says that there are 0x1 possible ioports i.e. in the range (0 - 
0x). To map these into iomemory, simply an address = (0x1 + ioport num) 
is used. Thus this code:

>
> if (port > PIO_MASK) return NULL;
>
Checks that the ioport number is within the range of ioports.

> 
> return (void __iomem *) (unsigned long) (port + PIO_OFFSET);
>
And if yes, offsets it by 0x1 and returns the resulting address that shall 
be used as iomemory.

Thanks,

Rajat Jain


From: kernelnewbies-boun...@kernelnewbies.org 
[mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of prabhu
Sent: Wednesday, February 16, 2011 1:15 PM
To: kernelnewbies
Subject: iomem and ioports

HI All,

I started to understand output of /proc/oiports and /proc/iomem. I confused to 
relate these two's output.  

Below is the kernel source for Mapping of io-port to io-mem. Could anyone 
please explain below code.

/* We encode the physical PIO addresses (0-0x) into the
   (0-
 * pointer by offsetting them with a constant (0x1) and
 * assuming that all the low addresses are always PIO. That means
    means
 * we can do some sanity checks on the low bits, and don't
 * need to just take things for granted.
 */
#define PIO_OFFSET  0x1UL
#define PIO_MASK    0x0UL
#define PIO_RESERVED    0x4UL
void __iomem *ioport_map(unsigned long port, unsigned int nr) {
 __iomem
   if (port > PIO_MASK) return NULL;
   return (void __iomem *) (unsigned long) (port + PIO_OFFSET);
    __iomem
}

Thanks,
Prabhu

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


RE: task_struct related query

2011-02-15 Thread Rajat Jain

> when a process executes a function  , is there any way  by which i can > 
> figure out the reference to that function or any footprint of that 
> function via task_struct (current)?

Do you want to know the currently executing functions? You can always get the 
current stack frame (whether in user space or in kernel space) from the stack 
pointer.

Thanks,

Rajat

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


RE: some questions about kernel source

2011-02-15 Thread Rajat Jain
Hello loody,

> 1. in kernel/trace, I always see "__read_mostly" at the end of
> parameter is that a compiler optimization parameter?

Yes, it is a hint to the compiler that the parameter is mostly read, thus if 
the compiler has to make a decision between optimizing one of the read / write 
paths, it will optimize the read path even at the expense of write path.

> 2. what are below __releases and __acquires used for?
> ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status)
> __releases(ehci->lock)
> __acquires(ehci->lock)
> these 2 cmds are not in the {}, so I guess it will not compile out
> machine. If so, why we add them after function prototype?

I think it is some jugglery to aid the compiler and intelligent static code 
analysis tools to inform this function acquires and releases the said lock. 
This would help those tools in finding out potential synchronization issues, 
lockup scenarios.

Thanks,

Rajat


> -Original Message-
> From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-
> boun...@kernelnewbies.org] On Behalf Of loody
> Sent: Wednesday, February 16, 2011 11:23 AM
> To: kernelnewbies@kernelnewbies.org
> Subject: some questions about kernel source
> 
> Dear all:
> I have some questions about kernel source code:
> 1. in kernel/trace, I always see "__read_mostly" at the end of
> parameter is that a compiler optimization parameter?
> 2. what are below __releases and __acquires used for?
> ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status)
> __releases(ehci->lock)
> __acquires(ehci->lock)
> these 2 cmds are not in the {}, so I guess it will not compile out
> machine. If so, why we add them after function prototype?
> 
> 
> --
> 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