Re: Submitting a selftest patch

2024-05-08 Thread Siddh Raman Pant
On Wed, 08 May 2024 08:08:20 +0530 Camila Alvarez  wrote:
> I’ve been discussing a bug with one of the maintainers of a subsystem.
> At one point I was asked to craft a selftest for the issue. 
>  
> My question is: how do I send the patch with the selftest? Do I need
> to reference the email where the selftest request was made? Or
> should I just send it as an independent patch? 

Both are fine. git send-email has in-reply-to option so you can just
reply to the thread. Make sure to CC the relevant mailing lists and
people.

Thanks,
Siddh

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


Re: git send-email and gmail smtp

2024-04-17 Thread Siddh Raman Pant
On Wed, 17 Apr 2024 22:00:56 +0530, Jim Cromie wrote:
> so I tried to submit a patchset via sendemail,
> and ran aground on authorization.
> 
> its been a while since I sent from this computer,
> laptop power cord is cut :-(
> but failure wording is ambiguous
> 
> 5.7.8 Username and Password not accepted. For more information, go to
> 5.7.8  https://support.google.com/mail/?p=BadCredentials
> j15-20020a0566022ccf00b007d6905cc017sm3758492iow.4 - gsmtp
> 
> Essentially, google is changing policy,
> and 2FA is coming (or just arrived)
> 
> is there a well-travelled path to work around this issue?
> 
> something like ssh-key-agent ?

You can use app-passwords and store them in a keyring.

https://support.google.com/accounts/answer/185833?hl=en

Thanks,
Siddh

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


amd-pstate: Setting the maximum frequency in guided mode

2023-08-15 Thread Siddh Raman Pant
Hi,

I am trying out the amd-pstate guided mode. If I understand the docs
correctly [1], guided mode essentially enforces a range (min, max)
over the frequency which can be selected by the processor, i.e. it is
like active mode but with range enforced.

If true, it looks attractive for battery saving. So on battery, I'd
like to use conservative governor with a max frequency of, say, 1.8
GHz, just as a test.

So after setting the maximum scaling frequency to 1.8 GHz using
TLP (which now supports amd-pstate [2]), `$ cpupower frequency-info`
yielded the following:

==
analyzing CPU 7:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 7
  CPUs which need to have their frequency coordinated by software: 7
  maximum transition latency: 20.0 us
  hardware limits: 400 MHz - 2.10 GHz
  available cpufreq governors: userspace powersave ondemand conservative 
performance schedutil
  current policy: frequency should be within 400 MHz and 1.80 GHz.
  The governor "conservative" may decide which speed to use
  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 2.75 GHz (asserted by call to kernel)
  boost state support:
Supported: yes
Active: no
AMD PSTATE Highest Performance: 255. Maximum Frequency: 4.06 GHz.
AMD PSTATE Nominal Performance: 132. Nominal Frequency: 2.10 GHz.
AMD PSTATE Lowest Non-linear Performance: 70. Lowest Non-linear Frequency: 
1.11 GHz.
AMD PSTATE Lowest Performance: 26. Lowest Frequency: 400 MHz.
==

Why is the frequency 2.75 GHz? Even the nominal max is 2.1 GHz, and
the output says boost is not active either. 

Thanks,
Siddh

[1] https://www.kernel.org/doc/html/latest/admin-guide/pm/amd-pstate.html
[2] https://github.com/linrunner/TLP/issues/630


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


Re: Where can I find information on memremap behavior?

2023-02-03 Thread Siddh Raman Pant
On Fri, 03 Feb 2023 16:28:18 +0530, Anton Gusev wrote
> I am trying to investigate a potential NULL dereference
> in drivers/firmware/efi/efi.c in the function efi_mem_reserve_persistent.
> 
> In it, a result of memremap call is dereferenced without null checks.
> I'd like to understand if it's an error or if there is some sort of invariant 
> that guarantees
> it will never return NULL.

Indeed, every pointer which can be NULL must be checked for it.
The code should check the returned value in rsv for NULL and break.

> For this I need to know when memremap (or the underlying ioremap, I guess)
> might return NULL. Just looking into its source code didn't give me much 
> insight.
> 
> Do you know any articles/documentation on how memremap and/or ioremap work?
> 
> What topics should I study to understand more about it?

There's an article on LWN: https://lwn.net/Articles/653585/, though
if you want to understand the mechanics, it seems like you will have
to dive into the code.

But your observation is indeed correct. You should send a patch.
Fixes tag may have 18df7577adae6.

Thanks,
Siddh

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


Re: custom compil

2023-01-26 Thread Siddh Raman Pant
Please use plain text email and top-posting.

Quoting Greg KH:

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
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 in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

-

On Thu, 26 Jan 2023 at 05:43:42 +0530, Aurel Pere wrote:
> Ok thanks for these infos i will check it out
> 
> When saying automatic i was referring to kernel updates in
> package repositories (with apt or dnf) where auto download
> and install can be configured for security updates...i was
> thinking about applying config options but i guess they are
> already compiled?

Yes, those are already compiled. That's why the process is so
quick!

> Isnt there a tool that would download new kernel based on
> repository security updates and that would compile it with a
> provided config file?
> 
> I can use a bash script or ansible role but i dont see how to
> keep close to the official kernel distribution updates
> automatically...

Make a cron job to pull from the kernel repo automatically, either
the stable kernel.org or Fedora's official repo. Then you can run
the merge_config script, and then build the kernel. Then, you can
run `update-grub` or whatever is the process.

Unless for learning, why do this? Fedora maintainers do know their
stuff, so you can trust them. You are not going to audit changes
anyways, so this exercise is futile as you are basically doing the
same thing as `sudo dnf update` (or whatever the dnf command is),
but without the testing from maintainers and other people. Not to
mention the Fedora specific quirks which won't be there upstream.

Better to have your stuff up-to-date using dnf-automatic.
https://docs.fedoraproject.org/en-US/quick-docs/securing-the-system-by-keeping-it-up-to-date/

Thanks,
Siddh

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


Re: custom compil

2023-01-25 Thread Siddh Raman Pant
On Thu, 26 Jan 2023 at 03:25:08 +0530, A.Péré wrote:
> Is there a distribution with automated tools to compile a kernel
> with custom config settings

Yes, it is your favourite distro, whichever that may be. You just
need the tools to build, which you may already have, but can be seen
in docs: https://www.kernel.org/doc/html/latest/process/changes.html

> that ils easier and more accessible

If you want a GUI, use `make xconfig`.

> un particular for automated updates with automatic custom compiling config? 

Have your custom config options in a separate file somewhere, and use
scripts/kconfig/merge_config.sh to merge. Example in a script:

make defconfig
./scripts/kconfig/merge_config.sh .config common.config

The script will take care of requisite stuff, which additional options
to enable, etc.

Or you can have your entire config saved in .config, and just run
merge_config.sh everytime you pull newer kernel code.

Thanks,
Siddh

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


RE: clock_gettime function doesn't scale to real time.. and changing CNTFRQ_EL0 doesn't make any change..(arm64)

2022-11-08 Thread Siddh Raman Pant
On Tue, 08 Nov 2022 10:45:55 +0530  Chan Kim  wrote:
> 
> Hello all,
> 
> I fixed this problem and now the time measurement and commands like sleep
> works just fine.
> 
> Two points I fixed : 
> - I had 'clock-frequency' property set with wrong frequency in my timer node
> in the device tree so I removed it. 
>The document says when the boot loader sets CNTFRQ register correctly, we
> don't have to provide 'clock-frequency' property value.
> - The correct frequency of the system counter (arm464) was 10MHz in our
> board. Previously I set CNTFRQ register with 5MHz but I fixed it to 10MHz.
> 
> One more thing to note. The system counter has both system register view and
> memory mapped register view. 
> Previously I said even if I set cntfrq_el0 register with some values (using
> system register, "msr cntfrq_el0, COUNTER_FREQUENCY") it did not change
> anything.
> It was because I set the same register with old value (5MHz) using the
> memory mapped access later (like with "writel(COUNTER_FREQUENCY,
> 0x4c018020);").
> 
> Hope this helps someone later.
> Thank you!
> 
> Chan Kim
> 

Glad to know. Thanks for sharing the updates and the cause behind it!

Thanks,
Siddh


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


Re: REPOST : Kernel panic when try to install Rocky 8.4

2022-11-07 Thread Siddh Raman Pant
As Greg KH says on the mailing list:

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
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 in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

---

On Mon, 07 Nov 2022 14:22:53 +0530, mavis wrote:
> On which site did you find these informations about intel hardware bugs ?
> I didn't find it on the internet.

I searched for the error you provided on Google and went through multiple
links. I also briefly took a look at LKML.

Also, the fix people do (and what I told in the previous email) was to disable
C-state management, which implies the processor is doing some C-state stuff
which the kernel driver is unable to cope with.

Looking at the kernel code, you can find this specific error at line 1055 of
arch/x86/kernel/cpu/mce/core.c. It is related to machine check exception (MCE)
handling.[1] MCEs are triggered by hardware bugs, but the error you mentioned
can potentially be triggered due to incorrect handling by the software.[2]

Anyways, if you didn't, maybe see if you can update your processor's microcode.
https://wiki.archlinux.org/title/Microcode

Thanks,
Siddh

[1] https://en.wikipedia.org/wiki/Machine-check_exception
[2] 
https://lore.kernel.org/lkml/20151205002930.ga24...@otc-brkl-03.jf.intel.com/

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


Re: REPOST : Kernel panic when try to install Rocky 8.4

2022-11-04 Thread Siddh Raman Pant
On Fri, 04 Nov 2022 15:04:43 +0530, mavis wrote:
> Hi All,
> 
> I tried to install Rocky linux 8.4 (kernel 4.18.0-305) but when the kernel
> starts, it result to
> "Kernel Panic - not syncing : Timeout: Not all CPUs entered broadcast 
> exception handler".
> 
> I tried to use other distribs (Centos ; AlmaLinux) and I think this problem
> is related to the kernel version. FYI, the system is running on an 11th Gen
> i7-1185GRE CPU, maybe the problem is with this CPU ?
> 
> With the distribution where the kernel version used is 4.18.0-80 or earlier,
> not kernel panic appear, but on the version 4.18.0-305 until 5.15.x (not
> included, 5.15.x works), I always had a kernel panic error.
> 
> Do you have any tips on how to solve or why the problem occurs ?
> 
> Thanks,
> Axel

This seems to be a known intel hardware related bug, as far as I could google.

While I am almost certain you have, but did you try adding the following to
boot options?

processor.max_cstate=0 intel_idle.max_cstate=0 idle=poll

This will apparantely turn off the CPUIdle subsystem, and stop power
management via C-states.

Unfortunately, that's all I know.

Thanks,
Siddh

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


Re: clock_gettime function doesn't scale to real time.. and changing CNTFRQ_EL0 doesn't make any change..(arm64)

2022-11-04 Thread Siddh Raman Pant
On Fri, 04 Nov 2022 14:34:15 +0530, Chan Kim wrote:
> Hello linux experts and newbies,
> 
> I have ported linux on our arm64 fpga board. Both 5.10.0 and 5.15.xx works
> ok with minimal config.
> 
> I have run a simple application and timed the processing time using
> clock_gettime function.
> 
> It felt like it took almost 2.3 seconds but the program say it took only
> 0.36 seconds.

Try a simple command line loop to see if the problem is with system or your
program: while $(sleep 1); do echo "Hi"; done;

Also, while of no concern here, note that kernel also has a real-time config
(CONFIG_PREEMPT_RT).

> Here is how I did it in the application.
> 
> Int main() {
>   struct timespec start, stop;
>   float exec_time_sec, exec_time_nsec;
> 
>   //check start time
>   if (clock_gettime(CLOCK_REALTIME, &start) == -1 ) {
>perror ("clock_gettime");
>exit(EXIT_FAILURE);
>   }
> 
>   Do something... (calculate fibonacci value for 1 ~ 30)
> 
>   //check end time
>   if (clock_gettime(CLOCK_REALTIME, &stop) == -1 ) {
>   perror ("clock_gettime");
>   exit(EXIT_FAILURE);
>   }
> 
>   //Normalize to mili second
>   exec_time_sec = (float)(stop.tv_sec - start.tv_sec);
>   exec_time_nsec = (float)((double)(stop.tv_nsec - 
> start.tv_nsec)/(double)BILLION);
>   printf("Execution time : %f sec\n", exec_time_sec + exec_time_nsec);
> 
>   return 0;
> 
> }

Adding to what Linus said in the other reply, CLOCK_REALTIME is not guaranteed
to be monotonic. For calculation of intervals, you should instead use
CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW.

Also, try just having Fibonacci calculation in main, and then use the `time`
command to achieve what you want.

> I used u-boot program for loading linux kernel and the u-boot program sets
> the CNTFRQ_EL0 register with 500.
> 
> (which is 5MHz, I heard the system clock runs at 5MHz in the board).
> 
> The description of the register in armv8 arch manual says :
> > This register is provided so that software can discover the frequency of the
> > system counter. It must be programmed with this value as part of system
> > initialization. The value of the register is not interpreted by hardware.
> 
> I tried setting the CNTFRQ_EL0 with 20Mhz, expecting the execution to be
> displayed 4 times shorter but it is the same!

Because as the description says, this register is not interpreted by the
hardware. That means this won't affect hardware in any way, and thus won't
increase frequency. That's why your execution time remains the same.

The value stored here is for use by software to know the clock frequency of
the machine, so it can do its time related calculations appropriately.

What you did is equivalent of trying to hoodwink the system!

> I couldn't find how linux uses clock_gettime.

If you mean how clock_gettime function is defined, see it here:
https://elixir.bootlin.com/linux/latest/source/kernel/time/posix-clock.c#L259

Otherwise: man clock_gettime

> How can I solve this problem?
> Any advice will be deeply appreciated.

Try making the changes and let us know. This is new for me too!

> Thank you!
> Chan Kim

Please use plain text email instead of HTML, that's the kernel mailing list
etiquette. It is also superior once you get the hang of it! :)

Thanks,
Siddh

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