svn commit: r358855 - in head/sys: kern sys

Konstantin Belousov kib at FreeBSD.org
Tue Mar 10 20:04:40 UTC 2020


Author: kib
Date: Tue Mar 10 20:04:38 2020
New Revision: 358855
URL: https://svnweb.freebsd.org/changeset/base/358855

Log:
  Return reschedule_signals() to being static again.
  
  It was used after sigfastblock_setpend() call in in ast() when current
  thread fast-blocks signals.  Add a flag to sigfastblock_setpend() to
  request reschedule, and remove the direct use of the function from
  subr_trap.c
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_sig.c
  head/sys/kern/subr_trap.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Mar 10 20:01:52 2020	(r358854)
+++ head/sys/kern/kern_sig.c	Tue Mar 10 20:04:38 2020	(r358855)
@@ -108,6 +108,7 @@ static int	coredump(struct thread *);
 static int	killpg1(struct thread *td, int sig, int pgid, int all,
 		    ksiginfo_t *ksi);
 static int	issignal(struct thread *td);
+static void	reschedule_signals(struct proc *p, sigset_t block, int flags);
 static int	sigprop(int sig);
 static void	tdsigwakeup(struct thread *, int, sig_t, int);
 static int	sig_suspend_threads(struct thread *, struct proc *, int);
@@ -2683,7 +2684,7 @@ stopme:
 	return (td->td_xsig);
 }
 
-void
+static void
 reschedule_signals(struct proc *p, sigset_t block, int flags)
 {
 	struct sigacts *ps;
@@ -4124,8 +4125,8 @@ sigfastblock_fetch(struct thread *td)
 	(void)sigfastblock_fetch_sig(td, true, &val);
 }
 
-void
-sigfastblock_setpend(struct thread *td)
+static void
+sigfastblock_setpend1(struct thread *td)
 {
 	int res;
 	uint32_t oldval;
@@ -4152,5 +4153,19 @@ sigfastblock_setpend(struct thread *td)
 		MPASS(res == 1);
 		if (thread_check_susp(td, false) != 0)
 			break;
+	}
+}
+
+void
+sigfastblock_setpend(struct thread *td, bool resched)
+{
+	struct proc *p;
+
+	sigfastblock_setpend1(td);
+	if (resched) {
+		p = td->td_proc;
+		PROC_LOCK(p);
+		reschedule_signals(p, fastblock_mask, SIGPROCMASK_FASTBLK);
+		PROC_UNLOCK(p);
 	}
 }

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Tue Mar 10 20:01:52 2020	(r358854)
+++ head/sys/kern/subr_trap.c	Tue Mar 10 20:04:38 2020	(r358855)
@@ -328,11 +328,7 @@ ast(struct trapframe *framep)
 		sigfastblock_fetch(td);
 		if ((td->td_pflags & TDP_SIGFASTBLOCK) != 0 &&
 		    td->td_sigblock_val != 0) {
-			sigfastblock_setpend(td);
-			PROC_LOCK(p);
-			reschedule_signals(p, fastblock_mask,
-			    SIGPROCMASK_FASTBLK);
-			PROC_UNLOCK(p);
+			sigfastblock_setpend(td, true);
 		} else {
 			PROC_LOCK(p);
 			mtx_lock(&p->p_sigacts->ps_mtx);
@@ -350,7 +346,7 @@ ast(struct trapframe *framep)
 	 * the postsig() loop was performed.
 	 */
 	if (td->td_pflags & TDP_SIGFASTPENDING)
-		sigfastblock_setpend(td);
+		sigfastblock_setpend(td, false);
 
 	/*
 	 * We need to check to see if we have to exit or wait due to a

Modified: head/sys/sys/signalvar.h
==============================================================================
--- head/sys/sys/signalvar.h	Tue Mar 10 20:01:52 2020	(r358854)
+++ head/sys/sys/signalvar.h	Tue Mar 10 20:04:38 2020	(r358855)
@@ -393,7 +393,6 @@ void	pgsignal(struct pgrp *pgrp, int sig, int checkctt
 int	postsig(int sig);
 void	kern_psignal(struct proc *p, int sig);
 int	ptracestop(struct thread *td, int sig, ksiginfo_t *si);
-void	reschedule_signals(struct proc *p, sigset_t block, int flags);
 void	sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *retmask);
 struct sigacts *sigacts_alloc(void);
 void	sigacts_copy(struct sigacts *dest, struct sigacts *src);
@@ -406,7 +405,7 @@ int	sigev_findtd(struct proc *p, struct sigevent *sige
 int	sig_ffs(sigset_t *set);
 void	sigfastblock_clear(struct thread *td);
 void	sigfastblock_fetch(struct thread *td);
-void	sigfastblock_setpend(struct thread *td);
+void	sigfastblock_setpend(struct thread *td, bool resched);
 void	siginit(struct proc *p);
 void	signotify(struct thread *td);
 void	sigqueue_delete(struct sigqueue *queue, int sig);


More information about the svn-src-all mailing list