Re: kernel modules, derived work and GPLv2

2023-07-12 Thread Ezra Buehler
Hi Phil,

On Wed, Jul 12, 2023 at 5:01 PM Phil Perry  wrote:
> However, what about the source code for the linux kernel the kernel
> module (driver) was built against - is that also deemed part of the
> derived work and must I also distribute the linux kernel source code
> against which my binary kernel module (driver) was compiled?

Perhaps this will answer some questions:
https://www.fsf.org/bulletin/2020/fall/why-providing-source-code-for-unmodified-works-is-important

Cheers,
Ezra

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


Re: kernel modules, derived work and GPLv2

2023-07-12 Thread Greg KH
On Wed, Jul 12, 2023 at 03:56:40PM +0100, Phil Perry wrote:
> Hello list,
> 
> I am seeking to fully understand my obligations under the GPL regarding
> kernel modules, derived works and requirements to distribute the source
> code.

Wonderful.  Please contact a lawyer about this if you have questions
about this type of thing, as they are the only ones that can give you
legal advice.

Best of luck!

greg k-h

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


kernel modules, derived work and GPLv2

2023-07-12 Thread Phil Perry

Hello list,

I am seeking to fully understand my obligations under the GPL regarding 
kernel modules, derived works and requirements to distribute the source 
code.


If I build a kernel module (driver) against the linux kernel, and that 
kernel module is deemed to be a derived work, I understand that it must 
also be licensed under the GPL. As such, if I distribute the binary 
kernel module (driver), I must also distribute the kernel module source 
code. That all seems straightforward, no issues there.


However, what about the source code for the linux kernel the kernel 
module (driver) was built against - is that also deemed part of the 
derived work and must I also distribute the linux kernel source code 
against which my binary kernel module (driver) was compiled?


If yes, what part of the linux kernel source code tree must I 
distribute? All of it, or just the source code for the interfaces 
(exported symbols) I have used in my module?


If my question is not appropriate for this list, I will happily accept 
pointers to a more appropriate forum.


Thanks,

Phil


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


Re: work one webcam out of two webcam connect to xhci controller for 2 usb3.0 ports

2022-10-18 Thread Malatesh
Hi Team, This issue seems to be both webcam devices which consumes 500mA
power.

I have verified with two webcam in which one uses 500mA and one uses 244mA
so both cameras working as expected.

Is there any code changes in mainline kernel regarding usb power
consumption.

Thank you all.


Regards,
Malatesh

On Tue, 18 Oct, 2022, 11:52 pm ,  wrote:

> Let's keep this on the list.
> I'm sure I don't have Silver Bullet answers.
>
>
>
> On Tue, Oct 18, 2022, 11:15 AM Malatesh  wrote:
>
>> Hi.
>> Thank you for the interest you have shown.
>>
>>
>> - both cameras work one at a time ?
>> [A]: No. I am using one by one and not at one time both cameras
>> - does order of plugin affect which one blanks ?
>> [A]: First plugged camera will give blank and second plugged will work
>>
>
> This certainly suggests two cameras are on or plugged in at the same time.
>  that contradicts your first answer
>
> - are they both the same camera model ?
>> [A]: No one is logitech and another is microsoft
>> - can you borrow a 3rd camera ?
>> [A]: Third camera works
>>
>
> I think you need to retest and permute all combinations or at least some
> of them.
>
> I suspect your application doesn't know what to do with two cameras why
> don't you try another app and see if it works. Cheese is the one on my
> desktop
>
>
>> Actual Error:
>> When I click camera preview with two camera connected, one is giving
>> error some time with "xhci_configure_reset_endpoint:4543 Error to set
>> dequeue ptr for endpoint 3, 81, err 18, 0".
>> This is because "ep status is 0 and *Endpoint is disabled".*
>>
>> Full Log:
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011861> set halted 1
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011890> real interrupt
>> (status=0x0008)
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011897> event[77] = 32
>> (0x 0x0c00 0x02038000)
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011901> trb 0x0 status c
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011904> slot=2 epno=3
>> stream=0 remainder=0 status=12, td_event 0x0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011907> stream_id=0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011910>
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011940> trb halted 1,
>> running 0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011943>
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011944> Ep(129) No:129
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011946> Ep ID(129to3):3
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011949> dev 2, ep address 81
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011952> xfer
>> 0xfe003198f148, 0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011954> ep 81 is not started
>> yet
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011957> --> epno:3, Oct
>> 18 16:35:42 WT544810D076E1 kernel: <3645.011861> set halted 1
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011890> real interrupt
>> (status=0x0008)
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011897> event[77] = 32
>> (0x 0x0c00 0x02038000)
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011901> trb 0x0 status c
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011904> slot=2 epno=3
>> stream=0 remainder=0 status=12, td_event 0x0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011907> stream_id=0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011910>
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011940> trb halted 1,
>> running 0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011943>
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011944> Ep(129) No:129
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011946> Ep ID(129to3):3
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011949> dev 2, ep address 81
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011952> xfer
>> 0xfe003198f148, 0
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011954> ep 81 is not started
>> yet
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011957> --> epno:3,
>> *epstatus:0* device:2, ep_address 81
>>
>> Oct 18 16:35:42 WT544810D076E1 kernel: &

Re: work one webcam out of two webcam connect to xhci controller for 2 usb3.0 ports

2022-10-18 Thread jim . cromie
Let's keep this on the list.
I'm sure I don't have Silver Bullet answers.



On Tue, Oct 18, 2022, 11:15 AM Malatesh  wrote:

> Hi.
> Thank you for the interest you have shown.
>
>
> - both cameras work one at a time ?
> [A]: No. I am using one by one and not at one time both cameras
> - does order of plugin affect which one blanks ?
> [A]: First plugged camera will give blank and second plugged will work
>

This certainly suggests two cameras are on or plugged in at the same time.
 that contradicts your first answer

- are they both the same camera model ?
> [A]: No one is logitech and another is microsoft
> - can you borrow a 3rd camera ?
> [A]: Third camera works
>

I think you need to retest and permute all combinations or at least some of
them.

I suspect your application doesn't know what to do with two cameras why
don't you try another app and see if it works. Cheese is the one on my
desktop


> Actual Error:
> When I click camera preview with two camera connected, one is giving error
> some time with "xhci_configure_reset_endpoint:4543 Error to set dequeue
> ptr for endpoint 3, 81, err 18, 0".
> This is because "ep status is 0 and *Endpoint is disabled".*
>
> Full Log:
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011861> set halted 1
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011890> real interrupt
> (status=0x0008)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011897> event[77] = 32
> (0x 0x0c00 0x02038000)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011901> trb 0x0 status c
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011904> slot=2 epno=3
> stream=0 remainder=0 status=12, td_event 0x0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011907> stream_id=0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011910>
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011940> trb halted 1, running
> 0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011943>
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011944> Ep(129) No:129
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011946> Ep ID(129to3):3
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011949> dev 2, ep address 81
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011952> xfer
> 0xfe003198f148, 0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011954> ep 81 is not started
> yet
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011957> --> epno:3, Oct
> 18 16:35:42 WT544810D076E1 kernel: <3645.011861> set halted 1
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011890> real interrupt
> (status=0x0008)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011897> event[77] = 32
> (0x 0x0c00 0x02038000)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011901> trb 0x0 status c
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011904> slot=2 epno=3
> stream=0 remainder=0 status=12, td_event 0x0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011907> stream_id=0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011910>
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011940> trb halted 1, running
> 0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011943>
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011944> Ep(129) No:129
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011946> Ep ID(129to3):3
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011949> dev 2, ep address 81
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011952> xfer
> 0xfe003198f148, 0
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011954> ep 81 is not started
> yet
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011957> --> epno:3,
> *epstatus:0* device:2, ep_address 81
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011960> > *Endpoint is
> disabled*
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011962>
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.011965> command[5] = 16
> (0x09891001, 0x, 0x02034000)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.012003> real interrupt
> (status=0x0008)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.012010> event[78] = 33
> (0x000100fffdd0 0x1300 0x02008400)
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.012013> Received command event
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.012042> trb 1300, 2008400
>
> Oct 18 16:35:42 WT544810D076E1 kernel: <3645.012046> src 16,
> (0x09891001, 0x, 0x02034000)
&

Re: work one webcam out of two webcam connect to xhci controller for 2 usb3.0 ports

2022-10-13 Thread jim . cromie
On Wed, Oct 12, 2022 at 11:21 AM Malatesh  wrote:
>
> Hi Team,
>
> Good Morning/Afternoon/Evening.
>
> I connect two usb webcameras and one mouse, one keyboard to  xhci controller, 
> which has 4 usb v3.x ports.
> Here, keyboard and mouse works fine without any issue.
> But out of two cameras, only one camera works( I mean when I click preview 
> only one camera show and one camera show blank )
>

lemme ask some obvious questions:
- both cameras work one at a time ?
- does order of plugin affect which one blanks ?
- are they both the same camera model ?
- can you borrow a 3rd camera ?

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


work one webcam out of two webcam connect to xhci controller for 2 usb3.0 ports

2022-10-12 Thread Malatesh
*Hi Team,*

*Good Morning/Afternoon/Evening.*

I connect two usb webcameras and one mouse, one keyboard to  xhci
controller, which has 4 usb v3.x ports.
Here, keyboard and mouse works fine without any issue.
But out of two cameras, only one camera works( I mean when I click preview
only one camera show and one camera show blank )

*Debug log:*
 kernel:  xhci_ep_clear_stall:
<3057.043240> -- xhci_configure_reset_endpoint

<3057.043272>
>dev:11,bEndpointAddress:81,ep_status:0,epno:3,xfer:0xfe0036ebc148
 <3057.043296> xhci_cmd_configure_ep:
<3057.043545> xhci_check_command: Received command event
 <3057.289866> xhci_timeout: xfer=0xfe0036ebc148
<3057.290055> -- xhci_configure_reset_endpoint

<3057.290079>
>dev:11,bEndpointAddress:81,ep_status:0,epno:3,xfer:0xfe0036ebc148
<3057.290102> xhci_cmd_reset_ep:
<3057.290145> xhci_check_command:Received command event
<3057.290198> [ERROR] - xhci_configure_reset_endpoint: Could not set
dequeue ptr for endpoint 3, 0
<3057.290221> xhci_cmd_set_tr_dequeue_ptr:
<3057.290282> xhci_check_command: Received command event
[ERROR] - xhci_configure_reset_endpoint: Error to set dequeue ptr for
endpoint 3, 81, err 18, 0
<3057.290350> xhci_cmd_evaluate_ctx:
<3057.290403> xhci_check_command: Received command event
kernel: <> xhci_timeout: xfer=0xfe0036ebc148

It is great if you provide some inputs. Thank you in advance!!!

Regards,
Malatesh
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Does sysrq work over USB?

2021-11-21 Thread Marc SCHAEFER
Hello,

On Sun, Nov 21, 2021 at 07:07:33PM +0100, Valentin Vidi?? wrote:
> I tried and it doesn't work for me either, but the problem is most
> likely missing CONFIG_USB_SERIAL_CONSOLE=y option in the kernel build:
> 
>   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868352

Yes,

with a kernel recompiled with those options and grub configured,
I get:

CONFIG_USB=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_U_SERIAL_CONSOLE=y

I get:

   root@gluster-1:~# cat /proc/consoles 
   tty0 -WU (EC p  )4:1
   ttyUSB0  -W- (E  p  )  188:0

and I can then do sysrq from USB:
   schaefer@acer-1:~$ cu -l ttyUSB0 -s 9600
   Connected.
   ~%break
   [ 1633.701624] sysrq: HELP : loglevel(0-9) reboot(b) crash(c)
   terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i)
   thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l)
   show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p)
   show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u)
   force-fb(V) show-blocked-tasks(w) dump-ftrace-buffer(z) 
   
Thank you for your help: I have now a way to make it work.
   

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


Re: Does sysrq work over USB?

2021-11-21 Thread Marc SCHAEFER
On Tue, Nov 16, 2021 at 10:29:00PM +0100, Valentin Vidi?? wrote:
> Do you have console=ttyUSB0,... set? What does /proc/consoles say?

No, I did not.

Now, I have added on a test machine:

   console=ttyUSB0,9600 console=tty0

to /etc/default/grub and started upgrade-grub and rebooted.

I had and I still have:

   root@gluster-1:~# cat /proc/consoles 
   tty0 -WU (EC p  )4:1

However, the command line seems correct and multiple console= are
valid [1]:

   root@gluster-1:~# cat /proc/cmdline 
   BOOT_IMAGE=/vmlinuz-4.19.0-18-amd64 root=/dev/mapper/vg1-root ro 
console=ttyUSB0,9600 console=tty0 quiet raid0.default_layout=1

It does not seem to be work for some reason.

Let's try with one ttyUSB console specification only: does not
boot anymore. Does not print anything on ttyUSB0. Had to recover
using a grub kernel command line edition at boot time.

Any idea?

NB: the USB serial port works with cu bidirectionnally once the
system is booted, but %break has no effect.

[1] https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html

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


Does sysrq work over USB?

2021-11-16 Thread Marc SCHAEFER
Hello,

I made the following setup work, that is I can send break and '?'
(to get the magic sysrq help) or 's' to do an Emergency sync, and the
kernel logs it:

 laptopapu2
USB serial port --- null modem --- ttyS0 internal 16550A

(an apu2 is an embedded amd64 computer [4])

As it works, of course MAGIC_SYSRQ is enabled, including for serial
ports, and the correct value is in the /proc pseudo-file.

It works with the getty enabled or disabled.

However, the following does not work to support magic sysrq, although
bidirectionnal communication also works with cu [5], with the correct
speed set:

 laptopapu2
USB serial port --- null modem --- USB serial port

First, reading documentation, I thought that this would not be possible with
USB and only with the internal serial port [1], but then, reading kernel
source, it looks it should work with my adapter:

   Oct 11 14:30:56 apu2-init7 kernel: [9.915105] usb 2-2: pl2303 converter 
now attached to ttyUSB0

since the driver [2] contains code for magic sysrq, see line 993 for
sysrq mode and line 892 for break handling, with implementation in [3]
(lines 589-597).

I am running Debian buster kernel 4.19.0-18-amd64 on the apu2.

Should I abandon all hope to make it work with USB, or should it work?

Thank your for any pointers.

[1] https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst
"On the serial console (PC style standard serial ports only)"

[2] 
https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/pl2303.c

[3] 
https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/generic.c

[4] https://pcengines.ch/apu2.htm

[5] https://linux.die.net/man/1/cu
from the days before 2003 where I was doing UUCP
   cu -l ttyUSB0 -s 9600

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


Re: How do the kernel boot parameters work (especially "toram")?

2021-08-27 Thread Ian Pilcher

On 8/27/21 6:03 AM, Gueven Bay wrote:

With kernel boot parameters I mean the arguments you give on the grub
command line to the kernel. Just like "toram" which on some distros
work and on many doesn't.


I'm not familiar with "toram", but it's possible that it's not actually
a kernel parameter.  Not everything that's passed on the kernel command
line is actually a kernel parameter; see dracut.cmdline(7) for a bunch
of examples.

Actual kernel parameters are implemented with various macros defined in
include/linux/moduleparam.h.

--

 In Soviet Russia, Google searches you!



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


How do the kernel boot parameters work (especially "toram")?

2021-08-27 Thread Gueven Bay
Hello,

With kernel boot parameters I mean the arguments you give on the grub
command line to the kernel. Just like "toram" which on some distros
work and on many doesn't.

I googled but only found webpages listing the possible boot parameters
and maybe explaining what they do, but none where it was explained
_how_ they work.

Does a boot parameter make the kernel call a script? Does a boot
parameter reference a function inside the kernel? If some distros seem
to allow a specific boot parameter what did they do to their distros
kernel to make this parameter work? And which module or which part of
the kernel takes the boot parameters as input to do the appropriate
things?

For example: It seems that Centos (8) does not suppport "toram"
(allowing to load the whole OS into RAM), at least on my machine.
Okay, what should or can I do to get my (Centos) kernel to accept
this? Writing a script? Patching something?

(Maybe my questions are not really clear, just ask me, please.)

Thanks.

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


Re: Does 'make oldconfig' work across different architectures?

2021-02-18 Thread jim . cromie
On Thu, Feb 18, 2021 at 8:07 PM  wrote:

> Hello folks,
>
> When we want to use an old .config file for a new kernel build, we can use
> (place in build location) that .config and do ‘make oldconfig’ so that the
> build system lets us to fill the new config variables.
>
> I'm curious if this 'make oldconfig' will work if the old .config is from
> different architecture (like sparc) and I have to configure it for aarch64.
>
> The old .config file is a minimal configuration with timer, interrupt
> controller and uart for minimal linux booting.
>
> Thanks!
>
Chan Kim
> __


you need to define "working".

I bet it would work to produce a config that is syntactically correct.
whether it builds a bootable kernel is less clear.

Ive only built and installed to hw 1 non-x86 kernel,
so my experience isnt relevant to other arches, ymmv

ISTM
you should try defconfig for aarch64
your .config, updated with oldconfig
diff them, see whats happened to various CONFIG vars
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Does 'make oldconfig' work across different architectures?

2021-02-18 Thread ckim
Hello folks,

When we want to use an old .config file for a new kernel build, we can use
(place in build location) that .config and do 'make oldconfig' so that the
build system lets us to fill the new config variables.

I'm curious if this 'make oldconfig' will work if the old .config is from
different architecture (like sparc) and I have to configure it for aarch64. 

The old .config file is a minimal configuration with timer, interrupt
controller and uart for minimal linux booting.

Thanks!

Chan Kim

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


linker script hack - can it be made to work ?

2021-01-14 Thread jim . cromie
Im attempting to conditionally link an input section.
if the just linked similarly named section wasnt empty.

__start___dyndbg = .; \
_ = .; \ \
KEEP(*(__dyndbg (.-_)? gnu.linkonce.d.__dyndbg)) \
__stop___dyndbg = .;

it gives me an unspecified linker syntax error
ld:./arch/x86/kernel/vmlinux.lds:46: syntax error

its pretty clear that this experiment is failing,
is there another way to do this ?

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


how does objcopy work? and how does the linux kernel process relocation with that stripped off image?

2020-12-18 Thread ckim
I saw in a linux build log this command (how to generate from 'vmlinux' to
'Image'),  

 

>
/home/ckim/N1SDP/arm-reference-platforms/tools/gcc/gcc-linaro-6.2.1-2016.11-
x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-objcopy

> -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux
arch/arm64/boot/Image

 

so the 'Image' file is generated from 'vmlinux' by objcopy command and about
the -S option, objcopy help says 

'-S --strip-all   Remove all symbol and relocation
information' 

 

I checked I can run 'Image' file on the machine and it really boots linux to
some point(I just tested it on qemu-system-aarch64, with -m virt option),
arm support person says the 'Image' file is loaded at 0x4000 in the
'virt' machine when I passed the 'Image' with -kernel option.(I guess the
qemu knows where to load it..).  

 

My question is, I understand I can load the 'Image' file anywhere on the
memory (because it's position independent code using only relative offsets
for function calls and variable addresses probably,..), and at some point
the kernel itself relocates the kernel image to somewhere else. (In arm64
linux, they don't use compressed kernel, so is it not relocated later in
this case?). How does the kernel program ('Image') relocates the image and
setup the MMU table when there is no symbol or relocation table?  

Can anyone correct my understanding if I'm wrong and explain to me how
objcopy works and how kernel relocation is done in this case?(if it's done).


(I know 'vmlinux' file is ELF file so the loader knows where to load it from
where to start it, but this 'Image' files doesn't have any such
information).

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


Cannot get FIQ to work properly on raspberry zero

2020-06-17 Thread Sietse Achterop

  Hello List,
I have asked this before on several mailing lists, but still no solution,
so I am trying again here.

I'm having trouble with using FIQ interrupts with the ARM timer on raspberypi 
zero, (BCM2835 chip).
I created a kernel module, and the test version of this driver can be found in

  
https://github.com/SietseAchterop/Batradio/blob/master/batradio_module/fiqtest_4.c

I made sure that FIQ is not used by USB by adding
   dwc_otg.fiq_fsm_enable=0 dwc_otg.fiq_enable=0 dwc_otg.nak_holdoff=0
to cmdline.txt in /boot

I first tried to use the regular sequence of functions to use.
In the init function:
  claim_fiq, set_fiq_regs, enable_fiq
In the exit function
  disable_fiq, release_fiq.

But I cannot find which irq number to use, e.g. using irq_of_parse_and_map
I tried several values. 0, 64, but nothing works.
So instead of the enable/disable functions I directly set the timer interrupt 
via the IRQFIQ register.

This works; a bit.
The fiq_handler only resets the ARM timer, increments a timer and toggles a LED.
I see the timer counting, the fiq being called.
But the rpi fairly quickly crashes.
In the, sometimes, 10 seconds that it runs I see the led flashing very 
irregular.

What is wrong here?
Has the irregularity something to do with suspend/resume?
Please find below the relevant snippets from the init and exit function of the 
driver.
And also the fiq_handler.

   Thanks in advance,
   Sietse

== init_bat
  .
  // directly set ARM timer registers
  TIMCNTR = 0x000;   // stop timer
  TIMLOAD = 10-1;// load value
  TIMCINT = 0;   // clear interrupt

  ret = claim_fiq(_fh);
  if (ret) {
printk("batradio: claim_fiq failed.\n");
return ret;
  }
  
  set_fiq_handler(_handler, _handler_end - _handler);


  regs.ARM_r8  = (long)gpiospi;
  regs.ARM_r9  = (long)irqtimer;
  regs.ARM_r10 = (long)0;
  set_fiq_regs();

  TIMCNTR = 0x00A2;   // start timer with interrupt, 23 bit counter
  IRQFIQ = 0xC0;  // timer interrupt to fiq directly via register
  //enable_fiq(64);
  

==  exit_bat

  IRQFIQ  = 0x00; // stop fiq interrupts
  TIMCNTR = 0x003E;   // stop ARM timer
  //disable_fiq(64);


==  batradio fiq handler
.text
.global batradio_handler
.global batradio_handler_end

batradio_handler:
stmdb sp!, {r6-r7}
mov  r6, #0
str r6, [r9, #0x40C]// TIMCINT = 0 // clear interrupt

mov r7, #0x2000 // 1 << CNVST
add r10, r10, #1
ands r6, r10, #0x0001   // set toggle speed
bne off
str r7, [r8, #40]   // led on
ldmia sp!, {r6-r7}
subs pc, lr, #4
off:str r7, [r8, #28]   // led off
ldmia sp!, {r6-r7}
subs pc, lr, #4
batradio_handler_end:

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


Call flush_scheduled_work in the context of a work routine

2020-04-30 Thread Bogdan Bogush
The comment to flush_scheduled_work states that calling this function in
the context of a work routine will lead to deadlock. I think it means
following scenario:

static void
handler(struct work_struct *work)
{
flush_scheduled_work();
}
static DECLARE_WORK(work, handler);
schedule_work();


If this is true for system workqueue (system_wq) is it also applied to
custom workqueue? I want to wait for completion of the workqueues in
another workqueue. For example:

static void
handler(struct work_struct *work)
{
struct work_data * data = (struct work_data *)work;
flush_scheduled_work();
kfree(data);
}
  wq = create_workqueue("wq_test");
  data = kmalloc(sizeof(struct work_data), GFP_KERNEL);
  INIT_WORK(>work, handler);
  queue_work(wq, >work);
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Finding bugs/issues to work on

2020-03-25 Thread Valdis Klētnieks
On Tue, 24 Mar 2020 16:49:29 +0530, Suraj Upadhyay said:

> Hii newbies,
> I just started studying for linux-kernel development although I am
> not completely new to open source technologies. I wanted to clarify my
> doubts in the following things
> 1. Where can I find issues/tickets regarding linux-kernel, to work on ?
> 2. What's the best resource to get started on linux-kernel development ?
> I started reading kernel-newbies guides, though.

Can we configure the list to send a greeting message with intro material
when somebody subscribes to the list?

In the meantime, I'll repeat myself here...

https://lists.kernelnewbies.org/pipermail/kernelnewbies/2017-April/017765.html


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


Re: Finding bugs/issues to work on

2020-03-24 Thread Greg KH
On Tue, Mar 24, 2020 at 04:49:29PM +0530, Suraj Upadhyay wrote:
> Hii newbies,
> I just started studying for linux-kernel development although I am
> not completely new to open source technologies. I wanted to clarify my
> doubts in the following things
> 1. Where can I find issues/tickets regarding linux-kernel, to work on ?

It depends on the part of the kernel you are interested in, what part is
that?

> 2. What's the best resource to get started on linux-kernel development ?
> I started reading kernel-newbies guides, though.

That's a great start, what is wrong with that?

good luck,

greg k-h

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


Re: Finding bugs/issues to work on

2020-03-24 Thread Robert P. J. Day
On Tue, 24 Mar 2020, Suraj Upadhyay wrote:

> Hii newbies,
>     I just started studying for linux-kernel development although I am not
> completely new to open source technologies. I wanted to clarify my doubts in 
> the
> following things
> 1. Where can I find issues/tickets regarding linux-kernel, to work on ?
> 2. What's the best resource to get started on linux-kernel development ?
> I started reading kernel-newbies guides, though.

  i make this suggestion on a semi-regular basis ... if you want
something that desperately needs doing, work on improving the
documentation. there is never a lack of docs that need improving, and
it gives you a chance to *safely* learn a lot of new stuff.

rday___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Finding bugs/issues to work on

2020-03-24 Thread Suraj Upadhyay
Hii newbies,
I just started studying for linux-kernel development although I am
not completely new to open source technologies. I wanted to clarify my
doubts in the following things
1. Where can I find issues/tickets regarding linux-kernel, to work on ?
2. What's the best resource to get started on linux-kernel development ?
I started reading kernel-newbies guides, though.

Grateful for your time and responses,
Yours sincerely,
A Kernel-Newbie.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-16 Thread Cindy Sue Causey
On 10/2/19, Ruben Safir  wrote:
> On 10/2/19 11:35 PM, Valdis Klētnieks wrote:
>> On Wed, 02 Oct 2019 21:47:42 -0400, Ruben Safir said:
>>
>> I'm willing to bet that there's very few PhD's in CS listed in
>> MAINTAINERS.  And
>> those that are, are probably coincidental...
>
> I can't testify to that, but there are ton of Master Degree coders and a
> lot of mathamaticians.


Speaking from my own set of Shoes, some part of it is about being
attracted to something with discernible patterns.. predictable
patterns.. I don't know, words aren't quite pulling together this
morning, but..

Math and computers..

Maybe "logical" is the word I'm looking for.. If one has followed a
[building block] type of learning path for either Math or computers,
they're both actually... fun because they *can be* predictably
logical..

That is, if one has taken the logical path of learning either subject
via a [building block] type of education rather than trying to jump
off into the very deepest end first. *shakes head at self*

PS Linux From Scratch.. LFS.. I WISH I had found that first 20 years
ago before all others. It would have made a lot less sense (to me) in
that order, but all others after that would have made A LOT MORE sense
in its shadow. I think I learned about LFS from Kernel Newbies, from a
suggested further readings list or something, now that i think about
it, too. #ThankYou! :)

Cindy :)
-- 
* runs with birdseed *

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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-05 Thread Grant Taylor

On 10/2/19 9:42 PM, Ruben Safir wrote:
General plumbing is not needed, but predictive trees, and crypto 
certainly do and some hardware problems need calc, or even integration.


Those sound like hyper specific things and decidedly specif subsets of 
the kernel.


I believe that there is a LOT of room for kernel development that does 
not need advanced mathematics.



The harder the job, the more math is needed.


math ≠ advanced mathematics

I concede that quite a bit of math is used in the kernel.  But advanced 
mathematics is a ⊂ of mathematics.



Maybe, but I don't think so.  And the hardware is getting more exotic.


IMHO the eccentricity of the hardware has no direct correlation to the 
complexity of the device driver controlling said hardware.


Driving an external serial attached modem does not require advanced 
mathematics.  Creating a software based modem, be it kernel space and / 
or user space, does require advanced mathematics.  Notice how the 
simpler hardware requires more math conversely the more complex hardware 
does more of the work, thus needing simpler drivers.




--
Grant. . . .
unix || die




smime.p7s
Description: S/MIME Cryptographic Signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-03 Thread Sahil Gupta
Guys,
It would be more helpful if everybody states their own experience with
respect to kernel development.
It sounds more like a fight now.
:)
The question was originally asked by "CRISTIAN ANDRES".
He is nowhere in the conversation now.
Let's see if he has some specific query with respect to the ram memory
subsystem.

Cheers
Sahil Gupta


[image: Mailtrack]

Sender
notified by
Mailtrack

10/03/19,
01:18:52 PM

[image: Mailtrack]

Sender
notified by
Mailtrack

10/03/19,
01:19:38 PM

[image: Mailtrack]

Sender
notified by
Mailtrack

10/03/19,
01:20:58 PM

On Thu, Oct 3, 2019 at 12:56 PM Valdis Klētnieks 
wrote:

> On Thu, 03 Oct 2019 06:55:50 -0400, Ruben Safir said:
>
> > I wouldn't call that C code basic.  Regardless, showing an example of a
> > driver that doesn't need math, and it might if you understood the high
> > level math, and your not aware of it, but predictive branching would
> > need it.
>
> See the kernel code that maintains statistical data on likely()/unlikely()
> under CONFIG_PROFILE_ANNOTATED_BRANCHES. Seems like "this likely() actually
> only triggers 3% of the time" isn't exactly higher math.
>
> There may be some magic going on in the chip hardware - but that's in the
> *hardware* and inaccessible to the programmer.  I'll also point out that
> speculative execution has *other* problems.
>
> > You can not calculate simple interest efficiently without calculus.
>
> Simple interest is *easy*.  Amount * percent.  Done.  It's compound
> interest
> that only sort of needs calculus (and there only to understand the limiting
> case) - and even there I doubt any banks actually use calculus, just apply
> the
> iterative approach.
>
> //  yearly interest compounded monthly
> for (i=0;i
> I'd like to see you do it more efficiently using calculus. Especially if
> you
> have to take into account rounding to the nearest penny 36 times for a 3
> year loan.  That stuff is why COBOL is still around. :)
>
> > calculus.  This repeadely ends up being an issue of "if I don't know it,
> > I don't need it", which is wrong.  More math helps you every time.  Math
>
> Somehow I doubt that the Taniyama-Shimura-Weil conjecture is ever
> going to have any relevance inside the kernel.
>
> > is advanced logic.  I can't tell you how many times I see folks brute
> > force their way to solutions that they should be using integration.
>
> Can you show an example of where the kernel needs to be using integration?
> ___
> 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: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-03 Thread Valdis Klētnieks
On Thu, 03 Oct 2019 06:55:50 -0400, Ruben Safir said:

> I wouldn't call that C code basic.  Regardless, showing an example of a
> driver that doesn't need math, and it might if you understood the high
> level math, and your not aware of it, but predictive branching would
> need it.  

See the kernel code that maintains statistical data on likely()/unlikely()
under CONFIG_PROFILE_ANNOTATED_BRANCHES. Seems like "this likely() actually
only triggers 3% of the time" isn't exactly higher math.

There may be some magic going on in the chip hardware - but that's in the
*hardware* and inaccessible to the programmer.  I'll also point out that
speculative execution has *other* problems.

> You can not calculate simple interest efficiently without calculus. 

Simple interest is *easy*.  Amount * percent.  Done.  It's compound interest
that only sort of needs calculus (and there only to understand the limiting
case) - and even there I doubt any banks actually use calculus, just apply the
iterative approach.

//  yearly interest compounded monthly
for (i=0;i calculus.  This repeadely ends up being an issue of "if I don't know it,
> I don't need it", which is wrong.  More math helps you every time.  Math

Somehow I doubt that the Taniyama-Shimura-Weil conjecture is ever
going to have any relevance inside the kernel.

> is advanced logic.  I can't tell you how many times I see folks brute
> force their way to solutions that they should be using integration.

Can you show an example of where the kernel needs to be using integration?


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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-03 Thread Ruben Safir
On 10/3/19 3:00 AM, Greg KH wrote:
> USB4
> spec, and the patches posted to start adding support for that to the
> kernel.  No "math" in there at all other than very simple stuff.
> 
> And no one can say that USB for is not "serious", so I agree with
> Vladis, a deep mathmatical background is not needed for almost all of
> the kernel.  It's just simple C code, nothing to be afraid of.

I wouldn't call that C code basic.  Regardless, showing an example of a
driver that doesn't need math, and it might if you understood the high
level math, and your not aware of it, but predictive branching would
need it.  You can not calculate simple interest efficiently without
calculus.  This repeadely ends up being an issue of "if I don't know it,
I don't need it", which is wrong.  More math helps you every time.  Math
is advanced logic.  I can't tell you how many times I see folks brute
force their way to solutions that they should be using integration.

-- 
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://www.brooklyn-living.com

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

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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-03 Thread Greg KH
On Wed, Oct 02, 2019 at 11:42:04PM -0400, Ruben Safir wrote:
> On 10/2/19 11:35 PM, Valdis Klētnieks wrote:
> >> If you hope to do anything that is not elementry, you need serious math
> >> for the algorithms, not to mention to complete the jobs being done.
> >>
> >> Knowing math is the real key to unlocking to potential of the power of
> >> computational mathmatics.
> > 
> > If you're doing that sort of mathematics *inside the kernel*, there's 
> > probably something
> > wrong with your overall design.
> > 
> 
> Maybe, but I don't think so.  And the hardware is getting more exotic.

"more complex" does not mean "needs more math.  Look at the new USB4
spec, and the patches posted to start adding support for that to the
kernel.  No "math" in there at all other than very simple stuff.

And no one can say that USB for is not "serious", so I agree with
Vladis, a deep mathmatical background is not needed for almost all of
the kernel.  It's just simple C code, nothing to be afraid of.

greg k-h

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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-02 Thread Ruben Safir
On 10/2/19 11:35 PM, Valdis Klētnieks wrote:
> On Wed, 02 Oct 2019 21:47:42 -0400, Ruben Safir said:
> 
>> I've heard this for years and when I went back for my PhD and Masters
>> degree in comp sci, I found out, low and behold, this is just not true.
> 
> The question was specific to *kernel* development.

Actually yes


> 
> Look around.  Does Linus have a PhD?  How many people at the last Kernel 
> Plumber's
> or Kernel Summit have PhDs?
> 

Linus has a Masters in Comp Sci, not that he is the greatest engineer ever.

> I'm willing to bet that there's very few PhD's in CS listed in MAINTAINERS.  
> And
> those that are, are probably coincidental...
> 

I can't testify to that, but there are ton of Master Degree coders and a
lot of mathamaticians.

General plumbing is not needed, but predictive trees, and crypto
certainly do and some hardware problems need calc, or even integration.

The harder the job, the more math is needed.

>> If you hope to do anything that is not elementry, you need serious math
>> for the algorithms, not to mention to complete the jobs being done.
>>
>> Knowing math is the real key to unlocking to potential of the power of
>> computational mathmatics.
> 
> If you're doing that sort of mathematics *inside the kernel*, there's 
> probably something
> wrong with your overall design.
> 

Maybe, but I don't think so.  And the hardware is getting more exotic.

> Just sayin'.
> 
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://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://www.brooklyn-living.com

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

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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-02 Thread Valdis Klētnieks
On Wed, 02 Oct 2019 21:47:42 -0400, Ruben Safir said:

> I've heard this for years and when I went back for my PhD and Masters
> degree in comp sci, I found out, low and behold, this is just not true.

The question was specific to *kernel* development.

Look around.  Does Linus have a PhD?  How many people at the last Kernel 
Plumber's
or Kernel Summit have PhDs?

I'm willing to bet that there's very few PhD's in CS listed in MAINTAINERS.  And
those that are, are probably coincidental...

> If you hope to do anything that is not elementry, you need serious math
> for the algorithms, not to mention to complete the jobs being done.
>
> Knowing math is the real key to unlocking to potential of the power of
> computational mathmatics.

If you're doing that sort of mathematics *inside the kernel*, there's probably 
something
wrong with your overall design.

Just sayin'.


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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-10-02 Thread Ruben Safir
On 9/30/19 1:06 AM, Valdis Klētnieks wrote:
> On Sun, 29 Sep 2019 17:48:43 -0500, CRISTIAN ANDRES VARGAS GONZALEZ said:
> 
>> Hello good morning, to be developed from the kernel do I need to have good
>> math bases? I want to help in the ram memory subsystem and I have that
>> doubt thank you.
> Depends what you mean by "strong math basics".  You'll *definitely* need to
> understand decimal/hexadecimal/binary/octal and how to convert between
> them. Understanding algebra is useful.
> 
> If you've had some intro to complexity theory so you understand why an O(N^2)
> algorithm is usually worse than one that's O(N log N), that helps. Also,
> knowing enough computing theory to understand what a finite state machine is,
> and why to use one, and how to write code to implement one, is useful.
> 
> You *probably* don't need calculus or deep number theory or a lot of other
> pure math.


I've heard this for years and when I went back for my PhD and Masters
degree in comp sci, I found out, low and behold, this is just not true.

If you hope to do anything that is not elementry, you need serious math
for the algorithms, not to mention to complete the jobs being done.

Knowing math is the real key to unlocking to potential of the power of
computational mathmatics.


-- 
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://www.brooklyn-living.com

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

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


Re: Do I need strong mathematical bases to work in the memory subsystem?

2019-09-29 Thread Valdis Klētnieks
On Sun, 29 Sep 2019 17:48:43 -0500, CRISTIAN ANDRES VARGAS GONZALEZ said:

> Hello good morning, to be developed from the kernel do I need to have good
> math bases? I want to help in the ram memory subsystem and I have that
> doubt thank you.

Depends what you mean by "strong math basics".  You'll *definitely* need to
understand decimal/hexadecimal/binary/octal and how to convert between
them. Understanding algebra is useful.

If you've had some intro to complexity theory so you understand why an O(N^2)
algorithm is usually worse than one that's O(N log N), that helps. Also,
knowing enough computing theory to understand what a finite state machine is,
and why to use one, and how to write code to implement one, is useful.

You *probably* don't need calculus or deep number theory or a lot of other
pure math.

Programming in the kernel doesn't require any more math than what's required
for competent programming in userspace.


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


Do I need strong mathematical bases to work in the memory subsystem?

2019-09-29 Thread CRISTIAN ANDRES VARGAS GONZALEZ
Hello good morning, to be developed from the kernel do I need to have good
math bases? I want to help in the ram memory subsystem and I have that
doubt thank you.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


would a Kconfig directive "select CONFIG_x" even work?

2019-04-12 Thread Robert P. J. Day


  i could figure this out by RTFM, i suppose, but what the heck ...
given that the proper Kbuild directive would be:

  select x

what would happen if someone accidentally wrote:

  select CONFIG_x

would that fail to select Kbuild directive "x", or would the Kbuild
system quietly strip the "CONFIG_" prefix because it knew what you
really wanted and was trying to be helpful?

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
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[me: Does Rockchip RK808 driver unload work as intended?]

2018-10-30 Thread Matti Vaittinen
Hello Peeps!

Few months ago I sent question below to clk mailing list. I got zero
replies so I took that as a hint that I am mistaken =) Hence I resend
same question to this list - perhaps this is a better place to search
for answer to (simple) question like this.

- Forwarded message from Matti Vaittinen 
 -

> Date: Fri, 7 Sep 2018 13:19:40 +0300
> From: Matti Vaittinen 
> To: z...@rock-chips.com, mturque...@baylibre.com, sb...@kernel.org, 
> w.ego...@phytec.de
> Cc: linux-...@vger.kernel.org, linux-ker...@vger.kernel.org
> Subject: Does Rockchip RK808 driver unload work as intended?
> User-Agent: Mutt/1.9.2 (2017-12-15)
> 
> Hi dee Ho peeps,
> 
> I was browsing through the clk drivers as I tried to do some cleaning.
> Few days ago I submitted a patch which would add devm variants for
> clkdev lookup registration. I also added devm of_provider registration
> for cases where it is actually the parent device which contains clock
> definitions in DT. This seems to be quite typical for MFDs.
> 
> While doing this I hit to Rockchip RK808 driver which seems to utilize
> oarent device (MFD dev) for pretty much all devm releasing. I wonder if
> this is safe? What happens if one tries to remove the RK808 clk module?
> 
> I guess the clk deregistration and cleanups are not ran as parent device
> stays there, right? But is the clk module and clk module code still
> unload? So won't clk operation pointers registered to clk core become
> invalid?
> 
> I guess I don't have any HW to test this mnyself. And as the driver has
> been there since 2014 - well, chances are the driver does work and I
> just don't get it =)
> 
> So can someone please shed some light on this? Is this a bug or am I
> just plain wrong?
> 
> Br,
>   Matti Vaittinen

- End forwarded message -

-- 
Matti Vaittinen
ROHM Semiconductors

~~~ "I don't think so," said Rene Descartes.  Just then, he vanished ~~~

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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-05 Thread Hugo Lefeuvre
> > It's not duplication, it's increment/decrement of a counter.
> > 
> > Look for functions  with 'get' and 'put' in their names.
> 
> AFAICT counter is f_count in struct file, updated by fget and fput.

Yes, this is the counter I was speaking about. But to me the only way to
increment/decrement this counter was either to duplicate an existing
reference using dup/dup2, or to fork the process. This was wrong, and
I'm glad I learned that.

FTR: After taking a look at the kernel code, the ioctl syscall is
implemented in ksys_ioctl[0], which calls fdget/fdput to get the struct
fd, incrementing and decrementing the count.

Thanks your help !

> > I haven't looked at the code - there's an outside chance that the driver
> > isn't doing reference counting correctly.
> 
> pi433 driver does not mess with struct file too much so I guess it should
> be safe :)

I'll take a closer look at the TODO and come back later with a patch. If
there's nothing to do I'll remove it, otherwise I'll fix it.

Cheers,
 Hugo

[0] https://elixir.bootlin.com/linux/latest/source/fs/ioctl.c#L692

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA

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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-05 Thread valdis . kletnieks
On Tue, 05 Jun 2018 10:20:16 -0400, Hugo Lefeuvre said:

> Thanks. I think I'll have to read the source code to fully understand
> what happens. Do you know what piece of code handles this reference
> duplication ?

It's not duplication, it's increment/decrement of a counter.

Look for functions  with 'get' and 'put' in their names.

> As a conclusion we can assume that ioctl and release never run
> concurrently, and as such the lock introduced in my patch is useless.

Well, they *shouldn't* do so.  What the code actually does, however

> Concerning the TODO at line 876, I think I've misunderstood it. I'll
> think a bit more about it and come back with an updated patch later.

I haven't looked at the code - there's an outside chance that the driver
isn't doing reference counting correctly.


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-05 Thread Hugo Lefeuvre
> > Do you mean that the ioctl/read/write call increments the reference
> > count in this case ? It would mean that these syscalls aren't really
> > using passed FD but instead create duplicates to make sure the open
> > file description won't be freed during their execution, right ?
> 
> One file descriptor is passed around, and each syscall or other code that 
> needs
> to protect it from evaporating out from under it takes a reference.

Thanks. I think I'll have to read the source code to fully understand
what happens. Do you know what piece of code handles this reference
duplication ?

As a conclusion we can assume that ioctl and release never run
concurrently, and as such the lock introduced in my patch is useless.

Concerning the TODO at line 876, I think I've misunderstood it. I'll
think a bit more about it and come back with an updated patch later.

Thanks !

Cheers,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-04 Thread valdis . kletnieks
On Mon, 04 Jun 2018 18:31:31 -0400, Hugo Lefeuvre said:

> Do you mean that the ioctl/read/write call increments the reference
> count in this case ? It would mean that these syscalls aren't really
> using passed FD but instead create duplicates to make sure the open
> file description won't be freed during their execution, right ?

One file descriptor is passed around, and each syscall or other code that needs
to protect it from evaporating out from under it takes a reference.  Think of
it as "How many of you are still using it? 3? OK.. I won't clean up yet. Oh,
it's down to zero? OK, it's clean up time"

Another example of the same sort of thing can be seen in file systems, where
one or more file descriptors can be opened on a given file, and the file is
then unlinked - but the inode and the allocated space doesn't actually get
freed until all the open descriptors (each of which increments the ref count)
are closed and the refcount actually reaches zero.  That's what's going on when
you run 'lsof' and see files listed as '(deleted)', or when you *think* you've
cleaned up the logs, but /var is still sitting at 98%




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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-04 Thread Hugo Lefeuvre
> > > The vfs documentation states: release() is "called when the last
> > > reference to an open file is closed".
> > > 
> > > Let's say we have a program with threads T1 and T2.
> > > 
> > > - T1 calls ioctl on a file descriptor FD.
> > > - (on another processor) T2 closes FD.
> > > 
> > > Since the last reference to FD was closed by T2, release is called.
> 
> That's subtly wrong.  T2 releases its reference to the file descriptor.
>
> > > But while release is being called, the ioctl call from T1 may still
> > > be running, right ?
> 
> Remember that ioctl needs an open FD as well - so the ioctl() grabs its own
> reference, and then *that* reference to the file descriptor stays in place at
> least until the ioctl() return.  At *that* point, the reference count goes to
> zero and the file is actually closed.

Well, my assumption was that T1 and T2 would share the exact same file
descriptor. For example, a main thread T0 would call open() to get the
file descriptor, and then spawn T1 and T2 which would both use this
common FD.

Let's say:

- main thread T0 calls open() and gets FD 3
- T0 spawns T1 and T2
- T1 calls ioctl(3, ...) or read(3, ...)/write(3, ...)
- (on another processor) T2 calls close(3)

Do you mean that the ioctl/read/write call increments the reference
count in this case ? It would mean that these syscalls aren't really
using passed FD but instead create duplicates to make sure the open
file description won't be freed during their execution, right ?

Cheers,
 hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-04 Thread valdis . kletnieks
On Mon, 04 Jun 2018 05:33:03 +0200, Valentin Vidic said:
> On Sun, Jun 03, 2018 at 06:25:56PM -0400, Hugo Lefeuvre wrote:
> > The vfs documentation states: release() is "called when the last
> > reference to an open file is closed".
> > 
> > Let's say we have a program with threads T1 and T2.
> > 
> > - T1 calls ioctl on a file descriptor FD.
> > - (on another processor) T2 closes FD.
> > 
> > Since the last reference to FD was closed by T2, release is called.

That's subtly wrong.  T2 releases its reference to the file descriptor.

> > But while release is being called, the ioctl call from T1 may still
> > be running, right ?

Remember that ioctl needs an open FD as well - so the ioctl() grabs its own
reference, and then *that* reference to the file descriptor stays in place at
least until the ioctl() return.  At *that* point, the reference count goes to
zero and the file is actually closed.


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-04 Thread Hugo Lefeuvre
> Nothing fancy, just added debug print statements to the release
> and ioctl methods of the pi433 driver.  The ioctl method also has
> a 5s sleep so it takes some time to execute while the other thread
> calls close on the same file descriptor.
> 
> The timing should be as follows:
> 
> 0s thread1 and thread2 start
> 0s thread1 calls ioctl
> 1s thread2 calls close
> 1s thread2 close returns
> 5s thread1 ioctl returns
> 
> Adding a dump_stack() call to both driver methods shows that ioctl is
> called directly:
> 
> [236449.534358] [<8010ffd8>] (unwind_backtrace) from [<8010c240>] 
> (show_stack+0x20/0x24)
> [236449.534378] [<8010c240>] (show_stack) from [<807840a4>] 
> (dump_stack+0xd4/0x118)
> [236449.534413] [<807840a4>] (dump_stack) from [<7f5e5348>] 
> (pi433_ioctl+0x64/0x324 [pi433])
> [236449.534457] [<7f5e5348>] (pi433_ioctl [pi433]) from [<8029dbe0>] 
> (do_vfs_ioctl+0xac/0x7c4)
> [236449.534472] [<8029dbe0>] (do_vfs_ioctl) from [<8029e33c>] 
> (SyS_ioctl+0x44/0x6c)
> [236449.534488] [<8029e33c>] (SyS_ioctl) from [<80108060>] 
> (ret_fast_syscall+0x0/0x28)
> 
> while the release gets called from task_work_run:
> 
> [236454.624185] [<8010ffd8>] (unwind_backtrace) from [<8010c240>] 
> (show_stack+0x20/0x24)
> [236454.624204] [<8010c240>] (show_stack) from [<807840a4>] 
> (dump_stack+0xd4/0x118)
> [236454.624240] [<807840a4>] (dump_stack) from [<7f5e508c>] 
> (pi433_release+0x48/0xc0 [pi433])
> [236454.624270] [<7f5e508c>] (pi433_release [pi433]) from [<8028bab0>] 
> (__fput+0x9c/0x1e8)
> [236454.624288] [<8028bab0>] (__fput) from [<8028bc6c>] (fput+0x18/0x1c)
> [236454.624304] [<8028bc6c>] (fput) from [<8013bbf8>] 
> (task_work_run+0xbc/0xe0)
> [236454.624322] [<8013bbf8>] (task_work_run) from [<8010b810>] 
> (do_work_pending+0xcc/0xd0)
> [236454.624340] [<8010b810>] (do_work_pending) from [<80108094>] 
> (slow_work_pending+0xc/0x20)

Interesting. I don't know what's happening here, but the idea that
release() would be delayed until all operations returned (as nice
as it sounds) seems pretty odd to me.

I'll not have time to experiment on this today, but this is definitely
worth taking a look.

Cheers,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-04 Thread Valentin Vidic
On Mon, Jun 04, 2018 at 06:27:43AM +, Nicholas Mc Guire wrote:
> are you using kprobes to get this information or how did you trace
> these calls ? could you explain how you did that ? I assume that
> would be of interest to others as well not only me.

Nothing fancy, just added debug print statements to the release
and ioctl methods of the pi433 driver.  The ioctl method also has
a 5s sleep so it takes some time to execute while the other thread
calls close on the same file descriptor.

The timing should be as follows:

0s thread1 and thread2 start
0s thread1 calls ioctl
1s thread2 calls close
1s thread2 close returns
5s thread1 ioctl returns

Adding a dump_stack() call to both driver methods shows that ioctl is
called directly:

[236449.534358] [<8010ffd8>] (unwind_backtrace) from [<8010c240>] 
(show_stack+0x20/0x24)
[236449.534378] [<8010c240>] (show_stack) from [<807840a4>] 
(dump_stack+0xd4/0x118)
[236449.534413] [<807840a4>] (dump_stack) from [<7f5e5348>] 
(pi433_ioctl+0x64/0x324 [pi433])
[236449.534457] [<7f5e5348>] (pi433_ioctl [pi433]) from [<8029dbe0>] 
(do_vfs_ioctl+0xac/0x7c4)
[236449.534472] [<8029dbe0>] (do_vfs_ioctl) from [<8029e33c>] 
(SyS_ioctl+0x44/0x6c)
[236449.534488] [<8029e33c>] (SyS_ioctl) from [<80108060>] 
(ret_fast_syscall+0x0/0x28)

while the release gets called from task_work_run:

[236454.624185] [<8010ffd8>] (unwind_backtrace) from [<8010c240>] 
(show_stack+0x20/0x24)
[236454.624204] [<8010c240>] (show_stack) from [<807840a4>] 
(dump_stack+0xd4/0x118)
[236454.624240] [<807840a4>] (dump_stack) from [<7f5e508c>] 
(pi433_release+0x48/0xc0 [pi433])
[236454.624270] [<7f5e508c>] (pi433_release [pi433]) from [<8028bab0>] 
(__fput+0x9c/0x1e8)
[236454.624288] [<8028bab0>] (__fput) from [<8028bc6c>] (fput+0x18/0x1c)
[236454.624304] [<8028bc6c>] (fput) from [<8013bbf8>] 
(task_work_run+0xbc/0xe0)
[236454.624322] [<8013bbf8>] (task_work_run) from [<8010b810>] 
(do_work_pending+0xcc/0xd0)
[236454.624340] [<8010b810>] (do_work_pending) from [<80108094>] 
(slow_work_pending+0xc/0x20)

-- 
Valentin

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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-03 Thread Valentin Vidic
On Sun, Jun 03, 2018 at 06:25:56PM -0400, Hugo Lefeuvre wrote:
> The vfs documentation states: release() is "called when the last
> reference to an open file is closed".
> 
> Let's say we have a program with threads T1 and T2.
> 
> - T1 calls ioctl on a file descriptor FD.
> - (on another processor) T2 closes FD.
> 
> Since the last reference to FD was closed by T2, release is called.
> But while release is being called, the ioctl call from T1 may still
> be running, right ?

Indeed, I did a quick test and close can return in userspace before
ioctl has finished.  But in kernel space release does not even start
until ioctl has finished.  So it seems there exists some mechanism to
delay release until all operations on a file descriptor have finished?

View from userspace:

1528082878 opened file 3
1528082878 ioctl start 3
1528082879 close start 3
1528082879 close return 0
1528082883 ioctl return 0

View from kernelspace:

[215422.216734] pi433 pi433.0: ioctl: sleep
[215427.296761] pi433 pi433.0: ioctl: start
[215427.296772] pi433 pi433.0: ioctl: rdtx
[215427.296783] pi433 pi433.0: ioctl: rdtx done
[215427.296792] pi433 pi433.0: ioctl: return 0
[215427.296807] pi433 pi433.0: release: start
[215427.296816] pi433 pi433.0: release: return

-- 
Valentin

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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-03 Thread Hugo Lefeuvre
> > So, if pi433_release() and pi433_ioctl() can be concurrently executed
> > then this issue might happen.
> 
> But isn't release() called when nothing is referencing the file anymore,
> so there should be no other file operation running concurrently?

The vfs documentation states: release() is "called when the last
reference to an open file is closed".

Let's say we have a program with threads T1 and T2.

- T1 calls ioctl on a file descriptor FD.
- (on another processor) T2 closes FD.

Since the last reference to FD was closed by T2, release is called.
But while release is being called, the ioctl call from T1 may still
be running, right ?

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-06-03 Thread Valentin Vidic
On Wed, May 30, 2018 at 09:44:32PM -0400, Hugo Lefeuvre wrote:
> So, if pi433_release() and pi433_ioctl() can be concurrently executed
> then this issue might happen.

But isn't release() called when nothing is referencing the file anymore,
so there should be no other file operation running concurrently?

-- 
Valentin

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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-30 Thread Hugo Lefeuvre
> > For example the TODO entry at line 876: If pi433_release() is
> > called while pi433_ioctl() is executing between lines 879 and
> > 880, we might perform a NULL pointer dereference, right ?
> 
> Yes, no, maybe.  That's what kernel locks are for.  Is that data
> protected against concurrent access by a lock of some sort?

No, I don't think so. The release function doesn't ask for any kind
of lock before freeing that data, nor does the ioctl function. Also,
this ioctl function is unlocked_ioctl, so AFAIK it should be self
responsible for locking/synchronization stuff (most docs I've
read are getting pretty old now, from the 2.6 times where the BKL
was still something 'common' and lots of drivers were still using
ioctl(), but I don't think it's the case anymore).

So, if pi433_release() and pi433_ioctl() can be concurrently executed
then this issue might happen.

I'll submit a patch. Thanks !

Cheers,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-30 Thread valdis . kletnieks
On Tue, 29 May 2018 22:56:57 -0400, Hugo Lefeuvre said:

> For example the TODO entry at line 876: If pi433_release() is
> called while pi433_ioctl() is executing between lines 879 and
> 880, we might perform a NULL pointer dereference, right ?

Yes, no, maybe.  That's what kernel locks are for.  Is that data
protected against concurrent access by a lock of some sort?


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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-29 Thread Hugo Lefeuvre
Hi Greg,

> No need to coordinate anything, just start sending patches against the
> latest development tree (linux-next, or the staging.git staging-next
> branch), and all will be fine.
> 
> If there are conflicts, the maintainer will let you know, but they are
> usually quite rare.

Then I will simply submit my patch and let the maintainer check for
conflicts.

Thanks for your answer.

Cheers,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-29 Thread Hugo Lefeuvre
Hi Valdis,

> The canonical place to check would be the git tree for drivers/staging:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/
> 
> In general, if there's other people doing active development, they'll show
> up in 'git log -- drivers/staging/pi433/'
> 
> And there's only one person doing a lot of patching - and most of those are
> coding style - though he did do a locking fix in April.
> 
> What particular issue are you looking at?

For example the TODO entry at line 876: If pi433_release() is
called while pi433_ioctl() is executing between lines 879 and
880, we might perform a NULL pointer dereference, right ?

Regards,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-28 Thread Greg KH
On Mon, May 28, 2018 at 11:07:06PM -0400, Hugo Lefeuvre wrote:
> Hi,
> 
> I've started to take a look at TODO entries in the staging drivers
> subtree and found some issues in pi433 I'd like to work on. Before
> starting to prepare my patch, I tried to check the LKML and the bug
> tracker to make sure nobody was working on the same issues as me
> (this driver seems to be pretty actively developed), but couldn't
> find anything helpful. No mailing list, nobody coordinating, only
> single patches without relationship.
> 
> Did I miss something ? Is there a specific place where I can coordinate
> with the rest of the kernel dev community and make people aware I'm
> working on this particular issue ? (apart from the bug tracker, which
> doesn't seem to be very active when it comes to the staging subtree)

No need to coordinate anything, just start sending patches against the
latest development tree (linux-next, or the staging.git staging-next
branch), and all will be fine.

If there are conflicts, the maintainer will let you know, but they are
usually quite rare.

good luck!

greg k-h

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


Re: develoment workflow: how to avoid duplicate work ?

2018-05-28 Thread valdis . kletnieks
On Mon, 28 May 2018 23:07:06 -0400, Hugo Lefeuvre said:

> Did I miss something ? Is there a specific place where I can coordinate
> with the rest of the kernel dev community and make people aware I'm
> working on this particular issue ? (apart from the bug tracker, which
> doesn't seem to be very active when it comes to the staging subtree)

The canonical place to check would be the git tree for drivers/staging:

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/

In general, if there's other people doing active development, they'll show
up in 'git log -- drivers/staging/pi433/'

And there's only one person doing a lot of patching - and most of those are
coding style - though he did do a locking fix in April.

What particular issue are you looking at?


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


develoment workflow: how to avoid duplicate work ?

2018-05-28 Thread Hugo Lefeuvre
Hi,

I've started to take a look at TODO entries in the staging drivers
subtree and found some issues in pi433 I'd like to work on. Before
starting to prepare my patch, I tried to check the LKML and the bug
tracker to make sure nobody was working on the same issues as me
(this driver seems to be pretty actively developed), but couldn't
find anything helpful. No mailing list, nobody coordinating, only
single patches without relationship.

Did I miss something ? Is there a specific place where I can coordinate
with the rest of the kernel dev community and make people aware I'm
working on this particular issue ? (apart from the bug tracker, which
doesn't seem to be very active when it comes to the staging subtree)

Thanks !

Regards,
 Hugo

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


How does the Deadline IO Scheduler work?

2018-01-24 Thread Sreyan Chakravarty
I am trying my best to understand how the deadline scheduler actually works
for certain scenarios. But there is actually a lack of proper documentation
for IO Schedulers in particular.

Hence I would be really grateful if someone would help me clearing my
doubts:

My questions are as follows:

1) Since the deadline scheduler copies each request into two queues ie. the
sorted by block number and the queue sorted by deadlines.

So effectively there are two copies of the same IO request.

So what happens if a request is serviced from the deadline queue. How is
that request's corresponding version removed from the sorted queue? A queue
is not a random access data structure, thus to remove the request from the
sorted queue the kernel must traverse the head and delink the request if
the queue is implemented via a linked list.

Otherwise the kernel must be keeping track of the requests that have
already executed.

So how does the kernel handle this?

2) Imagine the device is busy serving a request for block 50 the next
request is for block 56, then a request for block 30 comes in.

What does the scheduler do? Does it keep go on to dispatch the request for
block 56? Or does it pick block 30 since the scheduler performs sorting?

If it picks block 56 that makes sense since it is desirable for the disk
head to move in one direction rather than going back to 30. But then how is
the sorting done?

If it picks 30 then the sorting is taken care of but then the disk is
doubling back and there is little benefit to the sorting step.

So which one of the above will happen.

Would be very helpful if someone helped me understand these doubts.

Regards,
Sreyan Chakravarty
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: sched_child_runs_first doesn't work

2017-12-10 Thread Rock Lee
On Sat, Dec 9, 2017 at 11:42 PM, strongbox8  wrote:
> in my test, it has a chance to get the output from the child first using the
> taskset command. otherwise, the child and the parent are always on different
> cores in which case i think the parent is running and the child is on the
> rbtree of runqueue of other core just after fork at the most moment
>

Your explanation is right. Child process doesn't have chance to run
util parent's time slice is over(Even though there's no time slice
concept in CFS). From the print, it looked like parent process run
first. So we need force parent and child process re-schedule before
print, so that child prcess have the chance to compare "vruntime" with
parent process. In this situation, we could see child process run
first. I modified the test code like this, "sleep (1);" added :

#include 
#include 
#include 

int main(void)
{
struct timeval tv;
struct timezone tz;
int err;
pid_t ret = fork();

sleep(1);

if (ret == 0) {
err = gettimeofday(, );
if (!err)
printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);

 printf("this child.\n");
} else if (ret > 1) {
err = gettimeofday(, );

if (!err)
printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
printf("this father.\n");
} else
printf("err!!\n");
return 0;
}

Executed this app like this:

# taskset 1 ./fork

In the end, I could get child prcess run first sometimes.

-- 
Cheers,
Rock

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


Re: sched_child_runs_first doesn't work

2017-12-09 Thread strongbox8
in my test, it has a chance to get the output from the child first using the taskset command. otherwise, the child and the parent are always on different cores in which case i think the parent is running and the child is on the rbtree of runqueue of other core just after fork at the most moment





在 valdis.kletni...@vt.edu,2017年12月9日 16:20写道:On Sat, 09 Dec 2017 11:04:09 +0330, alireza sanaee said:

> I think if it works in that way, it doesn't make sense at all Parent
> and child ordering rules should preserve even on different cores!

Find where in kernel/sched.c there's specific code to guarantee that
if the child/parent is started on one core, the other isn't scheduled again
until after the first one runs, rather than run immediately because it's
able to run on an otherwise idle core, so you don't get a 'first' or
'last', but 'at the same time'.

And if they run concurrently, the printf output will have a race
condition.  At that point, the order of output is probably determined
by something other than which one scheduled first (the I/O stack
or exit() processing being the primary suspects).

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


Re: sched_child_runs_first doesn't work

2017-12-09 Thread valdis . kletnieks
On Sat, 09 Dec 2017 11:04:09 +0330, alireza sanaee said:

> I think if it works in that way, it doesn't make sense at all Parent
> and child ordering rules should preserve even on different cores!

Find where in kernel/sched.c there's specific code to guarantee that
if the child/parent is started on one core, the other isn't scheduled again
until after the first one runs, rather than run immediately because it's
able to run on an otherwise idle core, so you don't get a 'first' or
'last', but 'at the same time'.

And if they run concurrently, the printf output will have a race
condition.  At that point, the order of output is probably determined
by something other than which one scheduled first (the I/O stack
or exit() processing being the primary suspects).


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


Re: sched_child_runs_first doesn't work

2017-12-08 Thread alireza sanaee
I think if it works in that way, it doesn't make sense at all Parent
and child ordering rules should preserve even on different cores!

On Fri, Dec 8, 2017 at 9:06 PM, Perr Zhang  wrote:

>
> maybe you should run the program like this:
>
> taskset 1 ./your_test_app
>
>
> ___
> 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: sched_child_runs_first doesn't work

2017-12-08 Thread Perr Zhang

maybe you should run the program like this:



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


Re: sched_child_runs_first doesn't work

2017-12-08 Thread YU Bo
Hi,
On Fri, Dec 08, 2017 at 11:07:15AM +0800, Rock Lee wrote:
>Hi,
>
>I ran my test code but always got the father process run first, even
>after setting sched_child_runs_first. Could anyone give me a hint?
>Here is my test code.
>
>#include 
>#include 
>#include 
>
>int main(void)
>{
>struct timeval tv;
>struct timezone tz;
>int err;
>pid_t ret = fork();
>
>if (ret == 0) {
>err = gettimeofday(, );
>if (!err)
>printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
>
> printf("this child.\n");
>} else if (ret > 1) {
>err = gettimeofday(, );
>
>if (!err)
>printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
>printf("this father.\n");
>} else
>printf("err!!\n");
>return 0;
>}
>

Maybe here:

https://stackoverflow.com/questions/17391201/does-proc-sys-kernel-sched-child-runs-first-work

Bo
>
>--
>Cheers,
>Rock
>
>___
>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: sched_child_runs_first doesn't work

2017-12-08 Thread Rock Lee
Hi,
I tried a test in that code without any gettimeofday, the result is
the same. BTW, I've tried on my raspberrpi 3 with kernel 4.13.
Moreover, I also tried several ubuntu 16.04. The result were always
father process ran first.

On Fri, Dec 8, 2017 at 1:53 PM, Mulyadi Santosa
 wrote:
>
>
> On Fri, Dec 8, 2017 at 10:07 AM, Rock Lee  wrote:
>>
>> Hi,
>>
>> I ran my test code but always got the father process run first, even
>> after setting sched_child_runs_first. Could anyone give me a hint?
>> Here is my test code.
>>
>> #include 
>> #include 
>> #include 
>>
>> int main(void)
>> {
>> struct timeval tv;
>> struct timezone tz;
>> int err;
>> pid_t ret = fork();
>>
>> if (ret == 0) {
>> err = gettimeofday(, );
>> if (!err)
>> printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
>>
>>  printf("this child.\n");
>> } else if (ret > 1) {
>> err = gettimeofday(, );
>>
>> if (!err)
>> printf("father time sec %d, usec %d\n", tv.tv_sec,
>> tv.tv_usec);
>> printf("this father.\n");
>> } else
>> printf("err!!\n");
>> return 0;
>> }
>>
>>
>> --
>> Cheers,
>> Rock
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> Hi...
>
> IIRC, gettimeofday() will eventually call system call (with the same name, I
> think). And I guess this is where the root cause come.
>
> Your child might actually ran first, but since it called system call,
> re-scheduling the kicked in, and parent got the chance to run.
>
> In order to prove this theory, try to execute printf("this is parent") or
> printf("this is child") first, then gettimeofday() later.
>
> Good luck and cmiiw
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com



-- 
Cheers,
Rock

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


Re: sched_child_runs_first doesn't work

2017-12-08 Thread Rock Lee
Hi,
I know the vfork guarantees the children run first. I am just curious
why sched_child_runs_first doesn't work. If there is a chance that
child process run first, I would be more glade, since I guess that how
it works, works with probability. However I tried more the 30+ times,
the result was always father process ran first. Eventhough I have't
tried that much, I guess my result still told the truth ---
sched_child_runs_first doesn't work at all.

On Fri, Dec 8, 2017 at 3:50 PM, Alexander Kapshuk
<alexander.kaps...@gmail.com> wrote:
> If  my understanding of what Linus says in the post referenced below
> is correct, there's never a guarantee which process would run first,
> parent or child.
> http://yarchive.net/comp/linux/child-runs-first.html
>
> vfork(), on the other hand, is said in the post to always run the
> child process first. See below for an example.
> #include 
> #include 
> #include 
> #include 
>
> int main(void)
> {
> struct timeval tv;
>
> switch(vfork()) {
> case -1:
> perror("vfork failed\n");
> exit(-1);
> case 0:
> if (gettimeofday(, NULL) == 0)
> printf("child time sec %ld, usec %ld\n",
> tv.tv_sec, tv.tv_usec);
> exit(0);
> default:
> if (gettimeofday(, NULL) == 0)
> printf("parent time sec %ld, usec %ld\n",
> tv.tv_sec, tv.tv_usec);
> }
> return 0;
> }
>
> Sample run:
> ./gettimeofday
> child time sec 1512719270, usec 716672
> parent time sec 1512719270, usec 716748



-- 
Cheers,
Rock

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


Re: sched_child_runs_first doesn't work

2017-12-07 Thread Alexander Kapshuk
If  my understanding of what Linus says in the post referenced below
is correct, there's never a guarantee which process would run first,
parent or child.
http://yarchive.net/comp/linux/child-runs-first.html

vfork(), on the other hand, is said in the post to always run the
child process first. See below for an example.
#include 
#include 
#include 
#include 

int main(void)
{
struct timeval tv;

switch(vfork()) {
case -1:
perror("vfork failed\n");
exit(-1);
case 0:
if (gettimeofday(, NULL) == 0)
printf("child time sec %ld, usec %ld\n",
tv.tv_sec, tv.tv_usec);
exit(0);
default:
if (gettimeofday(, NULL) == 0)
printf("parent time sec %ld, usec %ld\n",
tv.tv_sec, tv.tv_usec);
}
return 0;
}

Sample run:
./gettimeofday
child time sec 1512719270, usec 716672
parent time sec 1512719270, usec 716748

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


Re: sched_child_runs_first doesn't work

2017-12-07 Thread Mulyadi Santosa
On Fri, Dec 8, 2017 at 10:07 AM, Rock Lee  wrote:

> Hi,
>
> I ran my test code but always got the father process run first, even
> after setting sched_child_runs_first. Could anyone give me a hint?
> Here is my test code.
>
> #include 
> #include 
> #include 
>
> int main(void)
> {
> struct timeval tv;
> struct timezone tz;
> int err;
> pid_t ret = fork();
>
> if (ret == 0) {
> err = gettimeofday(, );
> if (!err)
> printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
>
>  printf("this child.\n");
> } else if (ret > 1) {
> err = gettimeofday(, );
>
> if (!err)
> printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
> printf("this father.\n");
> } else
> printf("err!!\n");
> return 0;
> }
>
>
> --
> Cheers,
> Rock
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


Hi...

IIRC, gettimeofday() will eventually call system call (with the same name,
I think). And I guess this is where the root cause come.

Your child might actually ran first, but since it called system call,
re-scheduling the kicked in, and parent got the chance to run.

In order to prove this theory, try to execute printf("this is parent") or
printf("this is child") first, then gettimeofday() later.

Good luck and cmiiw

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


sched_child_runs_first doesn't work

2017-12-07 Thread Rock Lee
Hi,

I ran my test code but always got the father process run first, even
after setting sched_child_runs_first. Could anyone give me a hint?
Here is my test code.

#include 
#include 
#include 

int main(void)
{
struct timeval tv;
struct timezone tz;
int err;
pid_t ret = fork();

if (ret == 0) {
err = gettimeofday(, );
if (!err)
printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);

 printf("this child.\n");
} else if (ret > 1) {
err = gettimeofday(, );

if (!err)
printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
printf("this father.\n");
} else
printf("err!!\n");
return 0;
}


-- 
Cheers,
Rock

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


Aw: Re: SD card wont work with dw_mmc driver in linux. Error -84 EILSEQ

2017-12-02 Thread John Smith
I figured out it, was a HW issue, caused of bad connections on the datalines.

These results a CRC and EBE (End-Bit-Error) and make read/write operations fail.

Hope it helps anybody.

 

Best,

john s.

 

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


Re: SD card wont work with dw_mmc driver in linux. Error -84 EILSEQ

2017-11-28 Thread Greg KH
On Mon, Nov 27, 2017 at 06:26:04PM +0100, John Smith wrote:
> CMD18 Multiblockread and CMD17 Single block read are failing during driver
> initialisation sequence.. I can not figure out, what the problem is. These 
> CMDs
> return with -84, which means:
> 
>  * EILSEQ   Basic format problem with the received or sent data
>  *  (e.g. CRC check failed, incorrect opcode in response
>  *  or bad end bit)
> 
> I am able to load files from the sd card in uboot and most of the CMDs are 
> also
> working in the dw_mmc driver as you can see below.
> 
>  
> 
> Clock is set to 25MHz, tested are two different sd cards (=same result). 
> ARMv7,
> Kernel 4.0, dw_mmc driver

Kernel release 4.0 is really really old, please try something newer and
more modern please.

And why not ask this on the mailing list for this subsystem?  The
developers there can help you out best.

thanks,

greg k-h

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


SD card wont work with dw_mmc driver in linux. Error -84 EILSEQ

2017-11-28 Thread John Smith

CMD18 Multiblockread and CMD17 Single block read are failing during driver initialisation sequence.. I can not figure out, what the problem is. These CMDs return with -84, which means:

 * EILSEQ   Basic format problem with the received or sent data
 *  (e.g. CRC check failed, incorrect opcode in response
 *  or bad end bit)


I am able to load files from the sd card in uboot and most of the CMDs are also working in the dw_mmc driver as you can see below.

 

Clock is set to 25MHz, tested are two different sd cards (=same result). ARMv7, Kernel 4.0, dw_mmc driver

 

device: 'mmc.0': device_add
bus: 'platform': add device mmc.0
bus: 'mmc': registered
device class 'mmc_host': registering
Driver 'mmcblk' needs updating - please use bus_type methods
bus: 'mmc': add driver mmcblk
bus: 'platform': add driver dw_mmc
bus: 'platform': add driver dwmmc_adi
bus: 'platform': driver_probe_device: matched device mmc.0 with driver dwmmc_adi
bus: 'platform': really_probe: probing driver dwmmc_adi with device mmc.0
pinctrl-adi2 pinctrl-adi2.0: found group selector 21 for mmc0grp
pinctrl-adi2 pinctrl-adi2.0: request pin 76 (PE12) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 77 (PE13) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 78 (PE14) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 79 (PE15) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 80 (PF0) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 81 (PF1) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 82 (PF2) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 83 (PF3) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 87 (PF7) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 84 (PF4) for mmc.0
pinctrl-adi2 pinctrl-adi2.0: request pin 44 (PC12) for mmc.0
dwmmc_adi mmc.0: num-slots property not found, assuming 1 slot is available
dwmmc_adi mmc.0: obtain a copy of previously claimed pinctrl
dwmmc_adi mmc.0: IDMAC supports 32-bit address mode.
dwmmc_adi mmc.0: Using internal DMA controller.
dwmmc_adi mmc.0: Version ID is 270a
dwmmc_adi mmc.0: DW MMC controller at irq 73, 32 bit host data width, 1024 deep fifo
dwmmc_adi mmc.0: No vmmc regulator found
dwmmc_adi mmc.0: No vqmmc regulator found
dwmmc_adi mmc.0: GPIO lookup for consumer wp
dwmmc_adi mmc.0: using device tree for GPIO lookup
of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/scb/mmc@0x3101[0]'
of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/scb/mmc@0x3101[0]'
dwmmc_adi mmc.0: using lookup tables for GPIO lookup
dwmmc_adi mmc.0: lookup for GPIO wp failed
mmc_host mmc0: card is non-removable.
device: 'mmc0': device_add
mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 0 timing 0
dwmmc_adi mmc.0: Initial signal voltage of 3.3v
mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 21 width 0 timing 0
dwmmc_adi mmc.0: 1 slots initialized
driver: 'dwmmc_adi': driver_bound: bound to device 'mmc.0'
bus: 'platform': really_probe: bound device mmc.0 to driver dwmmc_adi
mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
mmc0: starting CMD52 arg 0c00 flags 0195
mmc0: req done (CMD52): -110:    
mmc0: starting CMD52 arg 8c08 flags 0195
mmc0: req done (CMD52): -110:    
mmc0: clock 40Hz busmode 2 powermode 2 cs 1 Vdd 21 width 0 timing 0
mmc0: starting CMD0 arg  flags 00c0
mmc0: req done (CMD0): 0:    
mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 21 width 0 timing 0
mmc0: starting CMD8 arg 01aa flags 02f5
mmc0: req done (CMD8): 0: 01aa   
mmc0: starting CMD5 arg  flags 02e1
mmc0: req failed (CMD5): -110, retrying...
mmc0: req failed (CMD5): -110, retrying...
mmc0: req failed (CMD5): -110, retrying...
mmc0: req done (CMD5): -110: 01aa   
mmc0: starting CMD55 arg  flags 00f5
mmc0: req done (CMD55): 0: 00400120   
mmc0: starting CMD41 arg  flags 00e1
mmc0: req done (CMD41): 0: 00ff8000   
mmc0: clock 40Hz busmode 2 powermode 2 cs 1 Vdd 21 width 0 timing 0
mmc0: starting CMD0 arg  flags 00c0
mmc0: req done (CMD0): 0:    
mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 21 width 0 timing 0
mmc0: starting CMD8 arg 01aa flags 02f5
mmc0: req done (CMD8): 0: 01aa   
mmc0: starting CMD55 arg  flags 00f5
mmc0: req done (CMD55): 0: 0120   
mmc0: starting CMD41 arg 4020 flags 00e1
mmc0: req done (CMD41): 0: 00ff8000   
mmc0: starting CMD55 arg  flags 00f5
mmc0: req done (CMD55): 0: 0120   
mmc0: starting CMD41 arg 4020 flags 00e1
mmc0: req done (CMD41): 0: 80ff8000   
mmc0: starting CMD2 arg  flags 0067
mmc0: req 

Re: why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

2017-11-21 Thread ayaka


On 11/19/2017 09:56 PM, Max Filippov wrote:
> On Sat, Nov 18, 2017 at 7:36 PM, ayaka  wrote:
>> What I want is a relaxed version of the io{read,write}32, as I don't need to
>> flush between I am writing the registers table into the registers. I only
>> want to flush the cache at the last and isolated register which I will set
>> later.
> None of these functions do anything with cache. And with
> devm_ioremap_resource you will likely get an uncached mapping of your
> IO memory, so you don't even need to manage cache.
I didn't notice that the IO memory is not cached at the most platform, 
even the ldd3 have said that.
> What you still need to preserve the order of writes is a memory barrier,
> and none of io{read,write}32 do it either. You can insert proper barrier
> before the write to that last isolated register.
I see, thank you.


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


Re: why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

2017-11-19 Thread Max Filippov
On Sat, Nov 18, 2017 at 7:36 PM, ayaka  wrote:
> What I want is a relaxed version of the io{read,write}32, as I don't need to
> flush between I am writing the registers table into the registers. I only
> want to flush the cache at the last and isolated register which I will set
> later.

None of these functions do anything with cache. And with
devm_ioremap_resource you will likely get an uncached mapping of your
IO memory, so you don't even need to manage cache.

What you still need to preserve the order of writes is a memory barrier,
and none of io{read,write}32 do it either. You can insert proper barrier
before the write to that last isolated register.

-- 
Thanks.
-- Max

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


Re: why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

2017-11-18 Thread ayaka


On 11/18/2017 11:50 PM, Max Filippov wrote:
> On Thu, Nov 16, 2017 at 12:12 PM, ayaka <ay...@soulik.info> wrote:
>> #if 1
>>   for (i = 0; i < count; i++) {
>>   u32 *cur = (u32 *)buffer;
>>   u32 pos = offset + i * 4;
>>
>>   cur += i;
>>   mpp_debug(DEBUG_SET_REG, "write reg[%03d]: %08x\n",
>> pos / 4, *cur);
>>   iowrite32(*cur, mpp_dev->reg_base + pos);
>> }
>> #else
>>   iowrite32_rep(mpp_dev->reg_base + offset, buffer, count);
>> mb();
>>   for (i = 0; i < count; i++) {
>>   u32 cur = 0;
>>   u32 pos = offset / 4 + i;
>>
>>   cur = ioread32(mpp_dev->reg_base + pos * 4);
>>   pr_info("get reg[%03d]: %08x\n", pos, cur);
>> }
>> #endif
> The loop with iowrite32 writes consecutive u32 words from buffer
> to consecutive IO memory locations. But iowrite32_rep writes
> consecutive u32 words from buffer to the same IO memory location.
> So they do different things when count > 1.
>
Thank you I think that explain why it doesn't work.

What I want is a relaxed version of the io{read,write}32, as I don't 
need to flush between I am writing the registers table into the 
registers. I only want to flush the cache at the last and isolated 
register which I will set later.

Is there any suggest about that?

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


why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

2017-11-18 Thread ayaka
Hello All:

   I am writing a driver, I need to write a series of values into the 
registers. The old code use the writel_relaxed() to avoid flushing cache 
between echo of register. I want to use the recommended way of the io 
operations, so I choose the iowrite32()_req(), but I found what it wrote 
nothing, I read it at once after a memory barrier, there is no contents 
there. But it I use the iowrite32() with a loop, it works well and the 
registers of the device is configured.  What make this problem?

The io memory is assigned with devm_ioremap_resource().

void mpp_dev_write_seq(struct rockchip_mpp_dev *mpp_dev, unsigned long 
offset,
    void *buffer, unsigned long count)
{
     int i;
#if 1
     for (i = 0; i < count; i++) {
     u32 *cur = (u32 *)buffer;
     u32 pos = offset + i * 4;

     cur += i;
     mpp_debug(DEBUG_SET_REG, "write reg[%03d]: %08x\n", 
pos, *cur);
     iowrite32(*cur, mpp_dev->reg_base + pos);
}
#else
     iowrite32_rep(mpp_dev->reg_base + offset, buffer, count);
mb();
     for (i = 0; i < count; i++) {
     u32 cur = 0;
     u32 pos = offset / 4 + i;

     cur = ioread32(mpp_dev->reg_base + pos * 4);
     pr_info("get reg[%03d]: %08x\n", pos, cur);
}
#endif

}


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


Re: why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

2017-11-18 Thread Max Filippov
On Thu, Nov 16, 2017 at 12:12 PM, ayaka  wrote:
> #if 1
>  for (i = 0; i < count; i++) {
>  u32 *cur = (u32 *)buffer;
>  u32 pos = offset + i * 4;
>
>  cur += i;
>  mpp_debug(DEBUG_SET_REG, "write reg[%03d]: %08x\n",
> pos, *cur);
>  iowrite32(*cur, mpp_dev->reg_base + pos);
> }
> #else
>  iowrite32_rep(mpp_dev->reg_base + offset, buffer, count);
> mb();
>  for (i = 0; i < count; i++) {
>  u32 cur = 0;
>  u32 pos = offset / 4 + i;
>
>  cur = ioread32(mpp_dev->reg_base + pos * 4);
>  pr_info("get reg[%03d]: %08x\n", pos, cur);
> }
> #endif

The loop with iowrite32 writes consecutive u32 words from buffer
to consecutive IO memory locations. But iowrite32_rep writes
consecutive u32 words from buffer to the same IO memory location.
So they do different things when count > 1.

-- 
Thanks.
-- Max

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


Re: My network device don't work

2017-06-20 Thread Tobin C. Harding
On Tue, Jun 20, 2017 at 10:12:34PM +0800, Greg KH wrote:
> On Tue, Jun 20, 2017 at 02:32:31PM +0200, wiktoria.lewicka wrote:

Expanding on Greg's response, the document you want to read is

  Documentation/process/coding-style.rst

> > Hello.
> > I write simple network device, but its don't work. Module is loading, 
> > loading, loading...
> > Code:
> > 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #define DEV_NAME "chwdp"
> > 
> > struct net_device my_netdev;
> > 
> > int init_my_net_dev(struct net_device *dev);
> > 
> > struct net_device_ops nops = {
> >   .ndo_init = init_my_net_dev,

Preferred indentation is 8 characters.

> >   //.ndo_uninit = uninit_my_net_dev,

Prefer c89 comments.

> > };
> > 
> > static int __init init_dev(void)
> > {
> >   //my_netdev.netdev_ops = 
> >   int result;
> >   if((netdev_boot_setup_check(_netdev))){
> > printk(KERN_ERR "NETDEV: setup error");
> > return 0;
> 
> Why are you returning success if there was an error?
> 
> And always try to use proper kernel coding style when writing kernel
> code if you expect/want someone else to read it :)

Also, you should run your code through scripts/checkpatch.pl. That
script will catch coding style issues for you and help you learn them.

Good luck,
Tobin.

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


Re: My network device don't work

2017-06-20 Thread Greg KH
On Tue, Jun 20, 2017 at 02:32:31PM +0200, wiktoria.lewicka wrote:
> Hello.
> I write simple network device, but its don't work. Module is loading, 
> loading, loading...
> Code:
> 
> #include 
> #include 
> #include 
> #include 
> #include 
> #define DEV_NAME "chwdp"
> 
> struct net_device my_netdev;
> 
> int init_my_net_dev(struct net_device *dev);
> 
> struct net_device_ops nops = {
>   .ndo_init = init_my_net_dev,
>   //.ndo_uninit = uninit_my_net_dev,
> };
> 
> static int __init init_dev(void)
> {
>   //my_netdev.netdev_ops = 
>   int result;
>   if((netdev_boot_setup_check(_netdev))){
> printk(KERN_ERR "NETDEV: setup error");
> return 0;

Why are you returning success if there was an error?

And always try to use proper kernel coding style when writing kernel
code if you expect/want someone else to read it :)

thanks,

greg k-h

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


Re: My network device don't work

2017-06-20 Thread Stan Drozd
On Tue, Jun 20, 2017 at 02:32:31PM +0200, wiktoria.lewicka wrote:
> Hello.
> I write simple network device, but its don't work. Module is loading, 
> loading, loading...
> Code:
> [...]
Hello,
"strncpy(my_netdev.name, DEV_NAME, 5)" only copies the 5 chars in "chwdp" 
without the null byte. You could bump it to 6
or maybe change 5 to IFNAMSIZ (the net_device.name's size) and then change the 
last byte to '\0' manually

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


My network device don't work

2017-06-20 Thread wiktoria.lewicka
Hello.
I write simple network device, but its don't work. Module is loading, loading, 
loading...
Code:

#include 
#include 
#include 
#include 
#include 
#define DEV_NAME "chwdp"

struct net_device my_netdev;

int init_my_net_dev(struct net_device *dev);

struct net_device_ops nops = {
  .ndo_init = init_my_net_dev,
  //.ndo_uninit = uninit_my_net_dev,
};

static int __init init_dev(void)
{
  //my_netdev.netdev_ops = 
  int result;
  if((netdev_boot_setup_check(_netdev))){
printk(KERN_ERR "NETDEV: setup error");
return 0;
  }
  strncpy(my_netdev.name, DEV_NAME, 5);
  if((result = register_netdev(_netdev)))
printk(KERN_ERR "NETDEV: Error registering device");
  printk("NETDEV: Device registered successfully");
  return 0;
}

static void __exit remove_dev(void)
{
  unregister_netdev(_netdev);
}
int init_my_net_dev(struct net_device *dev)
{
  printk("INIT");
  return 0;
}
module_init(init_dev);
module_exit(remove_dev);


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


Is sg_set_page will not work with IOMMU?

2017-02-27 Thread Harsh Jain
Hi All,

I am trying to create new sg list from old list. The new list will
have length < 2048. When I populate the new sg list using
sg_set_page(). IOMMU starts giving following error.

 [  388.463656] DMAR: DRHD: handling fault status reg 2
[  388.468539] DMAR: [DMA Write] Request device [03:00.0] fault addr
ef66d000 [fault reason 05] PTE Write access is not set
[  389.464146] DMAR: DRHD: handling fault status reg 102
[  389.469203] DMAR: [DMA Write] Request device [03:00.0] fault addr
ef65d000 [fault reason 05] PTE Write access is not set


Function to create new sg list:


{
struct scatterlist *newsg, *sg;
int i, len, processed = 0;
size_t size = 2048;

newsg = kmalloc_array(nents, sizeof(struct scatterlist), GFP_KERNEL);
if (!newsg)
return ERR_PTR(-ENOMEM);
sg = newsg;
sg_init_table(sg, nents);
for (i = 0; i < nents; i++) {
len = min_t(u32, sgl->length - processed, 2048);
sg_set_page(sg, sg_page(sgl), len, sgl->offset + processed);
processed += len;
if (processed == sgl->length) {
processed = 0;
sgl = sg_next(sgl);
}
sg = sg_next(sg);
}

return newsg;
}

Same driver works fine if I disable IOMMU.

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


Re: Why amdgpu pro does not work on kernel 4.10?

2017-02-12 Thread Ali Aminian
Hello again.
I just find out something weird.
1_ I typed make menuconfig
2_ I went to "general setup" and unchecked  "Automatically append
version information to the version string"
3_ recompiled and installed the new kernel

and suddenly all problems are disappeared.

I am wondering why this option causes problems.

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


Re: Why amdgpu pro does not work on kernel 4.10?

2017-02-12 Thread valdis . kletnieks
On Mon, 13 Feb 2017 05:26:50 +0330, Ali Aminian said:
> Thank you for your response.
> It does not work means:
> 1_ I have downloaded amdgpu-pro driver from AMD website and installed it.

Complain to AMD then, because..

> 2_ I have compiled linux kernel 4.10 and 4.9 with oldconfig.

> error: too many arguments to function ‘ttm_bo_reserve’
>   return ttm_bo_reserve(bo, interruptible, no_wait, false, ticket);

However, include/drm/ttm/ttm_bo_driver.h has this definition:

static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo,
   bool interruptible, bool no_wait,
   struct ww_acquire_ctx *ticket)
{


which means AMD is close to a year out of date with respect to upstream:

commit dfd5e50ea43ca4a89de061fb69618299760eb682
Author: Christian K?nig <christian.koe...@amd.com>
Date:   Wed Apr 6 11:12:03 2016 +0200

drm/ttm: remove use_ticket parameter from ttm_bo_reserve

Not used any more.

Reviewed-by: Sinclair Yeh <s...@vmware.com>
Signed-off-by: Christian K?nig <christian.koe...@amd.com>
Reviewed-by: Alex Deucher <alexander.deuc...@amd.com>
Signed-off-by: Alex Deucher <alexander.deuc...@amd.com>

Or you can fix it yourself, I've provided enough hints already. :)

(Fixing the other issues should be equally easy)



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


Re: Why amdgpu pro does not work on kernel 4.10?

2017-02-12 Thread Ali Aminian
Thank you for your response.
It does not work means:
1_ I have downloaded amdgpu-pro driver from AMD website and installed it.
2_ I have compiled linux kernel 4.10 and 4.9 with oldconfig.
3_ then I booted to new kernel and see login screen is distorted.
4_ I tried to login but it loops back to login screen again.
5_ Ctrl Alt F1-F6 results in a blank screen.
6_ I sshed into the system and check if amdgpu is loaded by "lsmod | grep amd"
and yes it is loaded.
7_ I uninstalled and installed amdgpu-pro again and i got dkms error
and it refered me to
/var/lib/dkms/amdgpu-pro/16.40-348864/build/make.log for further
details.

and here is the log file:

DKMS make.log for amdgpu-pro-14.40-348864 for kernel 4.10.0-rc7+ (x86_64)
Mon Feb 13 03:53:09 IRST 2017
  LD  /var/lib/dkms/amdgpu-pro/16.40-348864/build/built-in.o
  LD  /var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/built-in.o
  CC [M]  /var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/amdgpu_drv.o
In file included from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/backport.h:8:0,
 from :0:
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/include/kcl/kcl_drm.h:68:72:
error: operator '+' has no right operand
   && LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && (UBUNTU_BUILD_NUM < 36)) \
^
In file included from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/backport.h:9:0,
 from :0:
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/include/kcl/kcl_ttm.h:
In function ‘kcl_ttm_bo_reserve’:
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/include/kcl/kcl_ttm.h:109:9:
error: too many arguments to function ‘ttm_bo_reserve’
  return ttm_bo_reserve(bo, interruptible, no_wait, false, ticket);
 ^
In file included from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/include/kcl/kcl_ttm.h:6:0,
 from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/backport.h:9,
 from :0:
./include/drm/ttm/ttm_bo_driver.h:875:19: note: declared here
 static inline int ttm_bo_reserve(struct ttm_buffer_object *bo,
   ^
In file included from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/include/kcl/kcl_amdgpu.h:5:0,
 from
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../backport/backport.h:10,
 from :0:
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../amdgpu/amdgpu.h:
At top level:
/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/../amdgpu/amdgpu.h:37:25:
fatal error: linux/fence.h: No such file or directory
compilation terminated.
scripts/Makefile.build:294: recipe for target
'/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/amdgpu_drv.o'
failed
make[4]: *** 
[/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu/amdgpu_drv.o]
Error 1
scripts/Makefile.build:553: recipe for target
'/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu' failed
make[3]: *** [/var/lib/dkms/amdgpu-pro/16.40-348864/build/amd/amdgpu] Error 2
Makefile:1490: recipe for target
'_module_/var/lib/dkms/amdgpu-pro/16.40-348864/build' failed
make[2]: *** [_module_/var/lib/dkms/amdgpu-pro/16.40-348864/build] Error 2

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


Re: Why amdgpu pro does not work on kernel 4.10?

2017-02-12 Thread valdis . kletnieks
On Sun, 12 Feb 2017 17:45:58 +0330, Ali Aminian said:
> I was heard that amdgpu pro is user space driver and the kernel space
> part (amdgpu) is merged into Linux kernel. And that means amdgpu pro
> should work on all kernels above 4.3. But why amdgpu pro does not work
> on kernel 4.10?

What do you mean by "does not work"?  It doesn't compile?  It won't modprobe?
It doesn't behave right? It crashes?

Most likely, some API changed in 4.10 and nobody has fixed amdgpu to match.


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


Why amdgpu pro does not work on kernel 4.10?

2017-02-12 Thread Ali Aminian
I was heard that amdgpu pro is user space driver and the kernel space
part (amdgpu) is merged into Linux kernel. And that means amdgpu pro
should work on all kernels above 4.3. But why amdgpu pro does not work
on kernel 4.10?

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


Re: doubt on schedule_work() - work task getting scheduled lately

2016-08-05 Thread Daniel.
ftrace :)

2016-08-05 4:22 GMT-03:00 Muni Sekhar <munisekhar...@gmail.com>:
> On Mon, Aug 1, 2016 at 6:34 PM, Daniel. <danielhi...@gmail.com> wrote:
>> Did you tried ftrace? 
>> https://www.kernel.org/doc/Documentation/trace/ftrace.txt
>>
>> I've been using this to measure some latencies. The problem here is
>> visualizing the output. If you need someting more elaborated than
>> simple prints with timestamps and delta calculations, then you should
>> try something more complex. If not you can enable FTRACE and generate
>> trace output with delta timestamps on it, event for interrupts :)
>
> No, I haven't tried ftrace.
>
>
> I need to measure latencies between schedule_work() and actual
> execution start of my work function. workqueue_queue_work &
> workqueue_execute_start are their corresponding lttng events.
>
>  I installed the lttng in my test setup and simply enabled all
> available kernel events.
>
> I am able to start & stop tracing.
>
>
> Few lines of lttng view trace:
>
> [11:07:08.208795325] (+0.01677) testbox irq_handler_entry: {
> cpu_id = 1 }, { irq = 16, name = "debug_irq" }
>
> [11:07:08.208822703] (+0.27378) testbox workqueue_queue_work: {
> cpu_id = 1 }, { work = 0x8801396D4F18, function =
> 0xC07273B0, req_cpu = 256 }
>
> [11:07:08.208824380] (+0.01677) testbox workqueue_activate_work: {
> cpu_id = 1 }, { work = 0x8801396D4F18 }
>
> [11:07:08.208826615] (+0.02235) testbox irq_handler_exit: { cpu_id
> = 1 }, { irq = 16, ret = 1 }
>
> [11:07:08.208831364] (+0.04749) testbox workqueue_execute_start: {
> cpu_id = 1 }, { work = 0x8801396D4F18, function =
> 0xC07273B0 }
>
> [11:07:08.208841422] (+0.10058) testbox workqueue_execute_end: {
> cpu_id = 1 }, { work = 0x8801396D4F18 }
>
>
> Can it be possible to print function name instead of ‘function =
> 0xC07273B0’?
>
>
>
> Reproducing the 100 msec latency in between workqueue_queue_work &
> workqueue_execute_start needs to trigger the longer soak test anything
> over 24 hours.
>
>
> If I record the lttng trace for longer hours and when I 'lttng view'
> the trace, I get all sorts of messages like:
>
>
> "[warning] Tracer discarded  events between  and
> .  You  should consider recording a new trace with larger
> buffers or with fewer events enabled."
>
>
> Any better ideas to catch the kernel trace event log for millisecond
> latency in between workqueue_queue_work & workqueue_execute_start?
>
>
>
>>
>> Best regards,
>>
>> 2016-08-01 7:32 GMT-03:00 Muni Sekhar <munisekhar...@gmail.com>:
>>> On Fri, Jul 29, 2016 at 9:05 PM, Daniel. <danielhi...@gmail.com> wrote:
>>>> Nice tool @Ricardo!
>>>>
>>>> 2016-07-29 10:48 GMT-03:00 Ricardo Ribalda Delgado 
>>>> <ricardo.riba...@gmail.com>:
>>>>> you can use http://lttng.org/ for analyzing this
>>> Thanks Ricardo, I will use this.
>>>
>>>>>
>>>>> Regards!
>>>>>
>>>>> On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> 
>>>>> wrote:
>>>>>> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> 
>>>>>> wrote:
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I have a doubt regarding the workqueue scheduling.
>>>>>>>
>>>>>>> I am using the workqueue for processing the Rx Interrupt data. I am
>>>>>>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>>>>>>
>>>>>>> I calculated the time between calling the schedule_work() and
>>>>>>> workqueue task actually getting executed, Here I see many cases of
>>>>>>> less than 100 us(It is fairly good).
>>>>>>>
>>>>>>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>>>>>>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>>>>>>> takes longer time(in milli seconds) to schedule it? Is there any way
>>>>>>> to reduce this time gap?
>>>>>>>
>>>>>>>
>>>>>>> My code:
>>>>>>>
>>>>>>> static void my_workqueuetask(struct work_struct *work)
>>>>>>> {
>>>>>>> printk("In %s() \n",__func__);
>>>>>>>
>>&

Re: doubt on schedule_work() - work task getting scheduled lately

2016-08-05 Thread Muni Sekhar
On Mon, Aug 1, 2016 at 6:34 PM, Daniel. <danielhi...@gmail.com> wrote:
> Did you tried ftrace? 
> https://www.kernel.org/doc/Documentation/trace/ftrace.txt
>
> I've been using this to measure some latencies. The problem here is
> visualizing the output. If you need someting more elaborated than
> simple prints with timestamps and delta calculations, then you should
> try something more complex. If not you can enable FTRACE and generate
> trace output with delta timestamps on it, event for interrupts :)

No, I haven't tried ftrace.


I need to measure latencies between schedule_work() and actual
execution start of my work function. workqueue_queue_work &
workqueue_execute_start are their corresponding lttng events.

 I installed the lttng in my test setup and simply enabled all
available kernel events.

I am able to start & stop tracing.


Few lines of lttng view trace:

[11:07:08.208795325] (+0.01677) testbox irq_handler_entry: {
cpu_id = 1 }, { irq = 16, name = "debug_irq" }

[11:07:08.208822703] (+0.27378) testbox workqueue_queue_work: {
cpu_id = 1 }, { work = 0x8801396D4F18, function =
0xC07273B0, req_cpu = 256 }

[11:07:08.208824380] (+0.01677) testbox workqueue_activate_work: {
cpu_id = 1 }, { work = 0x8801396D4F18 }

[11:07:08.208826615] (+0.02235) testbox irq_handler_exit: { cpu_id
= 1 }, { irq = 16, ret = 1 }

[11:07:08.208831364] (+0.04749) testbox workqueue_execute_start: {
cpu_id = 1 }, { work = 0x8801396D4F18, function =
0xC07273B0 }

[11:07:08.208841422] (+0.10058) testbox workqueue_execute_end: {
cpu_id = 1 }, { work = 0x8801396D4F18 }


Can it be possible to print function name instead of ‘function =
0xC07273B0’?



Reproducing the 100 msec latency in between workqueue_queue_work &
workqueue_execute_start needs to trigger the longer soak test anything
over 24 hours.


If I record the lttng trace for longer hours and when I 'lttng view'
the trace, I get all sorts of messages like:


"[warning] Tracer discarded  events between  and
.  You  should consider recording a new trace with larger
buffers or with fewer events enabled."


Any better ideas to catch the kernel trace event log for millisecond
latency in between workqueue_queue_work & workqueue_execute_start?



>
> Best regards,
>
> 2016-08-01 7:32 GMT-03:00 Muni Sekhar <munisekhar...@gmail.com>:
>> On Fri, Jul 29, 2016 at 9:05 PM, Daniel. <danielhi...@gmail.com> wrote:
>>> Nice tool @Ricardo!
>>>
>>> 2016-07-29 10:48 GMT-03:00 Ricardo Ribalda Delgado 
>>> <ricardo.riba...@gmail.com>:
>>>> you can use http://lttng.org/ for analyzing this
>> Thanks Ricardo, I will use this.
>>
>>>>
>>>> Regards!
>>>>
>>>> On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> 
>>>> wrote:
>>>>> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> 
>>>>> wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I have a doubt regarding the workqueue scheduling.
>>>>>>
>>>>>> I am using the workqueue for processing the Rx Interrupt data. I am
>>>>>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>>>>>
>>>>>> I calculated the time between calling the schedule_work() and
>>>>>> workqueue task actually getting executed, Here I see many cases of
>>>>>> less than 100 us(It is fairly good).
>>>>>>
>>>>>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>>>>>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>>>>>> takes longer time(in milli seconds) to schedule it? Is there any way
>>>>>> to reduce this time gap?
>>>>>>
>>>>>>
>>>>>> My code:
>>>>>>
>>>>>> static void my_workqueuetask(struct work_struct *work)
>>>>>> {
>>>>>> printk("In %s() \n",__func__);
>>>>>>
>>>>> You probably don't need this if it's just for your work_fn, yeah but
>>>>> if there's race between this and something else...
>>>>>> mutex_lock(_mutex);
>>>>>>
>>>>>> //Do something here
>>>>>>
>>>>>> mutex_unlock(_mutex);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> static irqreturn_t my_irq_handler(int irq, void *dev)
>>>>>> {
>>>>>&g

Re: doubt on schedule_work() - work task getting scheduled lately

2016-08-04 Thread Mulyadi Santosa
On Fri, Jul 29, 2016 at 5:32 PM, Muni Sekhar <munisekhar...@gmail.com>
wrote:

> Hi All,
>
> I have a doubt regarding the workqueue scheduling.
>
> I am using the workqueue for processing the Rx Interrupt data. I am
> calling schedule_work() on receiving the Rx interrupt from hardware.
>
> I calculated the time between calling the schedule_work() and
> workqueue task actually getting executed, Here I see many cases of
> less than 100 us(It is fairly good).
>
> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
> seen over 0.5 secs too. I would like to know why does sometimes kernel
> takes longer time(in milli seconds) to schedule it? Is there any way
> to reduce this time gap?
>
>
> My code:
>
> static void my_workqueuetask(struct work_struct *work)
> {
> printk("In %s() \n",__func__);
>
> mutex_lock(_mutex);
>
> //Do something here
>
> mutex_unlock(_mutex);
> }
>
>
> static irqreturn_t my_irq_handler(int irq, void *dev)
> {
> ……;
>
> if(Rx Interrupt)
>  schedule_work(_work);
>
> return IRQ_HANDLED;
> }
>
> --
> Thanks,
> Sekhar
>
>
Hi Sekhar

In general, in non real time kernel, there is no way you can make sure your
work will be scheduled after N seconds.

Have you done simple statistic calculation how much % it is slower than 100
us, and how much % it is faster than 100 us?

IMHO, if slower % is lower than 1% of overall sample, I think it is still
acceptable, but this is up to your judgement

BTW, like other said too, that mutex_lock, have you also measured how long,
by average, the lock is taken?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doubt on schedule_work() - work task getting scheduled lately

2016-08-01 Thread Daniel.
Did you tried ftrace? https://www.kernel.org/doc/Documentation/trace/ftrace.txt

I've been using this to measure some latencies. The problem here is
visualizing the output. If you need someting more elaborated than
simple prints with timestamps and delta calculations, then you should
try something more complex. If not you can enable FTRACE and generate
trace output with delta timestamps on it, event for interrupts :)

Best regards,

2016-08-01 7:32 GMT-03:00 Muni Sekhar <munisekhar...@gmail.com>:
> On Fri, Jul 29, 2016 at 9:05 PM, Daniel. <danielhi...@gmail.com> wrote:
>> Nice tool @Ricardo!
>>
>> 2016-07-29 10:48 GMT-03:00 Ricardo Ribalda Delgado 
>> <ricardo.riba...@gmail.com>:
>>> you can use http://lttng.org/ for analyzing this
> Thanks Ricardo, I will use this.
>
>>>
>>> Regards!
>>>
>>> On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> 
>>> wrote:
>>>> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> 
>>>> wrote:
>>>>> Hi All,
>>>>>
>>>>> I have a doubt regarding the workqueue scheduling.
>>>>>
>>>>> I am using the workqueue for processing the Rx Interrupt data. I am
>>>>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>>>>
>>>>> I calculated the time between calling the schedule_work() and
>>>>> workqueue task actually getting executed, Here I see many cases of
>>>>> less than 100 us(It is fairly good).
>>>>>
>>>>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>>>>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>>>>> takes longer time(in milli seconds) to schedule it? Is there any way
>>>>> to reduce this time gap?
>>>>>
>>>>>
>>>>> My code:
>>>>>
>>>>> static void my_workqueuetask(struct work_struct *work)
>>>>> {
>>>>> printk("In %s() \n",__func__);
>>>>>
>>>> You probably don't need this if it's just for your work_fn, yeah but
>>>> if there's race between this and something else...
>>>>> mutex_lock(_mutex);
>>>>>
>>>>> //Do something here
>>>>>
>>>>> mutex_unlock(_mutex);
>>>>> }
>>>>>
>>>>>
>>>>> static irqreturn_t my_irq_handler(int irq, void *dev)
>>>>> {
>>>>> ……;
>>>>>
>>>>> if(Rx Interrupt)
>>>>>  schedule_work(_work);
>>>>
>>>> Maybe system_wq has too much already on it's plate?
>>>> Have you tried the same with completion and a kthread? or
>>>> with your own workqueue, overkill but you can give it a shot.
> I have not tried this. First I will analyze with lttng and then
> attempts this. Does using our own workqueue reduces the latency?
>
>>>>>
>>>>> return IRQ_HANDLED;
>>>>> }
>>>>>
>>>>> --
>>>>> Thanks,
>>>>> Sekhar
>>>>>
>>>>> ___
>>>>> Kernelnewbies mailing list
>>>>> Kernelnewbies@kernelnewbies.org
>>>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>>
>>>>
>>>>
>>>> --
>>>> ---P.K.S
>>>>
>>>> ___
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies@kernelnewbies.org
>>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>>>
>>> --
>>> Ricardo Ribalda
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>>
>> --
>> "Do or do not. There is no try"
>>   Yoda Master
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> Thanks,
> Sekhar



-- 
"Do or do not. There is no try"
  Yoda Master

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


Re: doubt on schedule_work() - work task getting scheduled lately

2016-08-01 Thread Muni Sekhar
On Fri, Jul 29, 2016 at 9:05 PM, Daniel. <danielhi...@gmail.com> wrote:
> Nice tool @Ricardo!
>
> 2016-07-29 10:48 GMT-03:00 Ricardo Ribalda Delgado 
> <ricardo.riba...@gmail.com>:
>> you can use http://lttng.org/ for analyzing this
Thanks Ricardo, I will use this.

>>
>> Regards!
>>
>> On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> 
>> wrote:
>>> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> 
>>> wrote:
>>>> Hi All,
>>>>
>>>> I have a doubt regarding the workqueue scheduling.
>>>>
>>>> I am using the workqueue for processing the Rx Interrupt data. I am
>>>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>>>
>>>> I calculated the time between calling the schedule_work() and
>>>> workqueue task actually getting executed, Here I see many cases of
>>>> less than 100 us(It is fairly good).
>>>>
>>>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>>>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>>>> takes longer time(in milli seconds) to schedule it? Is there any way
>>>> to reduce this time gap?
>>>>
>>>>
>>>> My code:
>>>>
>>>> static void my_workqueuetask(struct work_struct *work)
>>>> {
>>>> printk("In %s() \n",__func__);
>>>>
>>> You probably don't need this if it's just for your work_fn, yeah but
>>> if there's race between this and something else...
>>>> mutex_lock(_mutex);
>>>>
>>>> //Do something here
>>>>
>>>> mutex_unlock(_mutex);
>>>> }
>>>>
>>>>
>>>> static irqreturn_t my_irq_handler(int irq, void *dev)
>>>> {
>>>> ……;
>>>>
>>>> if(Rx Interrupt)
>>>>  schedule_work(_work);
>>>
>>> Maybe system_wq has too much already on it's plate?
>>> Have you tried the same with completion and a kthread? or
>>> with your own workqueue, overkill but you can give it a shot.
I have not tried this. First I will analyze with lttng and then
attempts this. Does using our own workqueue reduces the latency?

>>>>
>>>> return IRQ_HANDLED;
>>>> }
>>>>
>>>> --
>>>> Thanks,
>>>> Sekhar
>>>>
>>>> ___
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies@kernelnewbies.org
>>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>>>
>>> --
>>> ---P.K.S
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>>
>> --
>> Ricardo Ribalda
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> "Do or do not. There is no try"
>   Yoda Master
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
Thanks,
Sekhar

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


Re: doubt on schedule_work() - work task getting scheduled lately

2016-07-29 Thread Daniel.
Nice tool @Ricardo!

2016-07-29 10:48 GMT-03:00 Ricardo Ribalda Delgado <ricardo.riba...@gmail.com>:
> you can use http://lttng.org/ for analyzing this
>
> Regards!
>
> On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> wrote:
>> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> wrote:
>>> Hi All,
>>>
>>> I have a doubt regarding the workqueue scheduling.
>>>
>>> I am using the workqueue for processing the Rx Interrupt data. I am
>>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>>
>>> I calculated the time between calling the schedule_work() and
>>> workqueue task actually getting executed, Here I see many cases of
>>> less than 100 us(It is fairly good).
>>>
>>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>>> takes longer time(in milli seconds) to schedule it? Is there any way
>>> to reduce this time gap?
>>>
>>>
>>> My code:
>>>
>>> static void my_workqueuetask(struct work_struct *work)
>>> {
>>> printk("In %s() \n",__func__);
>>>
>> You probably don't need this if it's just for your work_fn, yeah but
>> if there's race between this and something else...
>>> mutex_lock(_mutex);
>>>
>>> //Do something here
>>>
>>> mutex_unlock(_mutex);
>>> }
>>>
>>>
>>> static irqreturn_t my_irq_handler(int irq, void *dev)
>>> {
>>> ……;
>>>
>>> if(Rx Interrupt)
>>>  schedule_work(_work);
>>
>> Maybe system_wq has too much already on it's plate?
>> Have you tried the same with completion and a kthread? or
>> with your own workqueue, overkill but you can give it a shot.
>>>
>>> return IRQ_HANDLED;
>>> }
>>>
>>> --
>>> Thanks,
>>> Sekhar
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>>
>> --
>> ---P.K.S
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> Ricardo Ribalda
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
"Do or do not. There is no try"
  Yoda Master

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


Re: doubt on schedule_work() - work task getting scheduled lately

2016-07-29 Thread Ricardo Ribalda Delgado
you can use http://lttng.org/ for analyzing this

Regards!

On Fri, Jul 29, 2016 at 12:44 PM, Pranay Srivastava <pran...@gmail.com> wrote:
> On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> wrote:
>> Hi All,
>>
>> I have a doubt regarding the workqueue scheduling.
>>
>> I am using the workqueue for processing the Rx Interrupt data. I am
>> calling schedule_work() on receiving the Rx interrupt from hardware.
>>
>> I calculated the time between calling the schedule_work() and
>> workqueue task actually getting executed, Here I see many cases of
>> less than 100 us(It is fairly good).
>>
>> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
>> seen over 0.5 secs too. I would like to know why does sometimes kernel
>> takes longer time(in milli seconds) to schedule it? Is there any way
>> to reduce this time gap?
>>
>>
>> My code:
>>
>> static void my_workqueuetask(struct work_struct *work)
>> {
>> printk("In %s() \n",__func__);
>>
> You probably don't need this if it's just for your work_fn, yeah but
> if there's race between this and something else...
>> mutex_lock(_mutex);
>>
>> //Do something here
>>
>> mutex_unlock(_mutex);
>> }
>>
>>
>> static irqreturn_t my_irq_handler(int irq, void *dev)
>> {
>> ……;
>>
>> if(Rx Interrupt)
>>  schedule_work(_work);
>
> Maybe system_wq has too much already on it's plate?
> Have you tried the same with completion and a kthread? or
> with your own workqueue, overkill but you can give it a shot.
>>
>> return IRQ_HANDLED;
>> }
>>
>> --
>> Thanks,
>> Sekhar
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> ---P.K.S
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
Ricardo Ribalda

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


Re: doubt on schedule_work() - work task getting scheduled lately

2016-07-29 Thread Pranay Srivastava
On Fri, Jul 29, 2016 at 4:02 PM, Muni Sekhar <munisekhar...@gmail.com> wrote:
> Hi All,
>
> I have a doubt regarding the workqueue scheduling.
>
> I am using the workqueue for processing the Rx Interrupt data. I am
> calling schedule_work() on receiving the Rx interrupt from hardware.
>
> I calculated the time between calling the schedule_work() and
> workqueue task actually getting executed, Here I see many cases of
> less than 100 us(It is fairly good).
>
> But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
> seen over 0.5 secs too. I would like to know why does sometimes kernel
> takes longer time(in milli seconds) to schedule it? Is there any way
> to reduce this time gap?
>
>
> My code:
>
> static void my_workqueuetask(struct work_struct *work)
> {
> printk("In %s() \n",__func__);
>
You probably don't need this if it's just for your work_fn, yeah but
if there's race between this and something else...
> mutex_lock(_mutex);
>
> //Do something here
>
> mutex_unlock(_mutex);
> }
>
>
> static irqreturn_t my_irq_handler(int irq, void *dev)
> {
> ……;
>
> if(Rx Interrupt)
>  schedule_work(_work);

Maybe system_wq has too much already on it's plate?
Have you tried the same with completion and a kthread? or
with your own workqueue, overkill but you can give it a shot.
>
> return IRQ_HANDLED;
> }
>
> --
> Thanks,
> Sekhar
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
---P.K.S

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


doubt on schedule_work() - work task getting scheduled lately

2016-07-29 Thread Muni Sekhar
Hi All,

I have a doubt regarding the workqueue scheduling.

I am using the workqueue for processing the Rx Interrupt data. I am
calling schedule_work() on receiving the Rx interrupt from hardware.

I calculated the time between calling the schedule_work() and
workqueue task actually getting executed, Here I see many cases of
less than 100 us(It is fairly good).

But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
seen over 0.5 secs too. I would like to know why does sometimes kernel
takes longer time(in milli seconds) to schedule it? Is there any way
to reduce this time gap?


My code:

static void my_workqueuetask(struct work_struct *work)
{
printk("In %s() \n",__func__);

mutex_lock(_mutex);

//Do something here

mutex_unlock(_mutex);
}


static irqreturn_t my_irq_handler(int irq, void *dev)
{
……;

if(Rx Interrupt)
 schedule_work(_work);

return IRQ_HANDLED;
}

-- 
Thanks,
Sekhar

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


Re: Pending work related to kernel for a newbie

2016-07-20 Thread sham pavman
Hi Ashijeet,

Its almost always true that we all start off with bugzilla and i believe
you should start from there as well. ( pick up bite size bugs) and start
solving.

However, there is another very important thing. C programming will help you
code in a solution to the problem and often that's the most easiest part.
Its highly important that you understand the problem first.
Understand the subsystems , how they interact . I would urge you to first
read about the linux kernel and how it explains all the subsystems and then
start looking at the issues.

You can solve small issues for the fun of it. But the real strength(at
least if you ask me) of a kernel Engineer is to understand the problem
first.
There are lots of materials online. But if you wish to read any specific
book then
https://books.google.co.in/books/about/Unix_Internals.html?id=Z7qfu9NK7WQC

That's where i started from

On Wed, Jul 20, 2016 at 1:24 PM, Robert P. J. Day <rpj...@crashcourse.ca>
wrote:

> On Wed, 20 Jul 2016, Aleksander Alekseev wrote:
>
> > Hello, Ashijeet
> >
> > > I am kernel newbie and I was looking for something to work upon to
> > > improve my skill-set. I have good knowledge of C and experience in
> > > writing patches. Also please refer me if there is a to-do list for
> > > newbies related to pending tasks for linux kernel.
> >
> > I'm newbie here as well. Still I have an experience of working on some
> > other open source projects. I believe the idea is always the same.
> >
> > First, take a look on project's issue tracker:
> >
> > https://bugzilla.kernel.org/
> >
> > Also you could probably review an existing code and propose refactoring
> > or optimization patches. Static code analyzers is always a good start
> > point. Try looking for typos in comments - you will be surprised how
> > many mistakes are there. Usually people like to write code but don't
> > like to document and/or test it. Join testing and reviewing new
> > patches, try to improve them.
> >
> > I hope this will help.
>
>   i've mentioned this before ... if you want a safe project that will
> still teach you a whole lot about the kernel, improve all the
> documentation under the Documentation/ directory. there's a *ton* of
> stuff there that is either in need of improving or, in some cases,
> deletion because it's so old. or if you're feeling really ambitious,
> write some *new* documentation for some subsystem for which there is
> none.
>
>   and, finally, you can't screw things up by changing the docs.
>
> 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
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Pending work related to kernel for a newbie

2016-07-20 Thread Robert P. J. Day
On Wed, 20 Jul 2016, Aleksander Alekseev wrote:

> Hello, Ashijeet
>
> > I am kernel newbie and I was looking for something to work upon to
> > improve my skill-set. I have good knowledge of C and experience in
> > writing patches. Also please refer me if there is a to-do list for
> > newbies related to pending tasks for linux kernel.
>
> I'm newbie here as well. Still I have an experience of working on some
> other open source projects. I believe the idea is always the same.
>
> First, take a look on project's issue tracker:
>
> https://bugzilla.kernel.org/
>
> Also you could probably review an existing code and propose refactoring
> or optimization patches. Static code analyzers is always a good start
> point. Try looking for typos in comments - you will be surprised how
> many mistakes are there. Usually people like to write code but don't
> like to document and/or test it. Join testing and reviewing new
> patches, try to improve them.
>
> I hope this will help.

  i've mentioned this before ... if you want a safe project that will
still teach you a whole lot about the kernel, improve all the
documentation under the Documentation/ directory. there's a *ton* of
stuff there that is either in need of improving or, in some cases,
deletion because it's so old. or if you're feeling really ambitious,
write some *new* documentation for some subsystem for which there is
none.

  and, finally, you can't screw things up by changing the docs.

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
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Pending work related to kernel for a newbie

2016-07-20 Thread Aleksander Alekseev
Hello, Ashijeet

> I am kernel newbie and I was looking for something to work upon to
> improve my skill-set. I have good knowledge of C and experience in
> writing patches. Also please refer me if there is a to-do list for
> newbies related to pending tasks for linux kernel.

I'm newbie here as well. Still I have an experience of working on some
other open source projects. I believe the idea is always the same.

First, take a look on project's issue tracker:

https://bugzilla.kernel.org/

Also you could probably review an existing code and propose refactoring
or optimization patches. Static code analyzers is always a good start
point. Try looking for typos in comments - you will be surprised how
many mistakes are there. Usually people like to write code but don't
like to document and/or test it. Join testing and reviewing new
patches, try to improve them.

I hope this will help.

-- 
Best regards,
Aleksander Alekseev

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


Pending work related to kernel for a newbie

2016-07-19 Thread Ashijeet Acharya
Hi everyone,

I am kernel newbie and I was looking for something to work upon to
improve my skill-set. I have good knowledge of C and experience in
writing patches. Also please refer me if there is a to-do list for
newbies related to pending tasks for linux kernel.

Thanks
Ashijeet

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


Re: Work with correct branch for kernel changes

2015-12-17 Thread Andrey Skvortsov
On 12 Dec, Shirish Gajera wrote:
> Hi,
> 
> I am new to linux kernel and trying to understand  the process of
> different git branch to work.
> 
> So, if I am not wrong then there are different branch like stable, next,
> staging etc. Previously I work with staging branch so if I am making
> any changes for drivers/staging I have to work with staging branch like
> follow.
> git clone 
> git checkout -t -b staging-testing origin/staging-testing
> git chekcout -b MY_LOCAL_BRANCH
> not do work and subimt
> 
> So, how it work for other source structure, like now I want to make some
> for y2038 -> drivers/scsi which branch should I set up and work with,
> next/stable/or is there any specific y2038 branch.
> 
> Any wiki link or documentation that explain this full process which
> branch to work with when making changes to specific directory will be
> useful.
> 
> Thanks,
> Shirish

There are not only different branches, but also different git trees,
where development for different subsystem takes place usually.

I recommend you to watch this presentation of GregKH. He explains very
good, how the development is working.

https://kernel-recipes.org/en/2014/the-linux-kernel-how-fast-it-is-developed-and-how-we-stay-sane-doing-it/

-- 
Best regards,
Andrey Skvortsov

Secure eMail with gnupg: See http://www.gnupg.org/
PGP Key ID: 0x57A3AEAD


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


Work with correct branch for kernel changes

2015-12-12 Thread Shirish Gajera
Hi,

I am new to linux kernel and trying to understand  the process of
different git branch to work.

So, if I am not wrong then there are different branch like stable, next,
staging etc. Previously I work with staging branch so if I am making
any changes for drivers/staging I have to work with staging branch like
follow.
git clone 
git checkout -t -b staging-testing origin/staging-testing
git chekcout -b MY_LOCAL_BRANCH
not do work and subimt

So, how it work for other source structure, like now I want to make some
for y2038 -> drivers/scsi which branch should I set up and work with,
next/stable/or is there any specific y2038 branch.

Any wiki link or documentation that explain this full process which
branch to work with when making changes to specific directory will be
useful.

Thanks,
Shirish

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


Re: Work with correct branch for kernel changes

2015-12-12 Thread Luis de Bethencourt
On 12/12/15 20:43, Shirish Gajera wrote:
> Hi,
> 
> I am new to linux kernel and trying to understand  the process of
> different git branch to work.
> 
> So, if I am not wrong then there are different branch like stable, next,
> staging etc. Previously I work with staging branch so if I am making
> any changes for drivers/staging I have to work with staging branch like
> follow.
> git clone 
> git checkout -t -b staging-testing origin/staging-testing
> git chekcout -b MY_LOCAL_BRANCH
> not do work and subimt
> 
> So, how it work for other source structure, like now I want to make some
> for y2038 -> drivers/scsi which branch should I set up and work with,
> next/stable/or is there any specific y2038 branch.
> 
> Any wiki link or documentation that explain this full process which
> branch to work with when making changes to specific directory will be
> useful.
> 
> Thanks,
> Shirish
> 

Hi Shirish,

linux-next [0] is good to follow, and useful if you are touching cross-system
code. If you want to be safe, since not all subsystems are merged into
linux-next and some have multiple branches for next version fixes, new
features, etc, check the MAINTAINERS file [1]. There you will see information
you need.

For example for ACPI (drivers/acpi) it is
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

I hope that clarifies your question.
Luis



[0] git clone 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
[1] 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS



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


Bluetooth doesn't work

2015-11-04 Thread Kinka Huang
Hi all,
Thinkpad X1 2015, ubuntu 15.10, the bluetooth module seems not work well.
Once connect, it prints the following kernel log:

[  196.730943] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  196.730946] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  196.730948] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  196.740970] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  196.740975] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  196.740976] Bluetooth: hci0 SCO packet for unknown connection handle 0
[  201.764755] Bluetooth: hci0 SCO packet for unknown connection handle 257
[  201.764768] Bluetooth: hci0 SCO packet for unknown connection handle 257
[  201.764777] Bluetooth: hci0 SCO packet for unknown connection handle 257

and something I think related while kernel initing:

[3.738275] usbcore: registered new interface driver btusb
[3.754215] Bluetooth: hci0: read Intel version: 370810011003110e00
[3.755429] Adding 796k swap on /swap/swapfile.  Priority:-1
extents:66 across:13275644k SSFS
[3.757145] Bluetooth: hci0: Intel Bluetooth firmware file:
intel/ibt-hw-37.8.10-fw-1.10.3.11.e.bseq

I think it is a good chance for me to diving into the linux kernel, so
can anyone offer some hints that I could solve this problem.

$ uname -ar
Linux kinka-X1 4.3.0-rc7+ #50 SMP Wed Oct 28 22:49:01 CST 2015 x86_64
x86_64 x86_64 GNU/Linux

Many thanks~

Kinka

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


  1   2   >