Skip to content

Commit eae0855

Browse files
authored
Merge pull request #12610 from FRRouting/mergify/bp/stable/8.4/pr-12606
*: various build fixes (backport #12606)
2 parents c2853ad + 67e465a commit eae0855

File tree

6 files changed

+59
-42
lines changed

6 files changed

+59
-42
lines changed

doc/developer/subdir.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ EXTRA_DIST += \
7171
doc/developer/draft-zebra-00.ms \
7272
doc/developer/ldpd-basic-test-setup.md \
7373
doc/developer/release-announcement-template.md \
74+
doc/developer/_static/overrides.css \
7475
# end
7576

7677
DEVBUILD = doc/developer/_build

doc/user/subdir.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ user_RSTFILES = \
5656
EXTRA_DIST += \
5757
$(user_RSTFILES) \
5858
doc/user/Useful_Sysctl_Settings.md \
59+
doc/user/_static/overrides.css \
60+
doc/user/_static/overrides.js \
5961
# end
6062

6163
USERBUILD = doc/user/_build

lib/elf_py.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static PyObject *elfreloc_getsection(PyObject *self, PyObject *args)
293293
if (!w->es)
294294
Py_RETURN_NONE;
295295

296-
if (w->symidx == 0) {
296+
if (!w->symvalid || w->symidx == 0) {
297297
size_t idx = 0;
298298
Elf_Scn *scn;
299299

lib/xref.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,19 @@ extern const struct xref * const __stop_xref_array[1] DSO_LOCAL;
208208
* some build issue with it just add -DFRR_XREF_NO_NOTE to your build flags
209209
* to disable it.
210210
*/
211-
#ifdef FRR_XREF_NO_NOTE
211+
#if defined(FRR_XREF_NO_NOTE) || defined(__mips64)
212212
#define XREF_NOTE ""
213+
214+
/* mips64 note: MIPS64 (regardless of endianness, both mips64 & mips64el)
215+
* does not have a 64-bit PC-relative relocation type. Unfortunately, a
216+
* 64-bit PC-relative relocation is exactly what the below asm magic emits.
217+
* Therefore, the xref ELF note is permanently disabled on MIPS64.
218+
*
219+
* For some context, refer to https://reviews.llvm.org/D80390
220+
*
221+
* As noted above, xref extraction still works through the section header
222+
* path, so no functionality is lost.
223+
*/
213224
#else
214225

215226
#if __SIZEOF_POINTER__ == 4

zebra/zserv.c

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,16 @@ static void zserv_write(struct thread *thread)
222222
struct stream *msg;
223223
uint32_t wcmd = 0;
224224
struct stream_fifo *cache;
225+
uint64_t time_now = monotime(NULL);
225226

226227
/* If we have any data pending, try to flush it first */
227228
switch (buffer_flush_all(client->wb, client->sock)) {
228229
case BUFFER_ERROR:
229230
goto zwrite_fail;
230231
case BUFFER_PENDING:
231-
atomic_store_explicit(&client->last_write_time, monotime(NULL),
232-
memory_order_relaxed);
232+
frr_with_mutex (&client->stats_mtx) {
233+
client->last_write_time = time_now;
234+
}
233235
zserv_client_event(client, ZSERV_CLIENT_WRITE);
234236
return;
235237
case BUFFER_EMPTY:
@@ -263,20 +265,19 @@ static void zserv_write(struct thread *thread)
263265
case BUFFER_ERROR:
264266
goto zwrite_fail;
265267
case BUFFER_PENDING:
266-
atomic_store_explicit(&client->last_write_time, monotime(NULL),
267-
memory_order_relaxed);
268+
frr_with_mutex (&client->stats_mtx) {
269+
client->last_write_time = time_now;
270+
}
268271
zserv_client_event(client, ZSERV_CLIENT_WRITE);
269272
return;
270273
case BUFFER_EMPTY:
271274
break;
272275
}
273276

274-
atomic_store_explicit(&client->last_write_cmd, wcmd,
275-
memory_order_relaxed);
276-
277-
atomic_store_explicit(&client->last_write_time, monotime(NULL),
278-
memory_order_relaxed);
279-
277+
frr_with_mutex (&client->stats_mtx) {
278+
client->last_write_cmd = wcmd;
279+
client->last_write_time = time_now;
280+
}
280281
return;
281282

282283
zwrite_fail:
@@ -423,11 +424,13 @@ static void zserv_read(struct thread *thread)
423424
}
424425

425426
if (p2p < p2p_orig) {
427+
uint64_t time_now = monotime(NULL);
428+
426429
/* update session statistics */
427-
atomic_store_explicit(&client->last_read_time, monotime(NULL),
428-
memory_order_relaxed);
429-
atomic_store_explicit(&client->last_read_cmd, hdr.command,
430-
memory_order_relaxed);
430+
frr_with_mutex (&client->stats_mtx) {
431+
client->last_read_time = time_now;
432+
client->last_read_cmd = hdr.command;
433+
}
431434

432435
/* publish read packets on client's input queue */
433436
frr_with_mutex (&client->ibuf_mtx) {
@@ -621,6 +624,7 @@ static void zserv_client_free(struct zserv *client)
621624
buffer_free(client->wb);
622625

623626
/* Free buffer mutexes */
627+
pthread_mutex_destroy(&client->stats_mtx);
624628
pthread_mutex_destroy(&client->obuf_mtx);
625629
pthread_mutex_destroy(&client->ibuf_mtx);
626630

@@ -741,14 +745,13 @@ static struct zserv *zserv_client_create(int sock)
741745
client->obuf_fifo = stream_fifo_new();
742746
client->ibuf_work = stream_new(stream_size);
743747
client->obuf_work = stream_new(stream_size);
748+
client->connect_time = monotime(NULL);
744749
pthread_mutex_init(&client->ibuf_mtx, NULL);
745750
pthread_mutex_init(&client->obuf_mtx, NULL);
751+
pthread_mutex_init(&client->stats_mtx, NULL);
746752
client->wb = buffer_new(0);
747753
TAILQ_INIT(&(client->gr_info_queue));
748754

749-
atomic_store_explicit(&client->connect_time, monotime(NULL),
750-
memory_order_relaxed);
751-
752755
/* Initialize flags */
753756
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
754757
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
@@ -1009,8 +1012,14 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client)
10091012
vty_out(vty, "------------------------ \n");
10101013
vty_out(vty, "FD: %d \n", client->sock);
10111014

1012-
connect_time = (time_t) atomic_load_explicit(&client->connect_time,
1013-
memory_order_relaxed);
1015+
frr_with_mutex (&client->stats_mtx) {
1016+
connect_time = client->connect_time;
1017+
last_read_time = client->last_read_time;
1018+
last_write_time = client->last_write_time;
1019+
1020+
last_read_cmd = client->last_read_cmd;
1021+
last_write_cmd = client->last_write_cmd;
1022+
}
10141023

10151024
vty_out(vty, "Connect Time: %s \n",
10161025
zserv_time_buf(&connect_time, cbuf, ZEBRA_TIME_BUF));
@@ -1030,16 +1039,6 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client)
10301039
vty_out(vty, "Client will %sbe notified about it's routes status\n",
10311040
client->notify_owner ? "" : "Not ");
10321041

1033-
last_read_time = (time_t)atomic_load_explicit(&client->last_read_time,
1034-
memory_order_relaxed);
1035-
last_write_time = (time_t)atomic_load_explicit(&client->last_write_time,
1036-
memory_order_relaxed);
1037-
1038-
last_read_cmd = atomic_load_explicit(&client->last_read_cmd,
1039-
memory_order_relaxed);
1040-
last_write_cmd = atomic_load_explicit(&client->last_write_cmd,
1041-
memory_order_relaxed);
1042-
10431042
vty_out(vty, "Last Msg Rx Time: %s \n",
10441043
zserv_time_buf(&last_read_time, rbuf, ZEBRA_TIME_BUF));
10451044
vty_out(vty, "Last Msg Tx Time: %s \n",
@@ -1173,12 +1172,11 @@ static void zebra_show_client_brief(struct vty *vty, struct zserv *client)
11731172
char wbuf[ZEBRA_TIME_BUF];
11741173
time_t connect_time, last_read_time, last_write_time;
11751174

1176-
connect_time = (time_t)atomic_load_explicit(&client->connect_time,
1177-
memory_order_relaxed);
1178-
last_read_time = (time_t)atomic_load_explicit(&client->last_read_time,
1179-
memory_order_relaxed);
1180-
last_write_time = (time_t)atomic_load_explicit(&client->last_write_time,
1181-
memory_order_relaxed);
1175+
frr_with_mutex (&client->stats_mtx) {
1176+
connect_time = client->connect_time;
1177+
last_read_time = client->last_read_time;
1178+
last_write_time = client->last_write_time;
1179+
}
11821180

11831181
if (client->instance || client->session_id)
11841182
snprintfrr(client_string, sizeof(client_string), "%s[%u:%u]",

zebra/zserv.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,21 @@ struct zserv {
215215
* relative to last_read_time.
216216
*/
217217

218+
pthread_mutex_t stats_mtx;
219+
/* BEGIN covered by stats_mtx */
220+
218221
/* monotime of client creation */
219-
_Atomic uint64_t connect_time;
222+
uint64_t connect_time;
220223
/* monotime of last message received */
221-
_Atomic uint64_t last_read_time;
224+
uint64_t last_read_time;
222225
/* monotime of last message sent */
223-
_Atomic uint64_t last_write_time;
226+
uint64_t last_write_time;
224227
/* command code of last message read */
225-
_Atomic uint64_t last_read_cmd;
228+
uint64_t last_read_cmd;
226229
/* command code of last message written */
227-
_Atomic uint64_t last_write_cmd;
230+
uint64_t last_write_cmd;
231+
232+
/* END covered by stats_mtx */
228233

229234
/*
230235
* Number of instances configured with

0 commit comments

Comments
 (0)