public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yoshinoya via groups.io" <yoshinoyatoko=163.com@groups.io>
To: devel@edk2.groups.io, n.jayaprakash@intel.com
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"pedro.falcato@gmail.com" <pedro.falcato@gmail.com>
Subject: Re: [edk2-devel] Python-3.6.8 UEFI : fork support
Date: Mon, 19 May 2025 09:37:45 +0800 (CST)	[thread overview]
Message-ID: <5058b56e.178f.196e63095f0.Coremail.yoshinoyatoko@163.com> (raw)
In-Reply-To: <PH7PR11MB5943A234A7B29051A330B44FEE93A@PH7PR11MB5943.namprd11.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 5302 bytes --]

Hi,

I traced code, and found import module "site" caused the running speed slower and slower.

If i run "Python -S' , and python ran quickly with debug ver firmware.

This parateter lets cpython not import site modules during cpython kernel loading.




Although going into python interactive environ quickly, but if i ran "import site" manually in the interactive shell, and it will also execute slower.







If debug ver firmware caused cpython ran slower , and i think every time running it will be a determinate time period.

Actually, if you ran 3 times, you would find every time is different.




Thanks










At 2025-05-16 12:24:01, "Jayaprakash, N via groups.io" <n.jayaprakash=intel.com@groups.io> wrote:

That’s right I have also observed this, on Debug IFWI firmware it runs very slowly.

It could be due to generation of lot of prints from the firmware as it is a debug build.

So, it is expected to be very slow.

 

But on a release build of the firmware it works pretty quick and we don’t notice the slowness as observed with the debug firmware.

One option is to use the pre-compiled library files which are compiled to .pyc files.

So that Python interpreter boot strap process can run pretty fast.

 

Regards,

JP

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yoshinoya via groups.io
Sent: Thursday, May 15, 2025 7:39 AM
To: devel@edk2.groups.io; Jayaprakash, N <n.jayaprakash@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; pedro.falcato@gmail.com
Subject: Re: [edk2-devel] Python-3.6.8 UEFI : fork support

 

Hi, JP

I found an interesting test result.

I ran shell python on qemu with debug version ovmf fd.

I executed "python" command in shell environment, it ran slowly in the first time.

then i executed "quit(0" command in python interactive environ, and launched python again in shell environment.

And it ran more slower than the first time.

 

If i do the same test on quem with release version ovmf fd, and it's normal.

every time, i ran python in shell, and it ran quickly.

 

I tried to run "python -v', and saved the output log, not find any obvious exception.

 

Is there any suggestion?

 

 

best wishes,

 

 

在 2025-02-18 13:07:57,"Yoshinoya" <yoshinoyatoko@163.com> 写道:

Hi, JP,

Thanks a lot!

 

best wishes,

 

 

 

At 2025-02-17 23:51:25, "Jayaprakash, N via groups.io" <n.jayaprakash=intel.com@groups.io> wrote:

Hi Yoshinoya,

 

The MP Services UEFI protocol has been used to run the CPUID instructions on a given CPU core and to read / write the MSRs from given CPU core.

The python functions for this purpose are supported from the edk2module built in extension module are respectively cpuid_ex, rdmsr_ex/  wrmsr_ex with the function signatures as given below.

 

cupid_ex has the following signature cpuid_ex(cpu, eax, ecx) -> (eax:ebx:ecx:edx)

rdmsr_ex(cpu, msr) -> (lower_32bits, higher_32bits)

wrmsr_ex(cpu, msr, lower_32bits, higher_32bits) -> None

 

where the cpu parameter refers to the cpu core number starting from 0, 0 being BSP.

 

The usage instructions and code sample are not yet updated in the wiki. I can add more details at the earliest.

 

Please use the edk2-libc discussions page for any further questions / discussions.

https://github.com/tianocore/edk2-libc/discussions

 

Regards,

JP

 

From: Yoshinoya <yoshinoyatoko@163.com>
Sent: Monday, February 17, 2025 4:43 PM
To:devel@edk2.groups.io; Jayaprakash, N <n.jayaprakash@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; pedro.falcato@gmail.com
Subject: Re:Re: [edk2-devel] Python-3.6.8 UEFI : fork support

 

hi, JP

Got it, thank you!

 

I found some uefi mp service functions's call sample in edk2module.c

 

So, user could follow this sample and write multi process sample with python script ? 

 

best wishes,

 

 

 

 

At 2025-02-17 13:23:58, "Jayaprakash, N via groups.io" <n.jayaprakash=intel.com@groups.io> wrote:

Hi Yoshinoya,

 

It’s not supported in UEFI.

 

You can see that macros are not defined as part of pyconfig.h

https://github.com/tianocore/edk2-libc/blob/master/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Include/pyconfig.h

 

So this functionality doesn’t get compiled for UEFI.

 

Regards,

JP

 

From: Yoshinoya <yoshinoyatoko@163.com>
Sent: Monday, February 17, 2025 8:19 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; pedro.falcato@gmail.com; devel@edk2.groups.io; Jayaprakash, N <n.jayaprakash@intel.com>
Subject: [edk2-devel] Python-3.6.8 UEFI : fork support

 

Hi, Michael

I  am studying Python368 uefi code.

I have a question, ask for help.

 

I found some marco defines in edk2module.c

"HAVE_FORK / HAVE_FORK1 / HAVE_SPAWNV / etc"

 

It seems about multi-thread support functions, 

so my question is:

1. Have these functions been tested on uefi shell environments?

2. Are there any code samples for study how to use them?

 

Thank you very much.

 

best wishes,



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121348): https://edk2.groups.io/g/devel/message/121348
Mute This Topic: https://groups.io/mt/111225588/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 31119 bytes --]

  reply	other threads:[~2025-05-19  1:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17  2:49 [edk2-devel] Python-3.6.8 UEFI : fork support Yoshinoya via groups.io
2025-02-17  5:23 ` Jayaprakash, N via groups.io
2025-02-17 11:13   ` Yoshinoya via groups.io
2025-02-17 15:51     ` Jayaprakash, N via groups.io
2025-02-18  5:07       ` Yoshinoya via groups.io
2025-05-15  2:09         ` Yoshinoya via groups.io
2025-05-16  4:24           ` Jayaprakash, N via groups.io
2025-05-19  1:37             ` Yoshinoya via groups.io [this message]
2025-05-20  4:06               ` Jayaprakash, N via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5058b56e.178f.196e63095f0.Coremail.yoshinoyatoko@163.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox