Re: shared memory via /dev/shm?

2015-07-30 Thread Valdis . Kletnieks
On Thu, 30 Jul 2015 16:03:51 -0700, Nicholas Murphy said:

 Yes, I’ve read all the disclaimers against accessing files in the kernel, 
 but
 I want to set up a shared memory segment between a kernel module and one or
 more user processes, and /dev/shm seems like a good way to do that.

Is there a specific reason you aren't letting the userspace program create
an mmap() area and then write the identifying information to a /sys attribute
file (or other means of notifying the kernel of what to use)?


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


Re: debugging kernel module __init function?

2015-08-04 Thread Valdis . Kletnieks
On Tue, 04 Aug 2015 12:23:18 -0700, Nicholas Murphy said:

 How do I debug the __init function (that is called on module load)?

Is your .init function actually doing so much odd stuff that a few
carefully placed printk() calls aren't sufficient?


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


Re: What Next After Char, Block, Serial Parallel Drivers

2015-08-13 Thread Valdis . Kletnieks
On Tue, 11 Aug 2015 17:48:16 -, Sasha Mckinsey said:

 What should be the next steps besides looking for a job.

That's for *you* to decide, not for us to suggest.

Do authors go around asking What sort of book should I write? No - because
unless the author was interested in writing a gothic horror book, or
a romance novel, or steampunk, or what have you, it's going to be crap.
And if they *were* interested in writing a book in a given genre, they'd
not be asking for suggestions.

So go back and look at why you're interested in kernel hacking in the
first place, and base *your* answer on that.


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


Re: Kernel options to boot root over NFS

2015-08-07 Thread Valdis . Kletnieks
On Fri, 07 Aug 2015 22:38:11 -, Nestor Waldyd said:

 but all this *withouth* success.

You really need to be more specific regarding its failure to succeed.

Did you run a tcpdump to see the traffic?

How far did it get?  Did it pxeboot?  Did it successfully DHCP itself
an address, or did it fail?  Was an NFS mount packet received?  Did
it get a ways through there, and then die for some other reason?



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


Re: Please do not generate patches purely based on checkpatch.

2015-07-26 Thread Valdis . Kletnieks
On Sun, 26 Jul 2015 13:05:37 +0530, Yogesh Chaudhari said:

 However, is there a place which documents which maintainers(and/or
 sub-systems) accept checkpatch(or other cleanup related) patches and
 who will reject them outright? Wouldn't it be good to have this
 documented, especially given that using the checkpatch is advised in
 Documentation/SubmitChecklist?

Try something like 'git log drivers/net/wireless/whateverdev' (or
whatever part of the tree you're looking at, and see if there have been
previous checkpatch fixes in that part of the tree.


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


Re: Obfuscate code GPL 2 - The source uses kernel structs and GPL2 API

2015-07-21 Thread Valdis . Kletnieks
On Tue, 21 Jul 2015 15:49:22 -0300, Lucas Tanure said:

 Hi,

 This company released a obfuscated kernel module in GPL 2.
 http://www.incentivespro.com/downloads.html

 So, they didn't release the code at all. This is ok ?
 This against the law ?

We're code hackers here.

If the gpl-violations.org crew was still operating, they'd be a better
resource.  You might find a link somewhere on gnu.org to find somebody
that could offer advice...


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


Re: Fuzzing scheduler CFS

2015-07-22 Thread Valdis . Kletnieks
On Wed, 22 Jul 2015 10:30:47 +0300, Meyer Lansky said:
 I would like to improve the code, but has not found a practical method of 
 finding errors.

Bugs in the scheduler almost always manifest in one of two ways:

1) Truly spectacular crashes or hangs where you *know* you've found a bug.

2) Find a workload that it performs poorly (for instance - how does it deal on
a 4-core system with 8 processes that use enough memory that together, they
push the system into thrashing mode, plus 40 or 50 processes that only want
millisecond timeslices - but at a high realtime priority?  Can you find
other mixes that give it indigestion?

You're going to have to learn a lot about process scheduling to find bugs
in that code. And when I say a lot, I mean probably as much as you'd cover in
a full-semester college course




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


Re: Obfuscate code GPL 2 - The source uses kernel structs and GPL2 API

2015-07-21 Thread Valdis . Kletnieks
On Tue, 21 Jul 2015 20:13:48 -, Jeff Haran said:
 But it seems to me that if it builds, then they’ve released the code.

No - the GPLv2 says:

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. (yadda yadda)

So unless the engineers *prefer* the obfuscated form, they really haven't
distributed the source code.

(IANAL, I'm a code hacker, and all that. All legal advice is worth what
you paid for it...)


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


Re: HOSTAPD Error log

2015-07-23 Thread Valdis . Kletnieks
On Thu, 23 Jul 2015 12:31:18 +0530, Amit Gupta said:

 Configuration file: /etc/hostapd.conf
 [  199.672712] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
 Failed to update rate sets in kernel module
 [  199.687566] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
 Using interface wlan0 with hwaddr 00:0e:8e:38:29:e6 and ssid 'test_wifi_2'


 Eventhough I am getting this error log from user space application(hostapd)
 code, my wifi device is working fine. But I want to remove this error log
 and want to know the root cause this error log.

My gut reaction is that hostapd is issuing ioctl() calls in the wrong order
and/or failing to allow a long enough delay or wait for a specific event.

I'd recommend running something like:

# strace -f hostapd -B /etc/hostapd.conf  /tmp/strace.out 21

and go look for what failing call was made just before the write call
that output 'Failed to update'.  Hopefully, tracing the flow of that
call will reveal a  kernel code path that output the 'link is not ready'
message.  Then you'll know what 'if (somecondition)' landed you in that
situation.

Knowing that, it will become a lot easier to figure out what happened.


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


Re: About Low Hanging Fruits

2015-07-14 Thread Valdis . Kletnieks
On Mon, 13 Jul 2015 13:11:57 -0400, Robert P. J. Day said:

   actually, one area of low-hanging fruit is the Documentation/
 directory, which could always use some attention. documentation is
 always getting out of date, so pick a subsystem and clean up the docs.

Good catch, I'll add it to my standard reply. :)


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


Re: Configuration settings for WM8850 wolfson audio codec

2015-07-15 Thread Valdis . Kletnieks
On Wed, 15 Jul 2015 12:26:29 +0530, bineet said:

 I need to check setting done for WM8850 wolfson audio codec chip. I tried
 browsing linux code, but couldn't find any clue.
 Could someone please help with the same?

Hmm.. are you sure it's an audio codec chip?

WMB8850 appears to be an entire ARM architecture.

[/usr/src/linux-next] git grep WM8850
Documentation/devicetree/bindings/arm/vt8500.txt:Boards with the Wondermedia 
WM8850 SoC shall have the following properties:
Documentation/devicetree/bindings/clock/vt8500.txt: wm,wm8850-pll-clock - 
for a WM8850 PLL clock
Documentation/devicetree/bindings/serial/vt8500-uart.txt:   including 
WM8850/WM8950), or wm,wm8880-uart (for WM8880 and later)
arch/arm/Kconfig.debug:   devices, including VT8500, WM8505, WM8650 and 
WM8850.
arch/arm/boot/dts/wm8850-w70v2.dts: *  - Device tree file for Wondermedia 
WM8850 Tablet
arch/arm/boot/dts/wm8850-w70v2.dts: model = Wondermedia WM8850-W70v2 
Tablet;
arch/arm/boot/dts/wm8850.dtsi: * wm8850.dtsi - Device tree file for Wondermedia 
WM8850 SoC
arch/arm/configs/multi_v7_defconfig:CONFIG_ARCH_WM8850=y
arch/arm/configs/vt8500_v6_v7_defconfig:CONFIG_ARCH_WM8850=y
arch/arm/mach-vt8500/Kconfig:config ARCH_WM8850
arch/arm/mach-vt8500/Kconfig:   bool WonderMedia WM8850
arch/arm/mach-vt8500/Kconfig: Support for WonderMedia WM8850 System-on-Chip.
drivers/clk/clk-vt8500.c:#define PLL_TYPE_WM88503
drivers/clk/clk-vt8500.c:/* Helper macros for PLL_WM8850 */
drivers/clk/clk-vt8500.c:#define WM8850_PLL_MUL(x)  x  16)  0x7F) + 
1) * 2)
drivers/clk/clk-vt8500.c:#define WM8850_PLL_DIV(x)  x  8)  1) + 1) * 
(1  (x  3)))
drivers/clk/clk-vt8500.c:#define WM8850_BITS_TO_FREQ(r, m, d1, d2)  
\
drivers/clk/clk-vt8500.c:#define WM8850_BITS_TO_VAL(m, d1, d2)  
\
drivers/clk/clk-vt8500.c:   case PLL_TYPE_WM8850:
drivers/clk/clk-vt8500.c:   pll_val = WM8850_BITS_TO_VAL(mul, div1, 
div2);
drivers/clk/clk-vt8500.c:   case PLL_TYPE_WM8850:
drivers/clk/clk-vt8500.c:   round_rate = 
WM8850_BITS_TO_FREQ(*prate, mul, div1, div2);
drivers/clk/clk-vt8500.c:   case PLL_TYPE_WM8850:
drivers/clk/clk-vt8500.c:   pll_freq = parent_rate * 
WM8850_PLL_MUL(pll_val);
drivers/clk/clk-vt8500.c:   pll_freq /= WM8850_PLL_DIV(pll_val);
drivers/clk/clk-vt8500.c:   vtwm_pll_clk_init(node, PLL_TYPE_WM8850);
drivers/pinctrl/vt8500/Kconfig:config PINCTRL_WM8850
drivers/pinctrl/vt8500/Kconfig: bool Wondermedia WM8850 pin controller driver
drivers/pinctrl/vt8500/Kconfig: depends on ARCH_WM8850
drivers/pinctrl/vt8500/Kconfig:   Wondermedia WM8850 SoCs.
drivers/pinctrl/vt8500/Makefile:obj-$(CONFIG_PINCTRL_WM8850)+= 
pinctrl-wm8850.o
drivers/pinctrl/vt8500/pinctrl-wm8850.c: * Pinctrl data for Wondermedia WM8850 
SoC
drivers/pinctrl/vt8500/pinctrl-wm8850.c:MODULE_DESCRIPTION(Wondermedia WM8850 
Pincontrol driver);
drivers/video/fbdev/Kconfig:  and WM8850 SoCs.

Hope that helps.


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


Re: goto???

2015-07-17 Thread Valdis . Kletnieks
On Fri, 17 Jul 2015 10:48:53 +0200, Martin Knappe said:
 Very easy:

On Fri, 17 Jul 2015 11:40:00 +0200, Martin Knappe said:
 Like so:

On Fri, 17 Jul 2015 11:44:34 +0200, Martin Knappe said:
 Sorry, have to correct my solution. You need to add cleanupState = 0
 just before the finish, like so:

I think the fact we've seen 3 version inside an hour shows that it's
not as Very easy as originally asserted.


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


Re: About Low Hanging Fruits

2015-07-13 Thread Valdis . Kletnieks
On Mon, 13 Jul 2015 12:13:28 +0530, Mayur Patil said:

   I just want to know like other Open source projects is there a thing in
 linux kernel as Low hanging fruits.

The Linux kernel has been worked over by professional programmers for more
than a decade, and as a result the number of things that can be attacked
by a relatively unskilled newcomer is fairly low.

Your best place to start is probably under drivers/staging, where we put
all the stuff that's *not* up to standards yet.  Each driver should have
a TO-DO file describing what needs doing, and Greg HK is always willing to
take checkpatch style fixups for the staging tree (many other maintainers
*don't* want style patches that aren't connected to other work - if there's
other active work, they can introduce merge conflicts, and if nobody's working
on something, it's best to not touch stable code...)


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


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

2015-11-11 Thread Valdis . Kletnieks
On Thu, 12 Nov 2015 02:55:40 +, "Gavin O'Leary" said:

> What is this warning about? How do I go about fixing it?
>
> Thank you,

Let's cut-n-paste 2 more lines out of the file:

613 /* Allocate the rxmeta */
614 rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC);
615
616 if (rxmeta == NULL) {
617 netdev_err(wlandev->netdev,
618"%s: Failed to allocate rxmeta.\n", 
wlandev->name);
619 result = 1;
620 goto exit;
621 }

Lesson 1:  Under what conditions will the kzalloc return NULL?  If this happens,
what are the chances you'll have a chance to *see* the message? (Hint - what
size is that struct?  If the kernel can't find that much free memory, what are
the chances you still have a functional syslog daemon?)

Lesson 2: The wisest thing ever said about checkpatch.pl:
" the code is more what you'd call "guidelines" than actual rules."
-- Captain Barbossa


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


Re: is there a reason "usbhid.quirks" parameter is not root writable?

2015-11-12 Thread Valdis . Kletnieks
On Thu, 12 Nov 2015 16:44:35 -0800, Greg KH said:
> On Thu, Nov 12, 2015 at 03:15:41AM -0700, Robert P. J. Day wrote:

> > module_param_array_named(quirks, quirks_param, charp, NULL, 0444);
> > MODULE_PARM_DESC(quirks, "Add/modify USB HID quirks by specifying "

>
> You can add a runtime quirk to the device itself when it shows up in
> sysfs for the hid driver.  Use that instead of the module parameter for
> that specific device.

That's a workaround.  Still unexplained is why it's mode 0444 for "add/modify".

But to answer Robert's question:  I suspect that it's mode 0444 so you can
read the current list, but changing the list after modprobe time is for
some reason problematic.  Having said that, I admit I haven't looked at
the source deep enough to find the exact reason. It's probably something
subtle, because simply adding an ID to a list of IDs shouldn't be that
hard


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


Re: hi, i want to use a script in kernel

2015-11-17 Thread Valdis . Kletnieks
On Tue, 17 Nov 2015 14:01:19 +0900, Naver said:
> hi,
> i want to use a script in kernel, but i can't use this.
> in my terminal.
> yoon@pc:~/project/aosp/kernel/linux/scripts$ ./checkpatch.pl sortextable.c
> Must be run from the top-level dir. of a kernel tree

$ cd ~/project/aosp/kernel/linux
$ scripts/checkpatch.pl scripts/sortextable.c

Though why you have a .c file in scripts/ is beyond me, it should probably
be in some other directory.


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


Re: How to disable "module verification failed: signature and/or required key missing - tainting kernel" message?

2015-11-01 Thread Valdis . Kletnieks
On Mon, 02 Nov 2015 13:57:10 +0800, Nan Xiao said:

> I add "CONFIG_MODULE_SIG=n" at the beginning of Makefile, and rebuild
> the module.

> Could anyone give some clues on this issue? Thanks in advance!

Did you *also* both rebuild and reboot into the new kernel that has
MODULE_SIG=n?


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


Re: Looking for easy first-timer tasks

2015-10-05 Thread Valdis . Kletnieks
On Sat, 03 Oct 2015 19:37:54 -0700, Sean Bollin said:
> I'm interested in getting started doing kernel dev.

Why?  Fame? Fortune? It's a chick magnet? You're totally pissed off
because suspend/resume is wonky on your laptop?

If you *really* want to help, just get yourself a copy of the linux-next
tree, build it every week or so, and file bug reports/patches if you hit
something odd. We need code coverage testers more than we need random
patches - and Grek KH will verify that most kernel releases, I manage to
break it anywhere from 1 to 4 times a release just using it day-to-day on
my main laptop (not even pointing trinity or iozone or any other stress
tester at it).


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


Re: Knowledge of Protocols

2015-07-09 Thread Valdis . Kletnieks
On Thu, 09 Jul 2015 17:56:15 -, Mohit . said:

 I would like to know what do statements like the following mean
- Have knowledge of Protocols such as TCP/IP, IPSec, IPV6 or SSL


 Does it mean to have a theoretical view of the facets which constitute the
 protocol which can be done by reading RFC or does it also mean to have
 implementation knowledge (code understanding) as well.

It usually means understand it from the point of view of the job you're
applying for, and know it well enough to be productive/useful without
extensive training.

If you're applying for a network engineer, it means you understand at
least a bit about BGP and routing, how to use wireshark or other tools
to look at bits on the wire, identifying nodes that are having issues, etc.

If you're applying for a userspace programming job, it means you
know how to use gethostbyname(), send()/recv()/ and friends, and
how to use OpenSSL to connect to a remote system that wants to talk TLS.

If you're doing kernel hacking, it means you understand how all the
stuff under net/ works - and that if it says SSL it's time to go
running screaming into the night. :)


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


Re: How to get the dentry value - no path_lookup

2015-09-07 Thread Valdis . Kletnieks
On Mon, 07 Sep 2015 12:10:56 +0530, Pria Mn said:

> return valid dentry value. My requirement is to fetch directory name from
> filepath.

First off, unless this is a class assignment, your *requirement* isn't
to fetch a directory name.

Fetching the directory name is a *solution* you're thinking of using for
a problem you're trying to solve.

So take a step back, and explain what you're trying to do, and why you thought
getting the directory name from filepath was a solution - it's quite
likely that you should be using some other API and approach entirely.

(I'd estimate that 75% of the "I can't get this API to work" questions
on the Linux kernel are because the person should be using a different API)


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


Re: Eudyptula task 2

2015-09-08 Thread Valdis . Kletnieks
On Tue, 08 Sep 2015 20:08:57 -0600, Yacdaniel Hurtado GarcC-a said:

> atm i get this kernel version: 4.2.0-rc8 i dont know if i am doing
> something wrong.Thanks

You may or may not be doing something wrong.  But you're probably
no longer doing the Eudyptula challenge. :)


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


Re: Use a variable before it's declaration

2015-09-10 Thread Valdis . Kletnieks
On Thu, 10 Sep 2015 15:09:42 +0800, Rock Lee said:

> union thread_union init_thread_union __init_task_data =
>
>  { INIT_THREAD_INFO(init_task) };

'gcc -E' to see what this expands to.  All may not be as it seems. :)


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


Re: Set the ACPI=on on the cmdline, and the OS can not boot.

2015-09-10 Thread Valdis . Kletnieks
On Thu, 10 Sep 2015 17:41:51 +0800, tianlilai said:
>  When I set the ACPI=on on the cmdline,and the OS can not boot(If set
> ACPI=off, The system is OK). The attachmemt file is the booting log. Would
> help me slove this ploblem? Thanks very much.

>  Note:kernel version v2.6.18,and the arch is x86_64.

That's an ancient kernel - 9 years ago.  So you're missing the last 9 years
of ACPI fixes.

Also, problems like this are usually caused by the BIOS having buggy ACPI
tables that don't match the actual hardware - and if you're still on 2.6.18,
your BIOS is probably equally out of date.  And you would need to be a *lot*
more specific about the hardware than "x86_64" - for instance,"Dell Latitude
E6530 laptop with BIOS A16".

Unfortunately for you, I doubt anybody is going to want to give much more
assistance than this for free until you're running a kernel from the
last 2-3 years and the most recent BIOS the manufacturer has released.
(I can think of a number of people that will do this for contract work, but
be prepared to pay US$50/hour and up...)


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


Re: Tips for Kernel Module Debugging

2015-09-12 Thread Valdis . Kletnieks
On Sat, 12 Sep 2015 16:04:43 -0300, Lucas Tanure said:

> I'm testing the linux-next tree and I got this stack:
>
> [2.158054] Call Trace:
> [2.158058]  [] dump_stack+0x4b/0x72
> [2.158061]  [] warn_slowpath_common+0x82/0xc0
> [2.158063]  [] warn_slowpath_null+0x1a/0x20
> [2.158066]  [] drm_dev_alloc+0x251/0x320 [drm]
> [2.158070]  [] drm_get_pci_dev+0x3b/0x1e0 [drm]
> [2.158081]  [] i915_pci_probe+0x34/0x50 [i915]
>
> How is the best way to debug this ? I really need to add a print, compile
> and boot many times ?
> How would you guys debug this ?

Step 0:  Include the last few lines *before* the Call Trace - if indeed
it was a Warning, it will give you the file and line number of where the
WARN_ON was..

[26636.029711] [ cut here ]
[26636.029724] WARNING: CPU: 3 PID: 19157 at 
./arch/x86/include/asm/thread_info.h:239 sigsuspend+0xa4/0xb0()

Bummer of a birthmark, Hal.  The one my laptop hit was a WARN_ON inside
either a macro or static inline from that .h file. Fortunately, yours
was inside a .c file and pointed in the right place (see below for how
I know that...)

That 'cut here' is where you should start the cut-n-paste, and include
everything down to 'end trace'.

Having said that, looking at drivers/gpu/drm/drm_drv.c:drm_dev_alloc() we
find only one WARN_ON:

if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL);
if (ret)
goto err_minors;

WARN_ON(driver->suspend || driver->resume);
}

As to *why* that one triggered, you'll have to ask an actual i915 expert.


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


Re: Help debugging linux-next.

2015-09-13 Thread Valdis . Kletnieks
On Sun, 13 Sep 2015 14:09:21 -0300, Lucas Tanure said:

> I would like some tips about how debug a issue with linux-next.
> I'm trying to find things to do in kernel, and the first thing is boot the
> linux-next tree.

> How I can find the commit that create the problem, since every commit that
> I tested I got black screen ?
> Whats the best way to debug this kind of issue ?

Since you obviously had a non-linux-next kernel that *did* boot, 'git bisect'
is the fastest way to find the buggy commit. The best part is that it requires
almost no actual understanding of the code.

General scheme for using git bisect, even if you have *no* idea what
the problem is:

Say you know that a 4.0 kernel works OK.  You then do:

git bisect start
get bisect bad next-201150910(or whatever the earliest known-bad is)
git bisect good v4.0 (Round stable releases like 4.0.9 to the base)

Repeat the following:

Build the kernel.  Boot it.  Reboot to a known good kernel if needed.

If it was good, use 'git bisect good'  If it died, 'git bisect bad'.
end repeat

until it tells you the bad commit. (It won't take long - going from 4.0
to current linux-next will probably take 11 to 13 times around).  And it's
simple enough to do that most of the time I have to bisect something, I'll
do it on my laptop while watching something on Netflix

*** NOTE ***
* Avoid the temptation to try to bisect between two next-2015...  tags
* because you know the problem commit is between two tags a week apart.
* Due to the way that linux-next is built, this *won't* work.  This is
* probably the single biggest cause of failure to bisect a problem in
* linux-next
*** END NOTE

Since you know the problem is i915 related, you can speed the process
up even more by doing

git bisect start -- drivers/gpu/drm/i915

which instead of considering *all* commits, will only bisect across commits
that touch that part of the source tree...


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


Re: Advice on Linux Kernel Development

2015-09-13 Thread Valdis . Kletnieks
On Sun, 13 Sep 2015 23:40:22 +0530, Mayur Patil said:

> if I want to get started with Linux Kernel Development then is it feasible 
> that
> I can do all my experiments on Virtual Machine as on Linux my Internet
> dongle does not work, I am asking in terms of performance and efficiency.

A very large chunk of linux kernel development can be done in a virtual
machine (use VirtualBox, or VMWare, or whatever).  Note that very hardware
dependent code (like messing around with MSR registers, or some device drivers)
won't be easily debugged, because the VM gives you a virtualized version
of a generic system.  But stuff like filesystems or schedulers or new
syscalls are easily done in a VM.


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


Re: mmap - post/pre actions

2015-09-15 Thread Valdis . Kletnieks
On Tue, 15 Sep 2015 22:40:50 +0300, Ran Shalit said:
> Hello,
>
> I need to implement mmap for non-volatile memory chip (NVRAM).
> I already did something simple, but now I understand that it is not complete:
> The nvram need to be unlock and locked after finishing the memory task
> of read/write.
>
> Does mmap can handle such post/pre actions or not ( I guess that if
> not -  I will need to use read/write alternatives) ?

Not sure if it does or not.  But the unlock should be done when the mmap
segment is first created, and locked when the last reference to the segment
is removed.


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


Re: Preceding a method call with (void)

2015-09-10 Thread Valdis . Kletnieks
On Thu, 10 Sep 2015 07:52:49 +0300, Kevin Wilson said:

> (void) myFunc(param1);
>
> I did not encounter such cases in the kernel code that I read, thus far.
>
> On the other hand, I did not saw in the kernel coding style doc
> anything which prohibits such usage.
>
> If I remember, using (void) before the method name is a way to tell
> explicitly that this method does not return any value,
> but I am not sure as for the exact reasons it is used (in userspace).

Well, if the function actually returns nothing, in kernel code we usually
declare it as:

void myFunc( int param1)
{
/* yadda yadda yadda *.
}

Given that, what reason is there for casting the return value with (void)?

(And if the function is actually   'int myFunc ( int param1) {...}',
why are you calling it and then ignoring the return value?  That's a clue
that you're abusing the API...)


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


Re: gfp_flag

2015-09-14 Thread Valdis . Kletnieks
On Sun, 13 Sep 2015 21:21:35 -0700, Greg KH said:
> On Mon, Sep 14, 2015 at 09:03:53AM +0530, Ronit Halder wrote:
> > In  drivers/staging/android/ion/ion.c in line 1475 and 1493 gfp_flag
> > is set to -1
>
> No, that's not what the code does, please read it again.

My guess is it's making some other routine work a lot harder in order
to cover all possibilities, no matter how unusual :)


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


Re: Unset LOCKDEP and TRACE_IRQFLAGS_SUPPORT

2015-10-02 Thread Valdis . Kletnieks
On Fri, 02 Oct 2015 18:11:53 +0200, Gilles Chanteperdrix said:

> TRACE_IRQFLAGS is broken with the I-pipe patch. At least on ARM. The
> visible result is LOCKDEP false positives, but there may be some
> more subtle kernel data structures corruption due to the fact that
> the TRACE_IRQFLAFGS code is called from the Xenomai context. The
> principle of Xenomai is to be able to run while Linux believes
> its interrupts are off, in the middle of its critical sections. For
> this to be possible, the code run in this context must never touch
> any Linux kernel data structures. Enabling TRACE_IRQFLAGS breaks
> this assumption: Linux code which potentially accesses Linux data
> structures gets called from the Xenomai context. The consequences
> can be anything, such as mlock failing, though in practice we never
> get any report about that. The usual reason for mlockall failing is
> because the user is not root, and with default ulimit settings at
> least, mlockall can not be called by non-root users.

Thanks for the detailed explanation - It's a refreshing change from the
usual cargo-cult programming "It seems to break but we have no idea why,
so just turn it off" we often see with out-of-tree patches.

One thing jumped out at me:

> The principle of Xenomai is to be able to run while Linux believes
> its interrupts are off, in the middle of its critical sections

Are you saying that it enables interrupts when Linux thinks they are off?

If so, all I can say is: You're a far braver man than I. :)


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


Re: Unset LOCKDEP and TRACE_IRQFLAGS_SUPPORT

2015-09-27 Thread Valdis . Kletnieks
On Mon, 28 Sep 2015 09:58:21 +1300, vibnwis said:

> Thanks for sharing. Being a newbie, I would have to have some sort faith
> until it is proven otherwise. Hence, I am tasked to get the TRACE_IRQFLAGS
> turn off. Once, I have got it done and the results would tell us if the
> patches were fine or not.

The fact they may work with a specific option turned off is *not* proof
that they are "fine" - merely that it doesn't trip over the problem.  It's
kind of like being told your car's brakes are possibly defective and you
should avoid heavy braking - and your response is to choose a path home that
doesn't involve any heavy braking and then saying your brakes are "fine".

It's even more worrisome that people are suggesting "just turn it off"
without being able to point at a reason *why* it needs to be turned off.

Which gives you more confidence:

NVidia's modules won't work on a kernel defined with LOCKDEP enables, we
don't know why, so just turn it off..

versus

NVidia's modules won't work on a LOCKDEP kernel because with that defined,
the locking functions called by the module are redirected to debugging LOCKDEP
variants that are EXPORT_SYMBOL_GPL.  When you try to modprobe it, the _GPL
variants aren't available to the NVidia module due to its licensing, so you
get 'unresolved symbol' errors.  This information should be enough for you to
figure out how to fix your personal copy and make it work (but not to make
that copy redistributable).

See the difference?


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


Re: Unset LOCKDEP and TRACE_IRQFLAGS_SUPPORT

2015-09-27 Thread Valdis . Kletnieks
On Mon, 28 Sep 2015 11:42:34 +1300, vibnwis said:

> > See the difference?

> The kernel I work is for Pandaboard. Hence NVidia will not in the picture.

The point is that one explanation gives a lot more confidence and understanding
than the other.  I'll let you figure out for yourself which the suggestions
to turn off TRACE_IRQFLAGS sounds more like


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


Re: Unable to get stmmac driver of Altera Cyclone V to support MTU9000

2015-09-27 Thread Valdis . Kletnieks
On Mon, 28 Sep 2015 10:14:47 +0800, Teoh Choon Zone said:

> > Have you tried the above with 8972 to instead of 9000.
> Yes, but nothing above 8144 works.

It's possible it's a defective design, and is crippled so it can manage
8144 but not the 9000 most chipsets can do.  The fact that 8144 works
is proof the chipset *does* have a concept of jumbograms - but there's
been a *lot* of misdesigned chips that have this sort of issue

Your choices may be limited to running the subnet with an MTU of 8144, or
replacing the defective card.  Have you found anything online claiming that
the card *can* specifically support MTU=9000?, or reached out to the
company?


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


Re: Unset LOCKDEP and TRACE_IRQFLAGS_SUPPORT

2015-09-26 Thread Valdis . Kletnieks
On Sun, 27 Sep 2015 12:06:49 +1300, vibnwis said:
> Setting DEBUG_KERNEL->n will unset  L1 [=0]
> and

And.  Right.

> setting IRQSOFF_TRACER [=y]  || TRACING_SUPPORT [=n] || FTRACE [= n] will
> unset L2 [=0]

In your first post, you had implied that you had tried  doing one or
the other, not both.

Why are you trying to unset TRACE_IRQFLAGS, anyhow? Does it cause a problem
for you?


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


Re: Accessing pointers inside struct passed as argument to ioctl calls

2015-09-28 Thread Valdis . Kletnieks
On Mon, 28 Sep 2015 19:59:41 -0300, "Daniel." said:

> The real thing is a driver to nrf24l01+ driver from Nordic. I may use this
> non copying aproach to exchange lot of frames without copying. This would
> improve driver's performance. :)

There is already well-developed zero-copy code for several network drivers
in the kernel tree.  Don't re-invent existing code that's already debugged.


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


Re: getting warning when a method parameter in a kernel module is not used

2015-09-24 Thread Valdis . Kletnieks
On Thu, 24 Sep 2015 17:25:15 +0300, Kevin Wilson said:
> Hi,
>
> When a method parameter in a kernel module is not used, we do not get
> any warning (as opposed to a variable which is not used).
>
> Is there any compilation flag which enables getting warning in such a case ?

No, and it's unclear that it would be worthwhile.

Consider a kernel module that implements a device driver, and the ->ioctl()
only implements ioctl(fd,START|STOP|PAUSE|RESUME,/* ignored parameter */).

Or any other case where there's a generic struct of pointers to functions that
have fixed signatures, but for a given module, we don't need to access one.

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


Re: Preceding a method call with (void)

2015-09-18 Thread Valdis . Kletnieks
On Fri, 18 Sep 2015 17:04:03 +0300, Rami Rosen said:

> Well, there are rare cases in the kernel when you add (void) before calling
> the method. For example, if the method returns int or other type and you
> want to emphasize that you are aware of that and deliberately not check the
> return value.
> See for example:
> http://lxr.free-electrons.com/source/drivers/acpi/acpica/tbxfload.c#L156

The fact something is done in the tree doesn't mean it's *correct*.

If you check the tree, there are 80 instances of it being cast to (void),
and 9 instances of 'status ='.

Now if you go look at the source of the function in 
drivers/acpi/acpica/utmutex.c
we discover that there's 3 or 4 possible return(..) conditions in the
function (one only if _DEBUG is defined).  Looking at the places that
places that bother checking the return code, they all look something like this:

nsxfeval.c: status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
nsxfeval.c- if (ACPI_FAILURE(status)) {
nsxfeval.c- return (status);
nsxfeval.c- }

Now, given that 80 other sites don't bother checking, there's a good
chance that these 9 call sites shouldn't bother either, and the calling
code should be changed to not check the status either, and then make
the function definition a void.

(Of course a more careful examination of the code should be undertaken, but
it's more likely that there's 9 sites that are checking a return code that
doesn't actually matter than the chances that it really *does* matter in
9 places but not in 80 others...




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


Re: Which git for developing patch?

2015-09-24 Thread Valdis . Kletnieks
On Thu, 24 Sep 2015 20:03:53 -, Rob Groner said:
> However, it won't build for me (openssl/bio.h is missing) after a cloning.

That's for userspace code.  You need to install openssl-devel (or whatever
your distro calls the development headers/libraries).



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


Re: Best tests to measure Kernel Performance

2015-12-01 Thread Valdis . Kletnieks
On Tue, 01 Dec 2015 18:45:51 -0600, Victor Rodriguez said:
> Despite the fact that this is not a well formulated question.

Exactly why it's hard to give a good answer.  It *really* depends on
what aspect you're interested in - I/O bandwidth, throughput, latency,
or other.  What I currently do at $DAYJOB is worry how fast I can get
a cluster of servers to flip blocks to and from disk to 40Gbit network
interfaces, and we've found a combo of iozone's and 'tar xf linux-2.6.32.tar.gz'
running at the same time is a good stand-in for our production workload.

Of course, your mileage will vary. :)


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


Re: Developing environments used for kernel development

2015-12-24 Thread Valdis . Kletnieks
On Thu, 24 Dec 2015 19:29:11 -0500, Ruben Safir said:
> On 12/24/2015 01:43 PM, valdis.kletni...@vt.edu wrote:
> > The only *real* fix is to go to a non-querty keyboard.
>
> No, retraining and reprogramming the user is not a solution.

Then you're stuck with a control key where it's difficult for
the left pinky to get to.

Feel free to suggest remappings that are easy for an index or second finger to
reach on a querty keyboard (and which don't grab a commonly used key like 'h'
or '6' :), or some other *real* fix that isn't a partial hack and doesn't fall
into your "retraining and reprogramming" category.



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


Re: how to reduce both vmlinuz size and modules?

2015-12-26 Thread Valdis . Kletnieks
On Sat, 26 Dec 2015 10:39:04 -0500, "Robert P. J. Day" said:

>   if i start with the latest git kernel repo, it *looks* like i can
> use the /boot/config-4.2.8-200.fc22.x86_64 config file as a starting
> point, copy it in as .config, then:
>
>  $ make allmodconfig
>  $ make localmodconfig

How much simpler could you make it? :)

The place you're most likely to screw it up is to forget to plug in all
your USB and other widgets at least once before the 'make localmodconfig'
to make sure they get modprobed.

As a practical matter, if 'make allmodconfig' had slightly different semantics,
we could do better.  'allmod' has semantics of 'turn on every possible =m'.
If there were a semantic of 'convert as many existing =y into =m, but *don't*
convert =n into =m', we could do this and it would almost certainly be
faster.

boot distro kernel
(plug in widgets)
make localmodconfig
boot into that kernel
make mostlymodconfig
boot
plug in widgets
make localmodconfig  *again*

The reason it would be faster - a Fedora Rawhide kernel has 2,793 =m, a
'allmodconfig' has 5,162 - but doing a 'localmodconfig' gets it down to
33 on my laptop (though admittedly I've made a lot of device drivers =y
so they're part of vmlinux - but /sys/module tells me there's a max of
133 or so of those).  So after the first 'localmodconfig', you've gotten
rid of probably 75% to 90% of the modules to build, and thus build time.
It's probably faster to do 3 builds like this than an allmod/mostlymod
pair.

Note that if you're *really* concerned about vmlinux size (like embedded
devices), you'll want to make a second pass through all the =y, and see
how many are system features you don't need, but which can't be modular.
Things like SYSV shared memory and IPC, BSD process accounting, and so on...

I wonder if adding a 'mostlymodconfig' to Kconfig would be worthwhile.
Comments?


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


Re: Developing environments used for kernel development

2015-12-24 Thread Valdis . Kletnieks
On Thu, 24 Dec 2015 10:41:36 -0500, Ruben Safir said:
> EMACs might work better if they took LISP out of it and adopted it for a
> QWERTY keyboard

Doing something about the keymappings would probably help, as currently a
lot of the most common sequences require use of weaker fingers (in particular,
control-anything beats on your left pinky on most keyboards).  The problem
is that there's no good keys to remap *to* where the first and second fingers
of either hand can easily reach it (Sorry, F5-F8 are too much of a stretch
on most hardware).

The only *real* fix is to go to a non-querty keyboard.  Here's one that
looks promising - the "key-cluster" module gives you 3 keys that will sit
at a convenient place for your left thumb...

https://www.crowdsupply.com/ugl/ultimate-hacking-keyboard/updates/1929

(Note - I haven't actually bought into that one, just an example of what
would be needed.  There's a lot of even more extreme ergonomic keyboards
that would also be plausible.  But few people want to drop $250-$400 just
to make Emacs more usable.)

As far as taking elisp out - Nope.  Complete non-starter, because the reason
that Emacs is powerful is because you can use elisp to configure, and more
importantly extend, the editor.  For instance, look at this collection
of Emacs interfaces to Git:

http://www.emacswiki.org/emacs/Git

and remember that *all* of those are almost certainly written in 100% elisp.


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


Re: dumping large buffers to file

2015-11-24 Thread Valdis . Kletnieks
On Tue, 24 Nov 2015 06:30:22 +, Ramon Fried said:

> I'm currently debugging a ISP DMA issue in a kernel module.
> For debugging, I would like to dump buffers to a file on run time.
> The buffers are quite big, 1MB at least.

The *other* question is how *often* you plan to do this.  Doing it
once a second is one thing, doing it once a millisecond is another.

> I can think of numerous ways of transferring the buffer to user space and
> saving it by a dedicated user process (Netlink, sysfs, char device, etc.)

sysfs is probably a bad choice due to its 'one attribute per file' rule,
debugfs would be a better approach.  netlink is probably an option, and
it's hard to argue with the simplicity of a char device with a plain
old 'tail -f /dev/my-debug-file > /tmp/debug.out' or similar...



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


Re: git tags (RC kernels ) and kernel versions (www.kernel.org)

2015-11-26 Thread Valdis . Kletnieks
On Thu, 26 Nov 2015 10:46:24 +0200, Kevin Wilson said:

> 13 sub version of the 4.1 kernel:
> 4.1.1
> 4.1.2
> .
>
> 
> 4.1.13

This is a string of 13 patchesets that came out *AFTER* v4.1 was released.

> git tag | grep 4.1
> I get:
> v4.1
> v4.1-rc1
> v4.1-rc2
> v4.1-rc3
> v4.1-rc4
> v4.1-rc5
> v4.1-rc6
> v4.1-rc7
> v4.1-rc8

While these are "release candidates" that came out *before* 4.1 release.

The actual order is like this:

v4.1-rc1 4.1-rc2 4.1-rc3  ... 4.1-rc8  v4.1 - v4.2-rc1 v4.2-rc2 ... (Linus tree)
note this is a branch in different tree-> \ 4.1.1 4.1.2 4.1.3 4.1.4  (stable 
tree)

Note the .1 .2 .3 are "stable" releases not even tagged in Linus's tree,
as they are backports of fixes that have landed in newer trees.  So for
instance, if a regression is found and fixed in the v4.2-rc2 release, it
may be backported and become part of 4.1.5 or whatever.

Hope that clarifies things for you.


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


Re: cross compilation

2016-06-06 Thread Valdis . Kletnieks
On Tue, 07 Jun 2016 02:27:03 +0530, Shyam Saini said:

> To choose best optimized code, i need to first compile them and then
> disassemble  the compiled code, where a change in single line would make a
> significant difference in the performance.

Note that due to things like cache line misses, looking at the code will
tell you almost nothing about which is *really* the "best" code...

> So, my question is how to compile* x86 based network drivers  on x86_64
> Ubuntu machine*. Currently I'm running Ubuntu 14.04.

Why do you need to cross-compile?  Just build the drivers as x86_64.  Pretty
much anybody who actually *cares* about performance has moved off 32-bit
kernels a while ago (unless you're stuck with an embedded 32-bit CPU).


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


Re: blacklist kernel modules

2016-05-30 Thread Valdis . Kletnieks
On Mon, 30 May 2016 19:58:14 +0530, Muni Sekhar said:
> Hi,
>
> I need to configure blacklisting few kernel modules in multiple
> customer test systems.
>
> For this I added an entries in the /etc/modprobe.d/blacklist.conf and
> generated an initramfs image.
>
> All our test systems are having an Ubuntu distribution.
>
> I am trying to figure out other best possible methods.
>
> Which is the best possible way to blacklist kernel modules in multiple
> test system at once?
>
> Ideally we will supply a debian package for customers for installing a
> new software. Similarly can it be possible to create a debian package
> for blacklisting kernel modules?

Simply ship a /etc/modprobe.d/my-blacklist.conf that contains a line:

blacklist my-module-to-ignore

The blacklist commands don't have to be in one specific blacklist.conf.


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


Re: [PATCH] HC-SR04 ultrasonic ranger IIO driver

2016-05-31 Thread Valdis . Kletnieks
On Tue, 31 May 2016 23:05:57 +0200, johan...@johannesthoma.com said:

Looks good overall, far from the ugliest driver I've seen.  I spotted one
locking bug, and a few small typos etc, noted inline...

> From: Johannes Thoma 
>
> The HC-SR04 is an ultrasonic distance sensor attached to two GPIO
> pins. The driver based on Industrial I/O (iio) subsystem and is

The driver is based on the Industrial...


> + * To configure a device do a
> + *
> + *mkdir /config/iio/triggers/hc-sr04/sensor0
> + *
> + * (you need to mount configfs to /config first)

Most distros seem to be using /sys/kernel/config as the mount point for this...


> + * Then you can measure distance with:
> + *
> + *cat /sys/devices/trigger0/measure

What are the units of the returned value? Inches? Hundredths of an inch?
inches.hundredths?   Other?

(Yes, I looked at the datasheet.. and your driver source is more helpful
than the sheed :)


> + struct gpio_desc *echo_desc;
> + /* Used to measure length of ECHO signal */

I was going to say "comments on same line", but that would result in *long*
lines, this is better


> +static int do_measurement(struct hc_sr04 *device,
> +   long long *usecs_elapsed)
> +{
(...)
> + if (!mutex_trylock(>measurement_mutex))
> + return -EBUSY;

OK... this is a potential problem, because...

> + irq = gpiod_to_irq(device->echo_desc);
> + if (irq < 0)
> + return -EIO;

Here you do a 'return' without unlocking.  This should probably be:

 if (irq < 0) {
ret = -EIO;
goto out_mutex;
}

I admit not knowing the GPIO or IIO stuff well enough to comment on those
details, but I didn't see anything obviously insane either

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


Re: How to enable IIO driver in 3.18 kernel

2016-05-31 Thread Valdis . Kletnieks
On Wed, 01 Jun 2016 08:19:20 +0530, Munagala Naresh said:

> We are integrating one sensor driver in to LE platform. After adding sensor
> driver, it is creating device @ /sys/bus/iio/devices/iio:device0,1,2.

> Sensor driver makes use of IIO subsystem framework. We are not seeing iio
> device creation @ */dev/iio:device0*,1,2

The kernel is creating your device in /sys.  You need to either get udev 
knowing what
to do to mknod the /dev entry,  or check if your kernel config has:

CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

so the kernel takes care of it for you.


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


Re: How to enable IIO driver in 3.18 kernel

2016-05-31 Thread Valdis . Kletnieks
On Wed, 01 Jun 2016 12:18:55 +0800, "FrankYu" said:
> How can I read the content?

I admit confusion.  The content of what?  And read it from where? Userspace?

int fd = open ("/dev/iio:whatever",yadda yadda);
int rc = read(fd, , sizeof(buffer);

Same as reading any other device.

If you mean something else, you'll have to explain..



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


Re: How to enable IIO driver in 3.18 kernel

2016-06-01 Thread Valdis . Kletnieks
On Wed, 01 Jun 2016 13:58:20 +0800, you said:
> Sorry, I mean the mail's content 
> I can not read the mail, there's only a *.bin file attached 

You have a defective mail reader, which is unable to recognize
a digital signature.  There's been an Internet standard for that
since 1995, so there's *really* no excuse.

1847 Security Multiparts for MIME: Multipart/Signed and
 Multipart/Encrypted. J. Galvin, S. Murphy, S. Crocker, N. Freed.
 October 1995. (Format: TXT=23679 bytes) (Status: PROPOSED STANDARD)
 (DOI: 10.17487/RFC1847)

Even if your mail reader doesn't understand how to verify a PGP
digital signature, it should at *least* tell you "This was a text
mail with a digital signature I can't handle".

It's 2016.  Even Outlook figured out how to do this a decade ago.
Complain to whoever did your mail software.

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


Re: Backtrace of every the threads

2016-02-10 Thread Valdis . Kletnieks
On Wed, 10 Feb 2016 11:56:40 +0100, Ricardo Ribalda Delgado said:
> I did not explain myself well.
>
> By thread I mean kernel thread, and user thread.
>
> What i want to get is a back trace of ALL the programs running in user
> and kernel space.

See what happens when you do 'echo t > /proc/sysrq-trigger'.

Note that you probably *don't* actually want a trace of *all* tasks (hint -
what happens on a large system that has 2,000 cores on it)?

What problem are you trying to solve by getting a trace of everything? (Hint -
what meaning does a userspace stack traceback have if you're looking at
the corresponding kernel stack trace?)


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


Re: user rsyslog/syslog

2016-02-24 Thread Valdis . Kletnieks
On Wed, 24 Feb 2016 14:20:23 +0200, Ran Shalit said:

> Maybe the last suggestion will be the most practical if this issue
> can't be resolved, which means that I will use one file for all logs,
> in which each line will have its own tag string according to the
> application.

No, what you do is you use an rsyslog filter on the program name,
and use that to route each program's logs to a different file.


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


Re: user rsyslog/syslog

2016-02-24 Thread Valdis . Kletnieks
On Wed, 24 Feb 2016 09:36:54 +0200, Ran Shalit said:

> I am trying to write to rsyslog from application.
> With openlog(..., LOG_USER), it works fine and I find the log in
> /var/log/user.log (it is defines in /etc/rsyslog.d/50-defaults.conf )
> But we need to enable different applications to have each its own log file.
> I tried to use LOG_LOCAL0 instead and configured it in
> /etc/rsyslog.d/50-defaults.conf the same way as user:
>
> local0.* action
> {
>   type="omfile"
>  FILE="/var/log/local0.log"
>  FileOwner="root"
>  FileGroup="adm"
>
> }
>
> I then did
> 1. /etc/init.d/rsyslog stop
> 2. /etc/init.d/rsyslog start
> I see no warnings or errors, and I started the application trying to
> write to LOG_LOCAL0, But there is no new file created, no logs.
>
> Is there any idea whatws wrong, or how I can achieve this multi user's logs ?

Not really a kernel issue, is it?  But anyhow

First thing to do is to make sure your code checks the return code
from openlog().

The next thing to check is that your application is actually trying to
log to LOCAL0.  Using the debugging tool of your choice, ensure that control
flow reaches the syslog() statement. Make sure that it's using LOCAL0.

Define an action for *.* dumping to /var/log/everything.log - does your
message show up in there?

In other words, all the usual userspace debugging.. start at the beginning
and trace through the flow.

And since rsyslog allows regex matching, maybe you should be letting all the
applications continue logging to LOG_USER, and then use filters
of the form 'programname startswith app1', 'programname startswith app2',
and so on to select based on the program name.



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


Re: [PATCH] staging: dgnc: Remove useless and deadly judgment

2016-02-28 Thread Valdis . Kletnieks
On Mon, 29 Feb 2016 14:41:34 +0800, Navy Cheng said:
> pci_unregister_driver() should be used once dgnc module exit. It has
> nothing to do with dgnc_NumBoards. Remove the judgment of dgnc_NumBoards to
> avoid pci_unregister_driver() is not used when dgnc_NumBoards is 0.

> - if (dgnc_NumBoards)
> - pci_unregister_driver(_driver);
> + pci_unregister_driver(_driver);

Does pci_unregister_driver do the right thing if there are 0 boards
in the system?

If this logic is wrong, shouldn't there also be a patch fixing the
following in dgnc_init_module()?

/*
 * Find and configure all the cards
 */
rc = pci_register_driver(_driver);

/*
 * If something went wrong in the scan, bail out of driver.
 */
if (rc < 0) {
/* Only unregister if it was actually registered. */
if (dgnc_NumBoards)
pci_unregister_driver(_driver);
else
pr_warn("WARNING: dgnc driver load failed.  No Digi Neo 
or Classic boards found.\n");

dgnc_cleanup_module();

While I'm at it, the entire NumBoards counting seems to be wonky - it looks
like a *lot* of off-by-one errors.  Looks like the programmer(s) weren't sure
if they wanted to use that as a zero-based or one-based counter/index.



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


Re: Question : How to access to bandwith statistics from kernel space?

2016-02-29 Thread Valdis . Kletnieks
On Mon, 29 Feb 2016 11:47:16 +0100, Martin Houry said:
> I have made some research and I could't find a library  who can give
> me interfaces's statistics like max/min/average bandwidth, jitter, ...
>
> Do you know a way to do this?

What problem are you trying to solve from within the kernel with those
statistics?

You probably should look at how the various TCP congestion routines work.


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


Test e-mail, please ignore...

2016-02-23 Thread Valdis Kletnieks
For some reason, I'm not seeing posts I send to the list.
(Has somebody changed the list config, or is there something more
subtle going on?)

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


Re: CFS: Scheduler: How does each change in 'nice' value result in 10% change in CPU time?

2016-01-21 Thread Valdis . Kletnieks
On Thu, 21 Jan 2016 08:51:08 -0800, John Locke said:

>  * Nice levels are multiplicative, with a gentle 10% change for every
>  * nice level changed. I.e. when a CPU-bound task goes from nice 0 to
>  * nice 1, it will get ~10% less CPU time than another CPU-bound task

Note the ~ indicating approximately.

> If I take an example of 2 tasks both with weight=1024 (NICE_0) they
> should each get 50% of the CPU time. If 1 of the tasks is reniced to
> NICE_1 then the NICE_0 task will get 1024/(1024+820)=56% of the CPU
> time and  the NICE_1 task will get 44% of the CPU time.

12% difference - that's around 10%.



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


Re: Finding when a chip was supported in the kernel

2016-02-15 Thread Valdis . Kletnieks
On Mon, 15 Feb 2016 16:06:54 +, Rob Groner said:

> > bjorn@nemi:/usr/local/src/git/linux$ git show 4662e82b2cb41
> > commit 4662e82b2cb41c60826e50474dd86dd5c6372b0c
> > Author: Bruce Allan 
> > Date:   Tue Aug 26 18:37:06 2008 -0700


> Using the blame I see that it gives a date and a commit reference.  How do I 
> then correlate that to the kernel version where it first showed up?  I'm
> assuming there's a git command for showing that.

git tag --contains 4662e82b2cb41

should do the job for you.

Note:  They're sorted lexically, not in release order - so v3.21 through v3.29
are hiding between v3.2 and v3.3,


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


Re: Distributed Process Scheduling Algorithm

2016-02-15 Thread Valdis . Kletnieks
On Tue, 16 Feb 2016 10:18:26 +0530, Nitin Varyani said:

> 1) Sending process context via network

Note that this is a non-trivial issue by itself.  At a *minimum*,
you'll need all the checkpoint-restart code.  Plus, if the process
has any open TCP connections, *those* have to be migrated without
causing a security problem.  Good luck on figuring out how to properly
route packets in this case - consider 4 nodes 10.0.0.1 through 10.0.0.4,
you migrate a process from 10.0.0.1 to 10.0.0.3,  How do you make sure
*that process*'s packets go to 0.3 while all other packets still go to
0.1.  Also, consider the impact this may have on iptables, if there is
a state=RELATED,CONNECTED on 0.1 - that info needs to be relayed to 0.3
as well.

For bonus points, what's the most efficient way to transfer a large
process image (say 500M, or even a bloated Firefox at 3.5G), without
causing timeouts while copying the image?

I hope your research project is *really* well funded - you're going
to need a *lot* of people (Hint - find out how many people work on
VMWare - that should give you a rough idea)


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


Re: Distributed Process Scheduling Algorithm

2016-02-16 Thread Valdis . Kletnieks
On Tue, 16 Feb 2016 09:42:52 +0100, Dominik Dingel said:

> I wouldn't see things that dark. Also this is an interesting puzzle.

Just pointing out *very real* issues that will require solution, unless
you add strict bounds like "cannot be using network connections".

Heck, even open files get interesting.  How do you ensure that the
file descriptor returned by mkstemp() remains valid? (The *really*
ugly case is programs that do a mkstemp() and then unlink() the result,
confident that the kernel will clean up when the process exits, as
there is no longer a file system object to reference

Of course, if you say "no network connections" and "no open files",
the problem gets a lot easier - but also quickly devolving into a
master's thesis research project rather than anything useful

Bottom line:  Don't even *think* about changing the scheduler etc
until you have a functional way to actually move the process.  Doesn't
matter if you use a kvm approach, or containers, or whatever - if
you can't do the migrate, you can't even *test* your code that decides
which process to migrate.


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


Re: Distributed Process Scheduling Algorithm

2016-02-16 Thread Valdis . Kletnieks
On Wed, 17 Feb 2016 10:21:35 +0530, Nitin Varyani said:

> Actually it is a master's thesis research project as of now. I am ready to
> boil down to the most basic implementation of distributed linux kernel.
> Assume there is no network connection and no open files. We can drop even
> more assumptions if it becomes complicated. Once this basic implementation
> is successful, we can go ahead with a more complicated version. The next
> task is to integrate the migration code in the linux kernel. What is the
> most easy way of implementing it.

If you get it to where you can migrate a process on command controlled by
a userspace process, the scheduler part will be trivial.

And note that the choice of which process to migrate where is sufficiently
"policy" that it belongs in userspace - see how cgroups and containers are
kernel mechanisms that are controlled by userspace.  You want to follow that
model if you intend for this to be upstreamed rather than just another dead
master's thesis.


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


Re: Patch Series

2016-02-16 Thread Valdis . Kletnieks

>>> My question is, is it OK to fix all occurrences of error A across the files
>> inside drivers/staging/wilc1000 as one patch and all occurrences of error B
>> across all files inside drivers/staging/wilc1000 as a second patch?

Most maintainers would be perfectly OK with that.  And I'm pretty sure
that Greg KH (maintainer of drivers/staging) would accept that sort of
patch series.  If he isn't, I'm sure he'll correct me. :)


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


Re: can't read this

2016-02-21 Thread Valdis . Kletnieks
On Sun, 21 Feb 2016 17:34:38 -0500, Ruben Safir said:
> > ASCII?

No.

> Content-Type: text/plain; charset=GBK
> Content-Transfer-Encoding: base64

It claims to be some mostly-nonstandard variety of Chinese.

https://en.wikipedia.org/wiki/GBK


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


Re: Backtrace of every the threads

2016-02-11 Thread Valdis . Kletnieks
On Thu, 11 Feb 2016 14:56:32 +0100, Ricardo Ribalda Delgado said:

> > What problem are you trying to solve by getting a trace of everything? 
> > (Hint -
> > what meaning does a userspace stack traceback have if you're looking at
> > the corresponding kernel stack trace?)
>
> I was doing:
>
> cat /dev/video0
>
> And the open()  syscall sometimes was stalling.
>
> I wanted to know at what place open() syscall was waiting...

You can find *that* out by doing  a 'cat /proc//stack' for  == process 
id.

No need to find *all* the stack traces for that. :)


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


Re: creating initramfs in fedora

2016-03-11 Thread Valdis . Kletnieks
On Fri, 11 Mar 2016 18:32:39 +0530, Ronit Halder said:

> How can I create a initramfs file without dracut from the files in an
> installed system in fedora?

If you're hell-bent on doing something unsupported, remember that dracut
is just an easily understood python script, so you can just follow along
and do just the parts your use case needs.

But before going to that length, check whether you can use already-existing
dracut options to get what you want.  For instance, I use this for initramfs
on my laptop:

/usr/bin/dracut --xz -f -H --no-kernel -o "busybox qemu btrfs resume 
kernel-modules dmraid multipath" /boot/initramfs-${rel}.img ${rel}

which means ".xz compress it, overwrite the .img if needed, only build in
support for this laptop, don't include kernel modules (all the ones needed
to get the rootfs mounted are =y in the config), leave out support for
dracut modules I listed".

And that's only the start of what you can do to customize what it does.


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


Re: blackscreen on boot with first compiled kernel

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 06:09:13 -, Hrushit Parikh said:

> The linux kernel of my repo is 4.5.0-rc+. I copied the existing .config file
> from /boot to my source tree and ran 1. make olddefconfig, 2. make 3. make
> modules_install install.

You probably wanted to use 'make oldconfig' rather than 'olddefconfig'.

To improve your build time a lot, try this:

1) copy that .config over.
2) Insert all your USB and other pluggable devices at least once, so they
get their drivers modprobed'd.
3) Use 'make localmodconfig' - this will only make modules for devices you
actually have (maybe 200) rather than the 4,000 or so a distro kernel builds.

Proceed with your steps 2 and 3.



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


Re: variant length array?

2016-04-05 Thread Valdis . Kletnieks
On Tue, 05 Apr 2016 15:29:25 -0400, Wenda Ni said:

> I come across the following code in a kernel module code.

> u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)

Is this an out-of-tree module, or an older kernel?

The current linux-next tree has zero occurences of 'rxe_icrc_hdr'
or 'rxe_pkt_info' in it.




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


Re: Attach my own pid

2016-03-21 Thread Valdis . Kletnieks
On Mon, 21 Mar 2016 10:33:44 +0530, Nitin Varyani said:

> Sub-task 1: Until now, parent process cannot control the pid of the forked
> child. A pid gets assigned as a sequential number by the kernel at the time
> the process is forked . I want to modify kernel in such a way that parent
> process can control the pid of the forked child.

What does controlling the pid gain you?  To what purpose?

> Sub-task 2: On Linux, you can find the maximum PID value for your system
> with the following command:
>
> $ cat /proc/sys/kernel/pid_max
>
> Suppose pid_max=2000 for a system. I want that the parent process should be
> able to assign a pid which is greater that 2000 to the forked child.

Again, why would you want to do that?

Anyhow...

echo 3000 > /proc/sys/kernel/pid_max
fork a process that gets a pid over 2000.

Done.

Note that on 32 bit systems, using a pid_max of over 32768 will cause
various things in /proc to blow up.

I suspect that you need to think harder about what problem you're actually
trying to solve here - what will you do with a controlled child PID? Why does
it even matter?


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


Re: 回复:Re: add_disk() make my driver's initialisation, thus kernel stall.

2016-03-20 Thread Valdis . Kletnieks
On Mon, 21 Mar 2016 09:53:47 +0800, 张云 said:
> The code is just for learning block driver

THe kernel doesn't know that.  You call a routine with the wrong
parameters, it will not work properly.


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


Re: Attach my own pid

2016-03-22 Thread Valdis . Kletnieks
On Mon, 21 Mar 2016 16:01:41 +0530, Nitin Varyani said:

> I am running a master user-level process at Computer 1 which sends a
> process context like code, data, registers, PC, etc as well as *"pid"* to
> slave processes running at other computers. The responsibility of the slave
> process is to fork a new process on order of master process and attach *"pid"
> *given by the master to the new process it has forked. Any system call on
> slave nodes will have an initial check of " Whether the process belongs to
> local node or to the master node?". That is, if kernel at Computer 2 pid of
> the process is 1500

None of that requires actually controlling the PID of the child.

Consider this code:


int child_pid[5], j;
pid_t child;

for (j=0;j<5;j++) {
child =  fork();
if (child == 0)
go_init_worker_process();
else
child_pid[j] = child;
}

Now you have 5 children, and know what process IDs they are, without
having to do any kernel hacking at all.  This has been a long-understood
idiom in the Unix/Linux world - I remember first seeing it on SunOS 3.2 back
in 1985 or so...


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


Re: kernel_thread() causes segfault

2016-03-22 Thread Valdis . Kletnieks
On Tue, 22 Mar 2016 16:51:44 +0530, Shashank Khasare said:

> These two threads share same address space, file descriptor tables, parent
> pid etc.
> Whenever user thread wants to make syscall, it would post the information
> about syscall number & arguments
> to syscall in common shared page. User thread would then wait till the
> results are posted on shared page.
> The kernel thread reads the syscall arguments from shared page and writes
> the results to shared page.
> User thread consumes the results and continues execution.
> Since the kernel thread and user thread can be scheduled on different cpu
> cores, and user thread is ideally never executing
> kernel code and vice versa, one can expect gain in instruction per cycle
> for application, since the cache pollution is reduced to
> some extent*.*

However, you're almost certainly going to lose those gained cycles in
the latency waiting for the kernel side to notice a newly posted syscall
(what are you going to do, poll?  How well does that work if you have
several hundred or thousands of processes running?) - and then you have
to have userspace wake up properly (hint - *it* can't spin and poll, because
if it's running, kernelspace can't be running to service its request).

Also, if the kernel and user threads are on different cores, you have the
potential of cache line ping-ponging

There's a *reason* why a lot of academic papers don't make it into
production code


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


Re: contribution in kernel community & testing kernel

2016-03-23 Thread Valdis . Kletnieks
On Wed, 23 Mar 2016 16:06:37 +0530, shubham k said:

> I want to work on x86 architecture. I am not sure how to go about unit
> testing. I can use qemu for testing but i find kernel on x86 architecture
> too big to compile. How i can get the smaller size kernel on x86
> architecture?

'make localmodconfig' is your friend.  Just make sure you plug in all your
USB devices at least once after rebooting, but before running it, so their
modules will be probed - localmodconfig parses (among other things) the
output of lsmod.


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


Re: Attach my own pid

2016-03-20 Thread Valdis . Kletnieks
On Sun, 20 Mar 2016 02:07:29 -0700, Nitin Varyani said:

>  The linux kernel attaches a pid to newly forked process. I want to
> create a facility by which a process has the option of attaching a new pid
> to its child which is not in the pid space.

Not at all sure what you mean by "not in the pid space", or what you're
trying to achieve by doing it.

But "pid namespaces" may be what you're looking for.


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


Re: Adding new protocol to linux.

2016-03-26 Thread Valdis . Kletnieks
On Fri, 25 Mar 2016 23:00:48 -0300, "Daniel." said:
> Hi everybody,
>
> I'm planing to write a socket API for Nordic's nRF24L01+ and I was
> digging on socket code and find all supported protocols at
> include/linux/socket.h with all that #define AF_x y. So my questions
> are:
>
> 1) Is it possible to write a new protocol for linux with an out of
> tree module without modifing socket.h file?

Rami Rosen gave a good outline of what's needed.  But the *first* question
you should ask is why a hardware device needs its own socket API rather than
re-using an existing one.  Basically, if it's an intelligent enough device
or SOC, you should be able to get it to talk at least UDP or something. And
if it's not that smart, maybe you shouldn't be trying to use sockets to talk to
it.

So what are the reasons you're doing a new socket API instead of using the
existing stuff?


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


Re: add_disk() make my driver's initialisation, thus kernel stall.

2016-03-20 Thread Valdis . Kletnieks
On Sun, 20 Mar 2016 16:38:12 +0800, 张云 said:

> My memory disk block driver was compiled successfully.
> But when I insmod my module, initialisation stall at add_disk  in =
> setup_dev function.

> int major = 0;

Are you positive that this is both safe and usable?


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


Re: What is the role of LIST_POISON1 and LIST_POISON2?

2016-03-03 Thread Valdis . Kletnieks
On Fri, 04 Mar 2016 13:02:02 +0800, Navy Cheng said:
> Hi,
>
> When I read the code of list_del(), I find LIST_POISON1 and LIST_POISON2:
>
> static inline void list_del(struct list_head *entry)
> {
>   __list_del(entry->prev, entry->next);
>   entry->next = LIST_POISON1;
>   entry->prev = LIST_POISON2;
> }
>
> Why not set entry->next and entry->prev to NULL ?

To more easily detect different classes of list corruption, use-after-free, and
other programming errors.  If ->next and ->prev are NULL, it may be the result
of following a bad pointer.  If  they're equal to POISON 1 and 2, you're almost
certainly looking at a once-valid pointer that is a use-after-free situation.
It's easy to end up pointing at a zeroed page.  The chances of pointing at
some random data that happens to be POISON 1/2 is much lower.

See the code in lib/list_debug.c



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


Re: Driver duplicate?

2016-03-07 Thread Valdis . Kletnieks
On Mon, 07 Mar 2016 16:08:01 -0500, Kenneth Adam Miller said:

> Can't release it. It looks a lot like this though:

Note that you're going to have a *really* hard time shipping hardware
with a legal Linux driver you can't release source for.  You probably
want to talk to your corporate legal eagles and explain the GPL to them,
before somebody *else's* legal eagle explains the GPL to them, in the form
of a injunction.

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


Re: stack pointer

2016-03-07 Thread Valdis . Kletnieks
On Mon, 07 Mar 2016 13:07:14 +0530, Nitin Varyani said:

> Where is the stack pointer for the current process stored in linux?

In the stack pointer register, of course. (And if the code was compiled
with -fomit-stack-pointer there isn't even one. :)

The fun and games starts when you talk about the stack for a process that
*isn't* currently active on a CPU


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


Re: Possible Bug

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 10:04:47 -0230, Roger H Newell said:

> I think I may have stumbled upon a USB bug. Before I send it off to

Looks like an apparmor bug, not USB. Quite likely the same problem as these
guys hit, as the traceback is the same:

http://askubuntu.com/questions/748119/ubuntu-15-10-hangs-after-suspend-resume-inspiron-7559
https://github.com/IRATI/stack/issues/470
(And other hits)

Seems to be a long-standing issue, that second link is from Feb 2015. On
the other hand, all the hits appear to be in mailing lists *other* than
ones where apparmor guys were likely to see it.

I'm adding a cc: to the apparmor guys.

> I was having a problem mounting up a USB drive, so I had a look at
> dmesg. The output is as follows. I'm running 4.5.0+ from gregs
> staging-testing tree.
>
> [952620.256859] usb 1-6: new high-speed USB device number 4 using ehci-pci
> [952620.389797] usb 1-6: New USB device found, idVendor=0781, idProduct=5530
> [952620.389807] usb 1-6: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=3
> [952620.389813] usb 1-6: Product: Cruzer
> [952620.389818] usb 1-6: Manufacturer: SanDisk
> [952620.389823] usb 1-6: SerialNumber: 20060876510A09733592
> [952620.397158] BUG: unable to handle kernel NULL pointer dereference at 
> 0805
> [952620.397309] IP: [] kmem_cache_alloc_trace+0x7b/0x1e0
> [952620.397427] PGD 3db56067 PUD cb6cd067 PMD 0
> [952620.397511] Oops:  [#1] SMP
> [952620.397573] Modules linked in: binfmt_misc snd_hda_codec_realtek
> snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_hda_codec
> snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event
> snd_rawmidi snd_seq snd_seq_device snd_timer edac_mce_amd snd joydev
> kvm_amd input_leds edac_core kvm soundcore serio_raw k10temp i2c_piix4
> 8250_fintek asus_atk0110 mac_hid irqbypass parport_pc ppdev lp parport
> autofs4 pata_acpi hid_generic usbhid hid amdkfd amd_iommu_v2 radeon
> i2c_algo_bit ttm drm_kms_helper syscopyarea sysfillrect sysimgblt
> fb_sys_fops drm psmouse ahci pata_atiixp libahci r8169 mii wmi
> [952620.398620] CPU: 1 PID: 18445 Comm: mtp-probe Not tainted 4.5.0+ #28
> [952620.398726] Hardware name: System manufacturer System Product 
> Name/M5A78L-M LX PLUS, BIOS 040209/20/2011
> [952620.398884] task: 88009bf68d00 ti: 8800499f task.ti: 
> 8800499f
> [952620.399006] RIP: 0010:[]  [] 
> kmem_cache_alloc_trace+0x7b/0x1e0
> [952620.399158] RSP: 0018:8800499f3c70  EFLAGS: 00010206
> [952620.399246] RAX:  RBX: 024080c0 RCX: 
> 0ae98088
> [952620.399362] RDX: 0ae98087 RSI: 024080c0 RDI: 
> 00019b20
> [952620.399477] RBP: 8800499f3cb0 R08: 88012fc59b20 R09: 
> 88012b003cc0
> [952620.399593] R10: 0805 R11: fefefefefefefeff R12: 
> 024080c0
> [952620.399709] R13: 813736d3 R14: 7f9bfa435040 R15: 
> 88012b003cc0
> [952620.399826] FS:  7f550c9a48c0() GS:88012fc4() 
> knlGS:
> [952620.399956] CS:  0010 DS:  ES:  CR0: 80050033
> [952620.400050] CR2: 0805 CR3: ce839000 CR4: 
> 06e0
> [952620.400165] Stack:
> [952620.400201]  024080c0 8120bb2c 0002 
> 88000227d500
> [952620.400335]  88000227d500 8800499f3ef4 7f9bfa435040 
> 8800499f3de0
> [952620.400467]  8800499f3cc8 813736d3 81c9fe80 
> 8800499f3ce8
> [952620.400599] Call Trace:
> [952620.400649]  [] ? get_empty_filp+0x5c/0x1c0
> [952620.400748]  [] apparmor_file_alloc_security+0x23/0x40
> [952620.400861]  [] security_file_alloc+0x33/0x50
> [952620.400961]  [] get_empty_filp+0x9a/0x1c0
> [952620.401057]  [] path_openat+0x2e/0x1400
> [952620.401149]  [] ? walk_component+0x3a/0x470
> [952620.401246]  [] ? path_init+0x1d9/0x330
> [952620.401339]  [] ? __inc_zone_page_state+0x35/0x40
> [952620.401444]  [] ? putname+0x54/0x60
> [952620.401530]  [] do_filp_open+0x7e/0xe0
> [952620.401620]  [] ? kmem_cache_alloc_trace+0x1c5/0x1e0
> [952620.401728]  [] ? kmem_cache_alloc+0x17a/0x1d0
> [952620.401829]  [] ? getname_flags+0x56/0x1f0
> [952620.401924]  [] ? __alloc_fd+0x46/0x190
> [952620.402016]  [] do_sys_open+0x124/0x210
> [952620.402107]  [] ? SyS_access+0x1e8/0x230
> [952620.402200]  [] SyS_open+0x1e/0x20
> [952620.402286]  [] entry_SYSCALL_64_fastpath+0x1e/0xa8
> [952620.402391] Code: 08 65 4c 03 05 3f 3e e2 7e 49 83 78 10 00 4d 8b 10 0f 
> 84 14 01 00 00 4d 85 d2 0f 84 0b 01 00 00 49 63 41 20 48 8d 4a 01 49 8b 39 
> <49> 8b 1c 02 4c 89 d0 65 48 0f c7 0f 0f 94 c0 84 c0 74 bb 49 63
> [952620.402934] RIP  [] kmem_cache_alloc_trace+0x7b/0x1e0
> [952620.403047]  RSP 
> [952620.403106] CR2: 0805
> [952620.445606] ---[ end trace e7adb7015192b3a3 ]---



pgpbVCsq_vX0I.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org

Re: Possible Bug

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 13:55:57 -0230, nick said:

> >>> In the fs/file_table.c file as from the root directory of your kernel 
> >>> tree change in the function,
> >>> get_empty_flip change these lines:
> >>>  if (unlikely(error)) {
> >>>  file_free(f);
> >>>  return ERR_PTR(error);
> >>>  }
> >>> to:
> >>> if (unlikely(error))
> >>> return ERR_PTR(error);
> >>> and tell me if that fixes your issue.
> >>> Nick

This is an incorrect fix, as the crash happens in security_file_alloc() -
before it ever even *reaches* the if statement.

In addition, you just leaked a reference on f->f_cred by
bypassing the put_cred() that file_free() calls.

If this happens to work, it's by accident, and is merely papering over
a more serious problem.

Spotting the reference leak is (or should have been) a 3 or 5 minute task -
look at the code, see there's a get_FOO() call, and ask where the matching
put_FOO() is. There's a get_cred() you need to have hit to get here - so
*somebody* needs to do a put_cred(). And then looking at the body of
file_free() *should* have shown you that your proposed fix is incredibly
incorrect.

Seriously Nick - please stop this. You're detracting from valuable developer
resources by submitting these incorrect fixes.



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


Re: Possible Bug

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 09:30:01 -0700, John Johansen said:

> hrmm, the only thing apparmor is doing in this kernel here is a kzalloc and
> assigning it to f_security, expanding out the aa_alloc_file_context
> abstraction (which should probably just be dropped) we get.
>
>   file->f_security =  kzalloc(sizeof(struct aa_file_cxt), GFP_KERNEL);
>   if (!file->f_security)
>   return -ENOMEM;
>   return 0;
>
> So unless we are getting a NULL for the file I don't see how apparmor can be
> causing the NULL pointer dereference

Now here's the odd part - just before that, we have:

f->f_cred = get_cred(cred);
error = security_file_alloc(f);

so if f-> was NULL, we should have exploded just *before* the 
security_file_alloc()
call.

>> [952620.397309] IP: [] kmem_cache_alloc_trace+0x7b/0x1e0

Aha.  Smoking gun - I should have spotted this before.  f-> isn't the null
pointer - it's exploding trying to alloc a slab.  You're right, John - it looks
like somebody did the fandango all over the memory allocator.

Roger - can you find out if this kernel was using SLAB, SLOB, or SLUB as
the allocator?  And is KASAN enabled or not? (I see a kasan_kmalloc() lurking
in slab.h)



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


Re: Possible Bug

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 14:59:51 -0230, Roger H Newell said:

> I reverted the previous change, and applied the if(f) test in
> file_free. There are no error messages in dmseg and I can mount the
> USB device.

That's because Nick's patch is *still* wrong, as the *real* problem
appears to be a memory corruption issue elsewhere.  You don't see it
every mount because it only explodes if a new slab needs to be allocated
after the memory corruption has happened.


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


Re: Possible Bug

2016-03-31 Thread Valdis . Kletnieks
On Thu, 31 Mar 2016 15:46:51 -0230, Roger H Newell said:

> I had a look inside the .config I used to compile this kernel.
> I think I found the information you're looking for.
>
> # CONFIG_KASAN is not set
> # CONFIG_SLAB is not set
> CONFIG_SLUB=y
> # CONFIG_SLOB is not set

Well, that cuts down on the amount of code that needs to be stared at.

I don't suppose we get extra-ordinarily lucky and the system was set up to
do crash dumps, was it?

I've spent a few more minutes looking at the relevant code, and the more I
stare at it, the more I understand why we see the same stack trace in varied
forums going back over a year - it looks like it only craps out if something
during resume or hotplug or similar processing stomps on memory, and the next
call to apparmor_file_alloc_security() has to allocate a new slab.

Or more correctly, it only dies with *this* traceback under those conditions.
If something else is next up to allocate a slab, it gets a different traceback.




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


Re: unable to find function definition

2016-04-26 Thread Valdis . Kletnieks
On Tue, 26 Apr 2016 15:31:51 +0200, Silvan Jegen said:

> A simple but naive approach would be a grep command like this.
>
> grep "function_pointer =" `find . -iname '*.c' -o -iname '*.h'`

Two better ways:

grep -r "function_pointer =' [A-Za-z]*

find * -name '*.[ch]' | xargs grep 'function pointer ='

Hint 1:  Globbing * rather than . is a win at the top level of the
kernel source, because * won't match .git, which is a gigabyte or so
of stuff that you don't want to grep through

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

And another winner if you have a git tree (which of course you should):

git grep 'function_pointer ='

One gotcha is that in some places, the kernel does evil pre-processor
stuff like:

#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
#define ATOMIC_LONG_PFX(x)  atomic ## x

#endif

#define ATOMIC_LONG_READ_OP(mo) static 
inline long atomic_long_read##mo(const atomic_long_t *l) {  
 
ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l;  
return 
(long)ATOMIC_LONG_PFX(_read##mo)(v); }
ATOMIC_LONG_READ_OP()
ATOMIC_LONG_READ_OP(_acquire)

(this example from include/asm-generic/atomic-long.h, but similar ## abuse
happens elsewhere as well...)


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


Re: How to fast master kernel

2016-05-10 Thread Valdis . Kletnieks
On Tue, 10 May 2016 16:58:26 -0400, "Robert P. J. Day" said:

>   not sure who it was (maybe even valdis) who once said, "Saying you
> want to get into kernel programming but have no idea where to start so
> can someone give you suggestions is like saying you want to write a
> book but don't know what to write about so can someone give you any
> ideas."

Yeah, that was me...

I'm also the one who said that we're approaching the point where the number
of people who are actually qualified to do serious hacking on the kernel
innards (like the scheduler, vfs, etc, not just a driver) is on the
same order of magnitude as the number of people qualified to be Formula-1
race car mechanics


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


Re: How to fast master kernel

2016-05-11 Thread Valdis . Kletnieks
On Wed, 11 May 2016 12:26:17 +0800, "Aric" said:

> But for each board, it have dedicated kernel code package. For example, what
> I want to do first, it I can write kernel drivers and kernel code freely. I 
> can
> easily add a I2C (AT24C02) device and finished its driver in a short time.

Wel, that's only actually helpful for the kernel if somebody's already
done the port to that board (which it seems they have, since it already
has a kernel package), and failed to add an I2C driver already.

The other thing that you could do that would benefit the kernel is to take
the vendor's code (which is probably some ancient creeping horror like 3.4
or even a 2.6.something), and get the drivers up to 4.6 level and get them
upstreamed.

Greg KH is almost certainly reading this, and he *loves* helping get
drivers into the main kernel :)

Greg, meet Aric.  Aric, meet Greg.  :)


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


Re: can anyone tell me which function to call to pause the kernel

2016-05-17 Thread Valdis . Kletnieks
On Tue, 17 May 2016 20:29:12 +0800, walkerlala said:

> Can I just disable interrupts from hardwares? I know that, at the very
> beginning, the kernel disable interrupt for convenient. So I wonder
> whether we can do thing like this.

Sure you can do that.

But then, how do you get the kernel's attention?

>
> Put it in another way:
>   when we "interact" with a Linux Desktop, there are also many programs
> running underneath as daemons, but we can still do our own works without
> even noting their existing. So I wonder, is there a similar way that we
> can use to interact with the kernel (without using a debugger) ?

Try this:

Start up Xorg and your preferred window manager.

Open an xterm or a Gnome-terminal or whatever.

>From that window, try to attach gdb to the Xorg process:

%  ps ax|grep Xorg
  1791 tty2 S+69:42 /usr/libexec/Xorg vt2 -displayfd 3 -auth 
/run/user/967/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty 
-verbose 3
 62036 pts/0S+ 0:00 grep Xorg
% gdb -p 1791

What happens?

Why does it happen?

Eventually, you'll figure out what Xorg and the kernel have in common here


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


Re: Kernel memory

2016-05-17 Thread Valdis . Kletnieks
On Tue, 17 May 2016 12:41:44 +0530, Ronit Halder said:
> Hi,
>
> Where in the memory kernel is located in the boot time?

During which exact phase of the boot, and does it actually matter?  And
physical or virtual address?

(Hint:  If you're not the bootstrap that unpacks the compressed kernel
into memory, or the code that sets up the ASLR code, or are trying to work
around an issue with a hardware device that insists on taking certain
physical addresses for itself, you probably don't really care where the
kernel is)


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


Re: How to locally maintain an end-of-life kernel branch?

2016-05-17 Thread Valdis . Kletnieks
On Tue, 17 May 2016 13:09:03 -0700, Michael Harless said:

> > Eeek, why?  What is keeping you from moving to a newer kernel version?
> > Why is sticking with 3.14 a good idea for anyone?
> >
>
> It's mainly due to certifications and testing and our upgrade process.  My
> wish would be to update to a new kernel as well.

That's a very broken certification system, if it allows you to attach
pretty much random patches onto a "blessed" 3.14 kernel, but won't let
you upgrade to a newer kernel

Thought Experiment:  What happens if you take a standard 3.14 kernel, and apply
*every single* patch from 3.15 from Linus's tree except the one that actually
tags it as 3.15?

(And yes, I've had systems running stuff certified for RHEL 6.1, but the
system was actually updated all the way to 6.7 except for the RPM that
has /etc/redhat-release )



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


Re: How to contact to Greg.

2016-05-13 Thread Valdis . Kletnieks
On Fri, 13 May 2016 10:34:13 +0200, Greg KH said:
> On Thu, May 12, 2016 at 07:14:42PM +0800, Aric wrote:
> > Yeah, that sounds good. Who know Greg's e-mail,or where to find him?
>
> http://lmgtfy.com/?q=greg+kh+email+address

I see what you did there. :)



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


Re: How to initialize the new attributes in process control block.

2016-05-16 Thread Valdis . Kletnieks
On Mon, 16 May 2016 10:44:56 +0200, Youcun Liu said:

>u64 cache_miss_rate;   // the new variable I insert

> Besides, I also have trouble in finding out how to feed data into the new
> variable from user level application.

Three comments:

1) cache_miss_rate is probably a poor thing to fold into scheduling, because
it depends a large part on how much the *previous* thing to run on that core
left the cache.  If you run, and then a CPU-bound process that only touches 16K
of your 8M L2 cache runs, when you reschedule, your cache miss rate will be
very low.  If however that CPU bound job is walking an array and dirties the
entire 8M, your cache miss rate will be astronomical until you've repopulated
the cache...

2) Trying to update cache miss rate in real time from *userspace* only makes
the problem worse, because your own userspace activity ends up impacting the
cache warmth of the process you're trying to track...

2a) Oh, and doing so is inherently full of race conditions

3) Even if you get the number in there, what exactly do you propose to do
with it?  How would you modify the scheduling algorithm?

Hint:  If you think that the scheduler should be including some new piece
of information, you should probably stop and ask yourself "Why, with close
to 2 decades of improvement by some very smart people, is it not doing so
already?"... There's a *very* good chance it's been considered and discarded
(possibly multiple times).


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


Re: ?c8???How to contact to Greg.

2016-05-13 Thread Valdis . Kletnieks
On Fri, 13 May 2016 21:08:46 +0800, "Aric" said:
> Why nerver toppost?

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Now do you understand?


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


Re: How to fast master kernel

2016-05-10 Thread Valdis . Kletnieks
On Tue, 10 May 2016 10:58:43 +0800, "Aric" said:

> I'm a newcomer, hope to learn linux kernel together. How can I contribute to
> kernel programming? Any good tutorials and tranings ? Why so silence this
> mail-alias.

Step 0: Figure out *why* you want to contribute.  The answer you seek
depends a lot on why you're asking the question

Just because it sounds cool?

You bought something on Ebay and discovered it doesn't have a driver?

Your employer just told you that your company's new widget needs a driver?

You have a particular interest in filesystems, or crypto, or hypervisors, or
whatever?

You just want to give back to the community?

(If the latter, I suggest just building a new linux-next kernel every
week or so, and report any issues.  We need more testers more than we need
more code, and the learning curve for testing is a *lot* lower...)

In fact, here's the learning curve:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

$ git remote add linux-next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
$ git fetch linux-next
$ git fetch --tags linux-next

(build and boot a test kernel)

... # later on a week or so later...

$ git remote update (note that 'git pull' does *not* work for linux-next)
(mount and boot a test kernel)

Yeah, it really *is* that simple.. :)



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


Re: single, comprehensive kernel data types document?

2016-04-15 Thread Valdis . Kletnieks
On Fri, 15 Apr 2016 09:18:32 -0700, Greg KH said:

> Within the kernel, yes, you can use lots of different types for the same
> "real" variable size, but you shouldn't, just use the well-known and
> common types "u8" and you will be fine.  Those other ones are there due
> to code being brought in from all over the place, that's what happens
> with a codebase of 20 million lines at times :)

What's the current feeling on using typedefs to get more type safety?



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


Re: anyone aware of a high availability setup that relies on fully redundant install?

2016-04-18 Thread Valdis . Kletnieks
On Mon, 18 Apr 2016 06:29:21 -0400, "Robert P. J. Day" said:

>   that makes sense -- a *minimal* bootable system for recovery and
> troubleshooting. but not a fully independent previous install.

No, it's a *complete* system - your kernel boot image, /, /usr, /var, and
whatever other file systems you specified to go into 'rootvg'.  The use case is
that before doing maintenance or whatever, you run a shell script that clones
the entire rootvg over to alt_rootvg.  Or you can apply system updates to
the alternate boot, so instead of taking an outage for 2 hours to apply
all your fixes, you apply fixes onto the alternate, and your outage window
is only what it takes to reboot to the updated image - and you still have
the old image to fall back to.

Incredibly useful for that set of systems that you need to minimize downtime,
but the application in question isn't one that you can run multiple instances
behind a load balancer.  We've used it for everything from a Listserv server
to a TSM backup server.

http://sureshaix.blogspot.com/2008/07/alternate-disk-installation.html
http://www.drdobbs.com/aix-alternate-disk-installation/199101222

(Yes, that's an article from 1991.. :)


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


Re: Serial driver in-band control message

2016-04-20 Thread Valdis . Kletnieks
On Wed, 20 Apr 2016 22:27:27 -, Ramon Fried said:

> I'm developing a driver for a rather weird serial controller hardware.
> The HW allows the host to put it in low power state.
> The command for entering low power is an ASCII message sent in-band.

Do you happen to have the contact info for the vendor's pharmaceutical
supplier?  They obviously have some top-notch drugs involved. :)



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


Re: anyone aware of a high availability setup that relies on fully redundant install?

2016-04-17 Thread Valdis . Kletnieks
On Sun, 17 Apr 2016 10:47:55 -0400, "Robert P. J. Day" said:
>   i figure this is as good a place as any to ask ... is anyone here
> aware of anyone using a linux config and install that, for the
> purposes of reliability or high availability or whatever you want to
> call it, relies on a second, completely independent installation of
> linux on the same hard drive?

IBM's AIX has for a long time had the concept of an 'alternate boot volume',
which can be another logical volume on the same physical hard drive.  But it's
not intended for high-availability, it's for "if this software upgrade goes
pear-shaped I have an easy backout procedure".  And it avoids most of the "you
have to keep two version" issues by providing a tool to copy your *current*
system onto the alternate boot.  I'm sure some Linux distros have stolen the
concept.

Most implementations  of "high availability" would see the phrase "on the same
hard drive" and start pointing and laughing at the single point of failure.



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


Re: kernel development process question, patch review

2017-02-21 Thread valdis . kletnieks
On Tue, 21 Feb 2017 12:35:33 +1100, "Tobin C. Harding" said:
> If a reviewer makes a suggestion and one intends on making the change
> as suggested is it required (normal protocol) to reply stating that
> the you understand their suggestion and intend on implementing it or
> is this just noise. Should one simply re send the next version of the
> patch?

If it's something trivial, like changing a variable name to something
better, or clarifying a comment block, just cc: the reviewer on the next
revision of the patch.

If the reviewer suggest a major overhaul ("the goal looks good, but you
should probably use this other API" or similar), and it's something that
will take a bit of time, you should probably send a quick "Yes, I've put
that on my to-do list" note so the reviewer knows you read their note.

And of course, if you're not sure or disagree with the reviewer, that's
the time to start bouncing polite e-mails back and forth until you're on
the same page.


pgpaoWsc6qaeh.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 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


Re: recovery from fail

2017-02-13 Thread valdis . kletnieks
On Mon, 13 Feb 2017 23:10:39 +, Andrey Utkin said:
> On Mon, Feb 13, 2017 at 12:29:04PM +1100, Tobin Harding wrote:

> > I don't want to make any more noise than I already have
>
> Not a big deal.
> Don't worry about that unless you repeatedly receive strong suggestions
> to never submit anything again.

Don't worry too much, I've been around since 2.5.47 (late 2002), and out of the
thousands of people contributing to the kernel, we've have exactly *one*
person like that.

(We've had a number of people who we've suggested get a bit more competent
at C programming, but we're more than happy to hear from those people after
they've spent a few more months doing C coding...

> > but I also don't want to ignore the reviewer by not implementing the
> > suggested changes.
> >
> > Is it rude to reply to the original review email for further
> > discussion having already botched the patch?
>
> If you can fix issues on your own, just submit v3 and add all previous
> reviewers to recipients list.

Note that many subsystem maintainers will get irritated if you submit a v3
that *doesn't* fix all the issues identified so far - so stash all the comments
on the v2 patchset in a mail folder, and before you send v3, go through and
make sure you've done *something* about all the comments.

> If you can't fix issues, proceed discussion with reviewer in whatever
> way you find suitable.

And keep in mind that some reviewers are merely seeking explanations because
they don't spend a lot of time in the relevant part of the kernel. I've been
known to comment om patches with questions like "Did you consider the effect of
XYZ?" and a reply of "Yeah we thought about it, and it's not an issue because
ABC" is all that's needed...



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


<    2   3   4   5   6   7   8   9   10   11   >