[libvirt PATCH 1/3] virNWFilterRuleDefFixup: Factor out ethHdr as variable
Daniel P. Berrangé
berrange at redhat.com
Fri Sep 17 14:02:45 UTC 2021
On Fri, Sep 17, 2021 at 03:37:25PM +0200, Tim Wiederhake wrote:
> On Fri, 2021-09-17 at 14:08 +0100, Daniel P. Berrangé wrote:
> > On Fri, Sep 17, 2021 at 02:58:09PM +0200, Tim Wiederhake wrote:
> > > This helps to bring down the frame size of virNWFilterRuleDefFixup,
> > > as it
> > > exceeds 8192 bytes when libvirt is build with sanitizers enabled,
> > > in debug
> > > mode, on clang.
> > >
> > > Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
> > > ---
> > > src/conf/nwfilter_conf.c | 16 ++++++++--------
> > > 1 file changed, 8 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
> > > index a3109962af..62334edeec 100644
> > > --- a/src/conf/nwfilter_conf.c
> > > +++ b/src/conf/nwfilter_conf.c
> > > @@ -2189,23 +2189,23 @@ virNWFilterRuleValidate(virNWFilterRuleDef
> > > *rule)
> > > static void
> > > virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
> > > {
> > > + ethHdrDataDef *ethHdr;
> > > +
> > > #define COPY_NEG_SIGN(A, B) \
> > > (A).flags = ((A).flags & ~NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) | \
> > > ((B).flags & NWFILTER_ENTRY_ITEM_FLAG_IS_NEG);
> > >
> > > switch (rule->prtclType) {
> > > case VIR_NWFILTER_RULE_PROTOCOL_MAC:
> > > - COPY_NEG_SIGN(rule->p.ethHdrFilter.ethHdr.dataSrcMACMask,
> > > - rule->p.ethHdrFilter.ethHdr.dataSrcMACAddr);
> > > - COPY_NEG_SIGN(rule->p.ethHdrFilter.ethHdr.dataDstMACMask,
> > > - rule->p.ethHdrFilter.ethHdr.dataDstMACAddr);
> > > + ethHdr = &rule->p.ethHdrFilter.ethHdr;
> > > + COPY_NEG_SIGN(ethHdr->dataSrcMACMask, ethHdr-
> > > >dataSrcMACAddr);
> > > + COPY_NEG_SIGN(ethHdr->dataDstMACMask, ethHdr-
> > > >dataDstMACAddr);
> >
> > I don't get why this reduces stack size at all ?
> >
> > COPY_NEG_SIGN is just doing a bitwise and + or + assignment
> > which doesn't require any intermediate variables.
> >
> >
> > Regards,
> > Daniel
>
> I believe it's debug information for something that gets optimized away
> in non-debug (i.e. release) builds.
>
> Do you know of a way to ask clang to explain what takes up the space in
> a stack frame?
Not unless -save-temps shows it in the intermediate files
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list