Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/freebsd/12-stable/master' into h…
Browse files Browse the repository at this point in the history
…ardened/12-stable/master

* origin/freebsd/12-stable/master:
  Restore binary compatibility for epoch(9) API. This is a direct commit.

Signed-off-by: Oliver Pinter <[email protected]>
  • Loading branch information
opntr committed Jul 8, 2019
2 parents 6d0dc0f + 3427c34 commit 35fbe46
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
43 changes: 41 additions & 2 deletions sys/kern/subr_epoch.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based reclamation");
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 {
struct ck_epoch e_epoch __aligned(EPOCH_ALIGN);
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;
Expand Down Expand Up @@ -737,3 +739,40 @@ epoch_drain_callbacks(epoch_t epoch)

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);
}
6 changes: 6 additions & 0 deletions sys/sys/epoch.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,11 @@ void epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et);
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_ */

0 comments on commit 35fbe46

Please sign in to comment.