Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: linuxtestproject.agent@gmail.com
Cc: Pavithra <pavrampu@linux.ibm.com>, ltp@lists.linux.it
Subject: Re: [LTP] hugetlb/hugefallocate: Add hugefallocate03 to stress test fallocate on hugetlbfs
Date: Mon, 2 Nov 2026 16:59:39 +0100	[thread overview]
Message-ID: <auiza7MDTyAN1sC0@yuki.lan> (raw)
In-Reply-To: <20260923100043.9301-1-linuxtestproject.agent@gmail.com>

Hi!
> > +	SAFE_SIGACTION(SIGBUS, &sa, NULL);
> > +
> > +	fault_mmap_addr = SAFE_MMAP(NULL, max_hpages * hpage_size,
> > +			PROT_READ | PROT_WRITE, MAP_SHARED,
> > +			fd, 0);
> > +
> > +	pthread_cleanup_push(thread_fault_cleanup, NULL);
> > +
> > +	while (1) {
> > +		tpage = ((long long)random()) % (max_hpages);
> > +
> > +		if (sigsetjmp(fault_jmp, 1) == 0) {
> > +			foo = *((char *)(fault_mmap_addr + (tpage * hpage_size)));
> > +			*((volatile char *)(fault_mmap_addr + (tpage * hpage_size))) = foo;
> > +		}
> 
> Save the original SIGBUS handler and restore it upon thread termination or in
> cleanup. If SIGBUS is raised after this thread terminates, siglongjmp() jumps
> to an invalid stack.

More generally we can just remove all the thread cleanup registration
and cancelation points if we just do:

static volatile int run;

...

void *pthread_func(void *)
{
	...

	while (run) {
		...
	}

	SAFE_MUNMAP(...);
	reutrn NULL;
}

The main thread can then stop all three threads by setting run = 0 and
the cleanup runs without the pthread cleanup complexity.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-11-02 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  8:01 [LTP] [PATCH v9] hugetlb/hugefallocate: Add hugefallocate03 to stress test fallocate on hugetlbfs Pavithra
2026-09-23 10:00 ` [LTP] " linuxtestproject.agent
2026-11-02 15:59   ` Cyril Hrubis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-11-07 12:05 [LTP] [PATCH v11] " Pavithra
2026-11-07 16:44 ` [LTP] " linuxtestproject.agent
2026-11-07  6:28 [LTP] [PATCH v10] " Pavithra
2026-11-07 10:51 ` [LTP] " linuxtestproject.agent
2026-09-20 11:35 [LTP] [PATCH v8] " Pavithra
2026-09-20 14:43 ` [LTP] " linuxtestproject.agent
2026-09-19 17:49 [LTP] [PATCH v7] " Pavithra
2026-09-19 20:14 ` [LTP] " linuxtestproject.agent

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=auiza7MDTyAN1sC0@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=pavrampu@linux.ibm.com \
    /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