Message ID | 20201009035155.310250-1-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | libpdbg: Do not free sbefifo during release of all targets | expand |
On Fri, 9 Oct 2020 at 03:54, Amitay Isaacs <amitay@ozlabs.org> wrote: > > Pdbg releases all targets before exiting. P9 core/thread targets when > released use scoms for special wakeup. However, when using sbefifo > backend, sbefifo driver is released before core/thread targets. > This casuses segfault as scom access tries to use already free'd causes > sbefifo context. > > Correct fix is to add reference counting on sbefifo context and free only > when all the refernces have been released. A quick and dirty fix here references > is to drop freeing sbefifo context. Proper fix will be implemented later. > > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> Reviewed-by: Joel Stanley <joel@jms.id.au> > --- > libpdbg/sbefifo.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c > index 6e45088..9d68853 100644 > --- a/libpdbg/sbefifo.c > +++ b/libpdbg/sbefifo.c > @@ -647,9 +647,11 @@ static int sbefifo_probe(struct pdbg_target *target) > > static void sbefifo_release(struct pdbg_target *target) > { > - struct sbefifo *sf = target_to_sbefifo(target); > - > - sbefifo_disconnect(sf->sf_ctx); > + /* > + * FIXME: Need to add reference counting for sbefifo context, so it is > + * not freed till every last hwunit using sbefifo driver has been > + * released. > + */ > } > > static struct mem sbefifo_mem = { > -- > 2.26.2 > > -- > Pdbg mailing list > Pdbg@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/pdbg
diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 6e45088..9d68853 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -647,9 +647,11 @@ static int sbefifo_probe(struct pdbg_target *target) static void sbefifo_release(struct pdbg_target *target) { - struct sbefifo *sf = target_to_sbefifo(target); - - sbefifo_disconnect(sf->sf_ctx); + /* + * FIXME: Need to add reference counting for sbefifo context, so it is + * not freed till every last hwunit using sbefifo driver has been + * released. + */ } static struct mem sbefifo_mem = {
Pdbg releases all targets before exiting. P9 core/thread targets when released use scoms for special wakeup. However, when using sbefifo backend, sbefifo driver is released before core/thread targets. This casuses segfault as scom access tries to use already free'd sbefifo context. Correct fix is to add reference counting on sbefifo context and free only when all the refernces have been released. A quick and dirty fix here is to drop freeing sbefifo context. Proper fix will be implemented later. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/sbefifo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)