Author: hselasky
Date: Mon Jul  8 21:33:14 2019
New Revision: 349852
URL: https://svnweb.freebsd.org/changeset/base/349852

Log:
  Restore binary compatibility for epoch(9) API.
  This is a direct commit.
  
  Discussed with:       jhb@
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/kern/subr_epoch.c
  stable/12/sys/sys/epoch.h

Modified: stable/12/sys/kern/subr_epoch.c
==============================================================================
--- stable/12/sys/kern/subr_epoch.c     Mon Jul  8 20:53:25 2019        
(r349851)
+++ stable/12/sys/kern/subr_epoch.c     Mon Jul  8 21:33:14 2019        
(r349852)
@@ -65,11 +65,12 @@ static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based re
 TAILQ_HEAD (epoch_tdlist, epoch_tracker);
 typedef struct epoch_record {
        ck_epoch_record_t er_record;
-       struct epoch_context er_drain_ctx;
-       struct epoch *er_parent;
        volatile struct epoch_tdlist er_tdlist;
        volatile uint32_t er_gen;
        uint32_t er_cpuid;
+       /* fields above are part of KBI and cannot be modified */
+       struct epoch_context er_drain_ctx;
+       struct epoch *er_parent;
 } __aligned(EPOCH_ALIGN)     *epoch_record_t;
 
 struct epoch {
@@ -77,6 +78,7 @@ struct epoch {
        epoch_record_t e_pcpu_record;
        int     e_idx;
        int     e_flags;
+       /* fields above are part of KBI and cannot be modified */
        struct sx e_drain_sx;
        struct mtx e_drain_mtx;
        volatile int e_drain_count;
@@ -736,4 +738,41 @@ epoch_drain_callbacks(epoch_t epoch)
        sx_xunlock(&epoch->e_drain_sx);
 
        PICKUP_GIANT();
+}
+
+/* for binary compatibility */
+
+struct epoch_tracker_KBI {
+       void *datap[3];
+#ifdef EPOCH_TRACKER_DEBUG
+       int datai[5];
+#else
+       int datai[1];
+#endif
+} __aligned(sizeof(void *));
+
+CTASSERT(sizeof(struct epoch_tracker_KBI) >= sizeof(struct epoch_tracker));
+
+void
+epoch_enter_preempt_KBI(epoch_t epoch, epoch_tracker_t et)
+{
+       epoch_enter_preempt(epoch, et);
+}
+
+void
+epoch_exit_preempt_KBI(epoch_t epoch, epoch_tracker_t et)
+{
+       epoch_exit_preempt(epoch, et);
+}
+
+void
+epoch_enter_KBI(epoch_t epoch)
+{
+       epoch_enter(epoch);
+}
+
+void
+epoch_exit_KBI(epoch_t epoch)
+{
+       epoch_exit(epoch);
 }

Modified: stable/12/sys/sys/epoch.h
==============================================================================
--- stable/12/sys/sys/epoch.h   Mon Jul  8 20:53:25 2019        (r349851)
+++ stable/12/sys/sys/epoch.h   Mon Jul  8 21:33:14 2019        (r349852)
@@ -83,5 +83,11 @@ void epoch_exit_preempt(epoch_t epoch, epoch_tracker_t
 void epoch_enter(epoch_t epoch);
 void epoch_exit(epoch_t epoch);
 
+/* for binary compatibility - do not use */
+void epoch_enter_preempt_KBI(epoch_t epoch, epoch_tracker_t et);
+void epoch_exit_preempt_KBI(epoch_t epoch, epoch_tracker_t et);
+void epoch_enter_KBI(epoch_t epoch);
+void epoch_exit_KBI(epoch_t epoch);
+
 #endif /* _KERNEL */
 #endif /* _SYS_EPOCH_H_ */
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to