qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH] tests/functional: Use more fine-grained locking when looking for free ports
Date: Mon, 25 Aug 2025 11:04:03 +0200	[thread overview]
Message-ID: <c6b38976-6fbc-41e4-a051-36025cb9c297@redhat.com> (raw)
In-Reply-To: <CAAjaMXY1fcTZ517dmrd+nAt4WUEcR3U2bbmM3ZytDkXREEX6TA@mail.gmail.com>

On 25/08/2025 10.51, Manos Pitsidianakis wrote:
> On Mon, Aug 25, 2025 at 11:47 AM Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 25/08/2025 09.30, Manos Pitsidianakis wrote:
>>> On Thu, Aug 21, 2025 at 12:49 PM Thomas Huth <thuth@redhat.com> wrote:
>>>>
>>>> From: Thomas Huth <thuth@redhat.com>
>>>>
>>>> Currently, we have one lock that is held while a test is looking for
>>>> free ports. However, we are also using different ranges for looking
>>>> for free ports nowadays (PORTS_START is based on the PID of the process),
>>>> so instead of using only one lock, we should rather use a lock per
>>>> range instead. This should help to allow running more tests in parallel.
>>>>
>>>> While we're at it, also create the lock files without executable bit
>>>> (mode is 0o777 by default).
>>>>
>>>
>>> (Unrelated to this patch but the file itself)
>>>
>>> Hm. AF_INET supports binding to port 0 to connect to any available
>>> port (see man 7 ip). Is this not portable?
>>
>> No clue ... but in that case, we'd need to go back to only use one lock for
>> all tests that are running in parallel, so it might cause some more contention?
> 
> IIUC there would be no need for locking, since the kernel would return
> a free port for each process.

That only works within a process, doesn't it? The problem here is that the 
test itself does not open the port, it just first needs to figure out a free 
port that will be used later.
The test then launches QEMU with that port number, which will then open this 
port. Then the test connects to that port number (which it must know) to 
interact with QEMU.
If QEMU is using port 0 for that, the test might not have a way to retrieve 
the final port number from QEMU in all cases.

  Thomas



  reply	other threads:[~2025-08-25  9:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  9:47 [PATCH] tests/functional: Use more fine-grained locking when looking for free ports Thomas Huth
2025-08-21 10:00 ` Daniel P. Berrangé
2025-08-25  7:30 ` Manos Pitsidianakis
2025-08-25  8:47   ` Thomas Huth
2025-08-25  8:51     ` Manos Pitsidianakis
2025-08-25  9:04       ` Thomas Huth [this message]
2025-08-25  9:10         ` Manos Pitsidianakis

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-all 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=c6b38976-6fbc-41e4-a051-36025cb9c297@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).