Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h2: Integrate h2_rxbuf_storage (6.0) #4004

Merged
merged 33 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4213e41
Move the "loop" word up to global level, so it works everywhere.
bsdphk Oct 15, 2020
2fb443b
Consume less random bits, and don't pace after ramp-up
bsdphk Feb 8, 2019
37933b9
Optimize varnishtests central scheduler
bsdphk Feb 8, 2019
da535e2
Implement an optional high performance "cleaner"
bsdphk Feb 8, 2019
ad65268
Add Debug to the default VSL mask
dridi May 16, 2019
b32d7c2
Merge from VTEST:
bsdphk Dec 2, 2019
ac0d657
varnishtest: Tweak default h2 window parameters
dridi Oct 19, 2020
bd4bdd1
vtc_varnish: Log h2 frames
dridi Jun 15, 2023
483e330
STV temp buffer API
mbgrydeland Jun 22, 2021
3d547b6
Simple STV temp buffer implementation
mbgrydeland Jun 22, 2021
d3725f1
Use SML_AllocBuf with -smalloc
mbgrydeland Jun 22, 2021
415b9d6
Use SML_AllocBuf also for -sfile
mbgrydeland Jun 22, 2021
15d7f72
Make h2_del_req take a non-const struct h2_req
mbgrydeland Jun 22, 2021
519e8fd
h2: Explode include/tbl/h2_error.h
dridi Jan 25, 2021
f6834ac
h2: Add a sess_close reason to h2 connection errors
dridi Jan 25, 2021
aa80994
Set up 'wrk->vsl' pointer for H/2 session thread
mbgrydeland Aug 11, 2021
78fdb2b
Redo H/2 tx data handling
mbgrydeland Jun 22, 2021
7241bac
Make f00007.vtc stable
mbgrydeland Jun 22, 2021
b7188c6
Use `timeout_idle` as a timeout for request body
mbgrydeland Jun 22, 2021
0412f12
Adjust the minimum value of h2_initial_window_size
mbgrydeland Apr 27, 2021
7a27b28
Make H/2 varnishtest ignore window updates while in rxreq/rxresp
mbgrydeland Jun 22, 2021
765394f
Stabilise test cases
mbgrydeland Jun 22, 2021
b66628c
Add H/2 stream data head of line blocking test case
mbgrydeland Jun 22, 2021
5b672ff
Add test case for large req body buffer use
mbgrydeland Jun 22, 2021
bdba4ca
Improve the panic output when triggered on an H2 session
mbgrydeland May 19, 2021
69f7d32
Panic dump H2 rxbuf
mbgrydeland May 19, 2021
ca96da5
Panic H2 local and remote settings
mbgrydeland May 19, 2021
b02125c
Test case that buffers fully before starting to consume the req body
mbgrydeland Jun 22, 2021
4cdebca
Varnishtest: Allow padding up to and including 255 bytes
mbgrydeland Jun 22, 2021
068e95c
Implement handling of padding bytes in received data frames
mbgrydeland Jun 22, 2021
cfe8518
Add a test case for exhausting window by padding
mbgrydeland Jun 22, 2021
44316f7
New 'h2_rxbuf_storage' param to set rxbuf stevedore
mbgrydeland Aug 11, 2021
c12b82a
vtc: Stabilize r02305.vtc
dridi Oct 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/varnishd/cache/cache_varnishd.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ void STV_BanExport(const uint8_t *banlist, unsigned len);
int STV_NewObject(struct worker *, struct objcore *,
const struct stevedore *, unsigned len);

struct stv_buffer;
struct stv_buffer *STV_AllocBuf(struct worker *wrk, const struct stevedore *stv,
size_t size);
void STV_FreeBuf(struct worker *wrk, struct stv_buffer **pstvbuf);
void *STV_GetBufPtr(struct stv_buffer *stvbuf, size_t *psize);

#if WITH_PERSISTENT_STORAGE
/* storage_persistent.c */
Expand Down
25 changes: 17 additions & 8 deletions bin/varnishd/http2/cache_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ struct h2_error_s {
uint32_t val;
int stream;
int connection;
enum sess_close reason;
};

typedef const struct h2_error_s *h2_error;

#define H2EC0(U,v,d)
#define H2EC1(U,v,d) extern const struct h2_error_s H2CE_##U[1];
#define H2EC2(U,v,d) extern const struct h2_error_s H2SE_##U[1];
#define H2EC3(U,v,d) H2EC1(U,v,d) H2EC2(U,v,d)
#define H2_ERROR(NAME, val, sc, desc) H2EC##sc(NAME, val, desc)
#define H2EC1(U,v,r,d) extern const struct h2_error_s H2CE_##U[1];
#define H2EC2(U,v,r,d) extern const struct h2_error_s H2SE_##U[1];
#define H2EC3(U,v,r,d) H2EC1(U,v,r,d) H2EC2(U,v,r,d)
#define H2_ERROR(NAME, val, sc, reason, desc) H2EC##sc(NAME, val, reason, desc)
#include "tbl/h2_error.h"
#undef H2EC1
#undef H2EC2
Expand Down Expand Up @@ -113,6 +113,16 @@ enum h2_stream_e {
#define H2_FRAME_FLAGS(l,u,v) extern const uint8_t H2FF_##u;
#include "tbl/h2_frames.h"

struct h2_rxbuf {
unsigned magic;
#define H2_RXBUF_MAGIC 0x73f9fb27
unsigned size;
uint64_t tail;
uint64_t head;
struct stv_buffer *stvbuf;
uint8_t data[];
};

struct h2_req {
unsigned magic;
#define H2_REQ_MAGIC 0x03411584
Expand All @@ -131,7 +141,7 @@ struct h2_req {
/* Where to wake this stream up */
struct worker *wrk;

ssize_t reqbody_bytes;
struct h2_rxbuf *rxbuf;

VTAILQ_ENTRY(h2_req) tx_list;
h2_error error;
Expand All @@ -146,7 +156,6 @@ struct h2_sess {
#define H2_SESS_MAGIC 0xa16f7e4b

pthread_t rxthr;
struct h2_req *mailcall;
pthread_cond_t *cond;
pthread_cond_t winupd_cond[1];

Expand Down Expand Up @@ -240,7 +249,7 @@ void H2_Send(struct worker *, struct h2_req *, h2_frame type, uint8_t flags,
struct h2_req * h2_new_req(const struct worker *, struct h2_sess *,
unsigned stream, struct req *);
int h2_stream_tmo(struct h2_sess *, const struct h2_req *, vtim_real);
void h2_del_req(struct worker *, const struct h2_req *);
void h2_del_req(struct worker *, struct h2_req *);
void h2_kill_req(struct worker *, struct h2_sess *, struct h2_req *, h2_error);
int h2_rxframe(struct worker *, struct h2_sess *);
h2_error h2_set_setting(struct h2_sess *, const uint8_t *);
Expand Down
79 changes: 73 additions & 6 deletions bin/varnishd/http2/cache_http2_panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@
#include "cache/cache_transport.h"
#include "http2/cache_http2.h"

static const char *
h2_panic_error(const struct h2_error_s *e)
{
if (e == NULL)
return ("(null)");
else
return (e->name);
}

static void
h2_panic_settings(struct vsb *vsb, const struct h2_settings *s)
{
int cont = 0;

#define H2_SETTING(U,l,...) \
if (cont) \
VSB_printf(vsb, ", "); \
cont = 1; \
VSB_printf(vsb, "0x%x", s->l);
#include "tbl/h2_settings.h"
#undef H2_SETTING
}

void
h2_sess_panic(struct vsb *vsb, const struct sess *sp)
{
Expand All @@ -44,21 +67,65 @@ h2_sess_panic(struct vsb *vsb, const struct sess *sp)
AZ(SES_Get_proto_priv(sp, &up));

h2 = (void*)*up;
CHECK_OBJ_NOTNULL(h2, H2_SESS_MAGIC);
VSB_printf(vsb, "h2_sess = %p,\n", h2);
PAN_CheckMagic(vsb, h2, H2_SESS_MAGIC);
if (!VALID_OBJ(h2, H2_SESS_MAGIC))
return;
VSB_printf(vsb, "refcnt = %d, bogosity = %d, error = %s\n",
h2->refcnt, h2->bogosity, h2_panic_error(h2->error));
VSB_printf(vsb,
"open_streams = %d, highest_stream = %u,"
" goaway_last_stream = %u,\n",
h2->open_streams, h2->highest_stream, h2->goaway_last_stream);
VSB_printf(vsb, "local_settings = {");
h2_panic_settings(vsb, &h2->local_settings);
VSB_printf(vsb, "},\n");
VSB_printf(vsb, "remote_settings = {");
h2_panic_settings(vsb, &h2->remote_settings);
VSB_printf(vsb, "},\n");
VSB_printf(vsb,
"{rxf_len, rxf_type, rxf_flags, rxf_stream} ="
" {%u, %u, 0x%x, %u},\n",
h2->rxf_len, h2->rxf_type, h2->rxf_flags, h2->rxf_stream);
VSB_printf(vsb, "streams {\n");
VSB_indent(vsb, 2);
VTAILQ_FOREACH(r2, &h2->streams, list) {
PAN_CheckMagic(vsb, r2, H2_REQ_MAGIC);
VSB_printf(vsb, "0x%08x", r2->stream);
VSB_printf(vsb, "%u %p ", r2->stream, r2);
switch (r2->state) {
#define H2_STREAM(U,sd,d) case H2_S_##U: VSB_printf(vsb, " %-6s", sd); break;
#define H2_STREAM(U,sd,d) case H2_S_##U: VSB_printf(vsb, "%s", sd); break;
#include <tbl/h2_stream.h>
default:
VSB_printf(vsb, " State %d", r2->state);
VSB_printf(vsb, " 0x%x", r2->state);
break;
}
VSB_printf(vsb, "\n");
VSB_printf(vsb, " {\n");
VSB_indent(vsb, 2);

VSB_printf(vsb, "h2_sess = %p, scheduled = %d, error = %s,\n",
r2->h2sess, r2->scheduled, h2_panic_error(r2->error));
VSB_printf(vsb, "t_send = %f, t_winupd = %f,\n",
r2->t_send, r2->t_winupd);
VSB_printf(vsb, "t_window = %jd, r_window = %jd,\n",
r2->t_window, r2->r_window);

VSB_printf(vsb, "rxbuf = %p", r2->rxbuf);
if (r2->rxbuf != NULL) {
VSB_printf(vsb, " {\n");
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, r2->rxbuf, H2_RXBUF_MAGIC);
VSB_printf(vsb, "stvbuf = %p,\n", r2->rxbuf->stvbuf);
VSB_printf(vsb,
"{size, tail, head} = {%u, %ju, %ju},\n",
r2->rxbuf->size, r2->rxbuf->tail, r2->rxbuf->head);
VSB_indent(vsb, -2);
VSB_printf(vsb, "}");
}
VSB_printf(vsb, ",\n");

VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
}
VSB_indent(vsb, -2);
VSB_printf(vsb, "}\n");
VSB_printf(vsb, "},\n");
}
Loading