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

Gleb Smirnoff glebius at FreeBSD.org
Thu Jan 23 01:21:00 UTC 2020


Author: glebius
Date: Thu Jan 23 01:20:59 2020
New Revision: 357003
URL: https://svnweb.freebsd.org/changeset/base/357003

Log:
  Add ie_hflags to struct intr_event, which accumulates flags from all
  handlers on this event.  For now handle only IH_ENTROPY in that manner.

Modified:
  head/sys/kern/kern_intr.c
  head/sys/sys/interrupt.h

Modified: head/sys/kern/kern_intr.c
==============================================================================
--- head/sys/kern/kern_intr.c	Wed Jan 22 23:28:42 2020	(r357002)
+++ head/sys/kern/kern_intr.c	Thu Jan 23 01:20:59 2020	(r357003)
@@ -190,7 +190,7 @@ intr_event_update(struct intr_event *ie)
 	/* Start off with no entropy and just the name of the event. */
 	mtx_assert(&ie->ie_lock, MA_OWNED);
 	strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname));
-	ie->ie_flags &= ~IE_ENTROPY;
+	ie->ie_hflags = 0;
 	missed = 0;
 	space = 1;
 
@@ -203,8 +203,7 @@ intr_event_update(struct intr_event *ie)
 			space = 0;
 		} else
 			missed++;
-		if (ih->ih_flags & IH_ENTROPY)
-			ie->ie_flags |= IE_ENTROPY;
+		ie->ie_hflags |= ih->ih_flags;
 	}
 
 	/*
@@ -958,7 +957,7 @@ intr_event_schedule_thread(struct intr_event *ie)
 	 * If any of the handlers for this ithread claim to be good
 	 * sources of entropy, then gather some.
 	 */
-	if (ie->ie_flags & IE_ENTROPY) {
+	if (ie->ie_hflags & IH_ENTROPY) {
 		entropy.event = (uintptr_t)ie;
 		entropy.td = ctd;
 		random_harvest_queue(&entropy, sizeof(entropy), RANDOM_INTERRUPT);
@@ -1492,18 +1491,12 @@ db_dump_intr_event(struct intr_event *ie, int handlers
 		db_printf("(pid %d)", it->it_thread->td_proc->p_pid);
 	else
 		db_printf("(no thread)");
-	if ((ie->ie_flags & (IE_SOFT | IE_ENTROPY | IE_ADDING_THREAD)) != 0 ||
+	if ((ie->ie_flags & (IE_SOFT | IE_ADDING_THREAD)) != 0 ||
 	    (it != NULL && it->it_need)) {
 		db_printf(" {");
 		comma = 0;
 		if (ie->ie_flags & IE_SOFT) {
 			db_printf("SOFT");
-			comma = 1;
-		}
-		if (ie->ie_flags & IE_ENTROPY) {
-			if (comma)
-				db_printf(", ");
-			db_printf("ENTROPY");
 			comma = 1;
 		}
 		if (ie->ie_flags & IE_ADDING_THREAD) {

Modified: head/sys/sys/interrupt.h
==============================================================================
--- head/sys/sys/interrupt.h	Wed Jan 22 23:28:42 2020	(r357002)
+++ head/sys/sys/interrupt.h	Thu Jan 23 01:20:59 2020	(r357003)
@@ -118,6 +118,7 @@ struct intr_event {
 	void		(*ie_post_filter)(void *);
 	int		(*ie_assign_cpu)(void *, int);
 	int		ie_flags;
+	int		ie_hflags;	/* Cumulative flags of all handlers. */
 	int		ie_count;	/* Loop counter. */
 	int		ie_warncnt;	/* Rate-check interrupt storm warns. */
 	struct timeval	ie_warntm;
@@ -129,7 +130,6 @@ struct intr_event {
 
 /* Interrupt event flags kept in ie_flags. */
 #define	IE_SOFT		0x000001	/* Software interrupt. */
-#define	IE_ENTROPY	0x000002	/* Interrupt is an entropy source. */
 #define	IE_ADDING_THREAD 0x000004	/* Currently building an ithread. */
 
 /* Flags to pass to sched_swi. */


More information about the svn-src-all mailing list