* [PATCH] network mega patch
@ 2012-05-03 19:19 Bean
2012-05-03 19:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 7+ messages in thread
From: Bean @ 2012-05-03 19:19 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
Hi,
This patch fixes some serious bugs and memory leaks in the network
stack. It also contains two optimization:
1, use default block size of 4096. block size is configurable via
tftp_block_size environment variable.
2, reuse netbuff in efinet driver when there is no data, this saves
some alloc/free loops.
--
Best wishes
Bean
[-- Attachment #2: net.txt --]
[-- Type: text/plain, Size: 7704 bytes --]
=== modified file 'grub-core/net/drivers/efi/efinet.c'
--- grub-core/net/drivers/efi/efinet.c 2012-03-10 19:41:28 +0000
+++ grub-core/net/drivers/efi/efinet.c 2012-05-03 18:48:18 +0000
@@ -54,6 +54,8 @@
}
}
+struct grub_net_buff *saved_nb;
+
static struct grub_net_buff *
get_card_packet (const struct grub_net_card *dev)
{
@@ -63,18 +65,23 @@
grub_efi_uintn_t bufsize = 1536;
struct grub_net_buff *nb;
- nb = grub_netbuff_alloc (bufsize);
- if (!nb)
- return NULL;
+ if (saved_nb)
+ {
+ nb = saved_nb;
+ grub_netbuff_clear (nb);
+ saved_nb = NULL;
+ }
+ else
+ {
+ nb = grub_netbuff_alloc (bufsize + 2);
+ if (!nb)
+ return NULL;
+ }
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
- by 4. So that IP header is aligned on 4 bytes. */
+ by 4. So that IP header is aligned on 4 bytes.
+ This can't fail because buffer is at least 2 bytes. */
grub_netbuff_reserve (nb, 2);
- if (!nb)
- {
- grub_netbuff_free (nb);
- return NULL;
- }
st = efi_call_7 (net->receive, net, NULL, &bufsize,
nb->data, NULL, NULL, NULL);
@@ -84,31 +91,27 @@
bufsize = ALIGN_UP (bufsize, 32);
- nb = grub_netbuff_alloc (bufsize);
+ nb = grub_netbuff_alloc (bufsize + 2);
if (!nb)
return NULL;
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
- by 4. So that IP header is aligned on 4 bytes. */
+ by 4. So that IP header is aligned on 4 bytes.
+ This can't fail because buffer is at least 2 bytes. */
grub_netbuff_reserve (nb, 2);
- if (!nb)
- {
- grub_netbuff_free (nb);
- return NULL;
- }
st = efi_call_7 (net->receive, net, NULL, &bufsize,
nb->data, NULL, NULL, NULL);
}
if (st != GRUB_EFI_SUCCESS)
{
- grub_netbuff_free (nb);
+ saved_nb = nb;
return NULL;
}
err = grub_netbuff_put (nb, bufsize);
if (err)
{
- grub_netbuff_free (nb);
+ saved_nb = nb;
return NULL;
}
@@ -236,6 +239,9 @@
{
struct grub_net_card *card, *next;
+ if (saved_nb)
+ grub_netbuff_free (saved_nb);
+
FOR_NET_CARDS_SAFE (card, next)
if (card->driver == &efidriver)
grub_net_card_unregister (card);
=== modified file 'grub-core/net/ip.c'
--- grub-core/net/ip.c 2012-02-09 22:43:43 +0000
+++ grub-core/net/ip.c 2012-05-03 19:13:42 +0000
@@ -84,7 +84,7 @@
grub_uint8_t proto;
grub_uint64_t last_time;
grub_priority_queue_t pq;
- grub_uint8_t *asm_buffer;
+ struct grub_net_buff *asm_netbuff;
grub_size_t total_len;
grub_size_t cur_ptr;
grub_uint8_t ttl;
@@ -342,8 +342,10 @@
grub_netbuff_free (*nb);
grub_priority_queue_pop (rsm->pq);
}
- grub_free (rsm->asm_buffer);
+ if (rsm->asm_netbuff)
+ grub_netbuff_free (rsm->asm_netbuff);
grub_priority_queue_destroy (rsm->pq);
+ grub_free (rsm);
}
static void
@@ -352,12 +354,16 @@
struct reassemble *rsm, **prev;
grub_uint64_t limit_time = grub_get_time_ms () - 90000;
- for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev)
+ for (prev = &reassembles, rsm = *prev; rsm; rsm = *prev)
if (rsm->last_time < limit_time)
{
*prev = rsm->next;
free_rsm (rsm);
}
+ else
+ {
+ prev = &rsm->next;
+ }
}
static grub_err_t
@@ -464,7 +470,7 @@
grub_free (rsm);
return grub_errno;
}
- rsm->asm_buffer = 0;
+ rsm->asm_netbuff = 0;
rsm->total_len = 0;
rsm->cur_ptr = 0;
rsm->ttl = 0xff;
@@ -483,22 +489,21 @@
rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
+ (nb->tail - nb->data));
rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t));
- rsm->asm_buffer = grub_zalloc (rsm->total_len);
- if (!rsm->asm_buffer)
+ rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len);
+ if (!rsm->asm_netbuff)
{
*prev = rsm->next;
free_rsm (rsm);
return grub_errno;
}
}
- if (!rsm->asm_buffer)
+ if (!rsm->asm_netbuff)
return GRUB_ERR_NONE;
while (1)
{
struct grub_net_buff **nb_top_p, *nb_top;
grub_size_t copy;
- grub_uint8_t *res;
grub_size_t res_len;
struct grub_net_buff *ret;
grub_net_ip_protocol_t proto;
@@ -523,7 +528,10 @@
}
if (rsm->cur_ptr < (grub_size_t) 8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK))
- return GRUB_ERR_NONE;
+ {
+ grub_netbuff_free (nb_top);
+ return GRUB_ERR_NONE;
+ }
rsm->cur_ptr = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
+ (nb_top->tail - nb_top->head));
@@ -538,31 +546,33 @@
< copy)
copy = rsm->total_len - 8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK);
- grub_memcpy (&rsm->asm_buffer[8 * (grub_be_to_cpu16 (iph->frags)
+ grub_memcpy (&rsm->asm_netbuff->data[8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK)],
nb_top->data, copy);
if ((grub_be_to_cpu16 (iph->frags) & MORE_FRAGMENTS))
- continue;
-
- res = rsm->asm_buffer;
+ {
+ grub_netbuff_free (nb_top);
+ continue;
+ }
+ grub_netbuff_free (nb_top);
+
+ ret = rsm->asm_netbuff;
proto = rsm->proto;
src = rsm->source;
dst = rsm->dest;
ttl = rsm->ttl;
- rsm->asm_buffer = 0;
+ rsm->asm_netbuff = 0;
res_len = rsm->total_len;
*prev = rsm->next;
free_rsm (rsm);
- ret = grub_malloc (sizeof (*ret));
- if (!ret)
+
+ if (grub_netbuff_put (ret, res_len))
{
- grub_free (res);
- return grub_errno;
+ grub_netbuff_free (ret);
+ return GRUB_ERR_NONE;
}
- ret->data = ret->head = res;
- ret->tail = ret->end = res + res_len;
source.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
source.ipv4 = src;
=== modified file 'grub-core/net/tftp.c'
--- grub-core/net/tftp.c 2012-02-12 18:11:06 +0000
+++ grub-core/net/tftp.c 2012-05-03 19:13:03 +0000
@@ -27,6 +27,7 @@
#include <grub/file.h>
#include <grub/priority_queue.h>
#include <grub/i18n.h>
+#include <grub/env.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -214,6 +215,7 @@
tftph = (struct tftphdr *) nb_top->data;
if (grub_be_to_cpu16 (tftph->u.data.block) >= data->block + 1)
break;
+ grub_netbuff_free (nb_top);
grub_priority_queue_pop (data->pq);
}
if (grub_be_to_cpu16 (tftph->u.data.block) == data->block + 1)
@@ -248,7 +250,7 @@
if ((nb_top->tail - nb_top->data) > 0)
grub_net_put_packet (&file->device->net->packs, nb_top);
else
- grub_netbuff_free (nb);
+ grub_netbuff_free (nb_top);
}
}
return GRUB_ERR_NONE;
@@ -269,7 +271,10 @@
{
struct grub_net_buff **nb_p;
while ((nb_p = grub_priority_queue_top (data->pq)))
- grub_netbuff_free (*nb_p);
+ {
+ grub_netbuff_free (*nb_p);
+ grub_priority_queue_pop (data->pq);
+ }
grub_priority_queue_destroy (data->pq);
}
@@ -288,6 +293,7 @@
grub_err_t err;
grub_uint8_t *nbd;
grub_net_network_level_address_t addr;
+ const char *tftp_block_size;
data = grub_zalloc (sizeof (*data));
if (!data)
@@ -320,9 +326,12 @@
rrqlen += grub_strlen ("blksize") + 1;
rrq += grub_strlen ("blksize") + 1;
- grub_strcpy (rrq, "1024");
- rrqlen += grub_strlen ("1024") + 1;
- rrq += grub_strlen ("1024") + 1;
+ tftp_block_size = grub_env_get ("tftp_block_size");
+ if (tftp_block_size == NULL)
+ tftp_block_size = "4096";
+ grub_strcpy (rrq, tftp_block_size);
+ rrqlen += grub_strlen (tftp_block_size) + 1;
+ rrq += grub_strlen (tftp_block_size) + 1;
grub_strcpy (rrq, "tsize");
rrqlen += grub_strlen ("tsize") + 1;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-03 19:19 [PATCH] network mega patch Bean
@ 2012-05-03 19:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-03 19:40 ` Bean
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-05-03 19:28 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
On 03.05.2012 21:19, Bean wrote:
> Hi,
>
> This patch fixes some serious bugs and memory leaks in the network
> stack. It also contains two optimization:
>
> 1, use default block size of 4096. block size is configurable via
> tftp_block_size environment variable.
> 2, reuse netbuff in efinet driver when there is no data, this saves
> some alloc/free loops.
Could you send the parts which actually fix bugs? And based on the HEAD,
not on older checkout.
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-03 19:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2012-05-03 19:40 ` Bean
2012-05-03 19:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 7+ messages in thread
From: Bean @ 2012-05-03 19:40 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]
Hi,
No problem. I split the patch into two parts.
On Fri, May 4, 2012 at 3:28 AM, Vladimir 'φ-coder/phcoder' Serbinenko
<phcoder@gmail.com> wrote:
> On 03.05.2012 21:19, Bean wrote:
>> Hi,
>>
>> This patch fixes some serious bugs and memory leaks in the network
>> stack. It also contains two optimization:
>>
>> 1, use default block size of 4096. block size is configurable via
>> tftp_block_size environment variable.
>> 2, reuse netbuff in efinet driver when there is no data, this saves
>> some alloc/free loops.
> Could you send the parts which actually fix bugs? And based on the HEAD,
> not on older checkout.
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Best wishes
Bean
[-- Attachment #2: bug.txt --]
[-- Type: text/plain, Size: 4516 bytes --]
=== modified file 'grub-core/net/ip.c'
--- grub-core/net/ip.c 2012-05-01 13:29:44 +0000
+++ grub-core/net/ip.c 2012-05-03 19:32:19 +0000
@@ -84,7 +84,7 @@
grub_uint8_t proto;
grub_uint64_t last_time;
grub_priority_queue_t pq;
- grub_uint8_t *asm_buffer;
+ struct grub_net_buff *asm_netbuff;
grub_size_t total_len;
grub_size_t cur_ptr;
grub_uint8_t ttl;
@@ -351,8 +351,10 @@
grub_netbuff_free (*nb);
grub_priority_queue_pop (rsm->pq);
}
- grub_free (rsm->asm_buffer);
+ if (rsm->asm_netbuff)
+ grub_netbuff_free (rsm->asm_netbuff);
grub_priority_queue_destroy (rsm->pq);
+ grub_free (rsm);
}
static void
@@ -361,12 +363,16 @@
struct reassemble *rsm, **prev;
grub_uint64_t limit_time = grub_get_time_ms () - 90000;
- for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev)
+ for (prev = &reassembles, rsm = *prev; rsm; rsm = *prev)
if (rsm->last_time < limit_time)
{
*prev = rsm->next;
free_rsm (rsm);
}
+ else
+ {
+ prev = &rsm->next;
+ }
}
static grub_err_t
@@ -473,7 +479,7 @@
grub_free (rsm);
return grub_errno;
}
- rsm->asm_buffer = 0;
+ rsm->asm_netbuff = 0;
rsm->total_len = 0;
rsm->cur_ptr = 0;
rsm->ttl = 0xff;
@@ -492,22 +498,21 @@
rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
+ (nb->tail - nb->data));
rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t));
- rsm->asm_buffer = grub_zalloc (rsm->total_len);
- if (!rsm->asm_buffer)
+ rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len);
+ if (!rsm->asm_netbuff)
{
*prev = rsm->next;
free_rsm (rsm);
return grub_errno;
}
}
- if (!rsm->asm_buffer)
+ if (!rsm->asm_netbuff)
return GRUB_ERR_NONE;
while (1)
{
struct grub_net_buff **nb_top_p, *nb_top;
grub_size_t copy;
- grub_uint8_t *res;
grub_size_t res_len;
struct grub_net_buff *ret;
grub_net_ip_protocol_t proto;
@@ -532,7 +537,10 @@
}
if (rsm->cur_ptr < (grub_size_t) 8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK))
- return GRUB_ERR_NONE;
+ {
+ grub_netbuff_free (nb_top);
+ return GRUB_ERR_NONE;
+ }
rsm->cur_ptr = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
+ (nb_top->tail - nb_top->head));
@@ -547,31 +555,33 @@
< copy)
copy = rsm->total_len - 8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK);
- grub_memcpy (&rsm->asm_buffer[8 * (grub_be_to_cpu16 (iph->frags)
+ grub_memcpy (&rsm->asm_netbuff->data[8 * (grub_be_to_cpu16 (iph->frags)
& OFFSET_MASK)],
nb_top->data, copy);
if ((grub_be_to_cpu16 (iph->frags) & MORE_FRAGMENTS))
- continue;
-
- res = rsm->asm_buffer;
+ {
+ grub_netbuff_free (nb_top);
+ continue;
+ }
+ grub_netbuff_free (nb_top);
+
+ ret = rsm->asm_netbuff;
proto = rsm->proto;
src = rsm->source;
dst = rsm->dest;
ttl = rsm->ttl;
- rsm->asm_buffer = 0;
+ rsm->asm_netbuff = 0;
res_len = rsm->total_len;
*prev = rsm->next;
free_rsm (rsm);
- ret = grub_malloc (sizeof (*ret));
- if (!ret)
+
+ if (grub_netbuff_put (ret, res_len))
{
- grub_free (res);
- return grub_errno;
+ grub_netbuff_free (ret);
+ return GRUB_ERR_NONE;
}
- ret->data = ret->head = res;
- ret->tail = ret->end = res + res_len;
source.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
source.ipv4 = src;
=== modified file 'grub-core/net/tftp.c'
--- grub-core/net/tftp.c 2012-02-12 18:11:06 +0000
+++ grub-core/net/tftp.c 2012-05-03 19:13:03 +0000
@@ -214,6 +215,7 @@
tftph = (struct tftphdr *) nb_top->data;
if (grub_be_to_cpu16 (tftph->u.data.block) >= data->block + 1)
break;
+ grub_netbuff_free (nb_top);
grub_priority_queue_pop (data->pq);
}
if (grub_be_to_cpu16 (tftph->u.data.block) == data->block + 1)
@@ -248,7 +250,7 @@
if ((nb_top->tail - nb_top->data) > 0)
grub_net_put_packet (&file->device->net->packs, nb_top);
else
- grub_netbuff_free (nb);
+ grub_netbuff_free (nb_top);
}
}
return GRUB_ERR_NONE;
@@ -269,7 +271,10 @@
{
struct grub_net_buff **nb_p;
while ((nb_p = grub_priority_queue_top (data->pq)))
- grub_netbuff_free (*nb_p);
+ {
+ grub_netbuff_free (*nb_p);
+ grub_priority_queue_pop (data->pq);
+ }
grub_priority_queue_destroy (data->pq);
}
[-- Attachment #3: opt.txt --]
[-- Type: text/plain, Size: 2467 bytes --]
=== modified file 'grub-core/net/drivers/efi/efinet.c'
--- grub-core/net/drivers/efi/efinet.c 2012-04-29 16:43:22 +0000
+++ grub-core/net/drivers/efi/efinet.c 2012-05-03 19:35:35 +0000
@@ -54,6 +54,8 @@
}
}
+struct grub_net_buff *saved_nb;
+
static struct grub_net_buff *
get_card_packet (const struct grub_net_card *dev)
{
@@ -63,9 +65,18 @@
grub_efi_uintn_t bufsize = 1536;
struct grub_net_buff *nb;
- nb = grub_netbuff_alloc (bufsize + 2);
- if (!nb)
- return NULL;
+ if (saved_nb)
+ {
+ nb = saved_nb;
+ grub_netbuff_clear (nb);
+ saved_nb = NULL;
+ }
+ else
+ {
+ nb = grub_netbuff_alloc (bufsize + 2);
+ if (!nb)
+ return NULL;
+ }
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
by 4. So that IP header is aligned on 4 bytes. */
@@ -100,13 +111,13 @@
}
if (st != GRUB_EFI_SUCCESS)
{
- grub_netbuff_free (nb);
+ saved_nb = nb;
return NULL;
}
err = grub_netbuff_put (nb, bufsize);
if (err)
{
- grub_netbuff_free (nb);
+ saved_nb = nb;
return NULL;
}
@@ -234,6 +245,9 @@
{
struct grub_net_card *card, *next;
+ if (saved_nb)
+ grub_netbuff_free (saved_nb);
+
FOR_NET_CARDS_SAFE (card, next)
if (card->driver == &efidriver)
grub_net_card_unregister (card);
=== modified file 'grub-core/net/tftp.c'
--- grub-core/net/tftp.c 2012-02-12 18:11:06 +0000
+++ grub-core/net/tftp.c 2012-05-03 19:13:03 +0000
@@ -27,6 +27,7 @@
#include <grub/file.h>
#include <grub/priority_queue.h>
#include <grub/i18n.h>
+#include <grub/env.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -288,6 +293,7 @@
grub_err_t err;
grub_uint8_t *nbd;
grub_net_network_level_address_t addr;
+ const char *tftp_block_size;
data = grub_zalloc (sizeof (*data));
if (!data)
@@ -320,9 +326,12 @@
rrqlen += grub_strlen ("blksize") + 1;
rrq += grub_strlen ("blksize") + 1;
- grub_strcpy (rrq, "1024");
- rrqlen += grub_strlen ("1024") + 1;
- rrq += grub_strlen ("1024") + 1;
+ tftp_block_size = grub_env_get ("tftp_block_size");
+ if (tftp_block_size == NULL)
+ tftp_block_size = "4096";
+ grub_strcpy (rrq, tftp_block_size);
+ rrqlen += grub_strlen (tftp_block_size) + 1;
+ rrq += grub_strlen (tftp_block_size) + 1;
grub_strcpy (rrq, "tsize");
rrqlen += grub_strlen ("tsize") + 1;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-03 19:40 ` Bean
@ 2012-05-03 19:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 3:43 ` Bean
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-05-03 19:50 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 300 bytes --]
On 03.05.2012 21:40, Bean wrote:
> + if (rsm->asm_netbuff)
> + grub_netbuff_free (rsm->asm_netbuff);
Could you make grub_netbuff_free skip on NULL and so simplify it here?
When you've done this you can commit bug.diff.
Thank you
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-03 19:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2012-05-04 3:43 ` Bean
2012-05-04 6:07 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 7+ messages in thread
From: Bean @ 2012-05-04 3:43 UTC (permalink / raw)
To: The development of GNU GRUB
On Fri, May 4, 2012 at 3:50 AM, Vladimir 'φ-coder/phcoder' Serbinenko
<phcoder@gmail.com> wrote:
> On 03.05.2012 21:40, Bean wrote:
>> + if (rsm->asm_netbuff)
>> + grub_netbuff_free (rsm->asm_netbuff);
> Could you make grub_netbuff_free skip on NULL and so simplify it here?
Hi,
I think this is one of the few place where netbuff can be NULL (it
usually return error when grub_netbuff_alloc return NULL), since
grub_netbuff_free is called a lot, it might have a little performance
impact when we do the check in grub_netbuff_free.
> When you've done this you can commit bug.diff.
> Thank you
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Best wishes
Bean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-04 3:43 ` Bean
@ 2012-05-04 6:07 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 7:04 ` Bean
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-05-04 6:07 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]
On 04.05.2012 05:43, Bean wrote:
> On Fri, May 4, 2012 at 3:50 AM, Vladimir 'φ-coder/phcoder' Serbinenko
> <phcoder@gmail.com> wrote:
>> On 03.05.2012 21:40, Bean wrote:
>>> + if (rsm->asm_netbuff)
>>> + grub_netbuff_free (rsm->asm_netbuff);
>> Could you make grub_netbuff_free skip on NULL and so simplify it here?
> Hi,
>
> I think this is one of the few place where netbuff can be NULL (it
> usually return error when grub_netbuff_alloc return NULL), since
> grub_netbuff_free is called a lot, it might have a little performance
> impact when we do the check in grub_netbuff_free.
It's not called that much that this additional check would be a
performance hit. But it decreases the probability of similar bugs to
essentially zero.
>> When you've done this you can commit bug.diff.
>> Thank you
>>
>> --
>> Regards
>> Vladimir 'φ-coder/phcoder' Serbinenko
>>
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] network mega patch
2012-05-04 6:07 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2012-05-04 7:04 ` Bean
0 siblings, 0 replies; 7+ messages in thread
From: Bean @ 2012-05-04 7:04 UTC (permalink / raw)
To: The development of GNU GRUB
On Fri, May 4, 2012 at 2:07 PM, Vladimir 'φ-coder/phcoder' Serbinenko
<phcoder@gmail.com> wrote:
> On 04.05.2012 05:43, Bean wrote:
>> On Fri, May 4, 2012 at 3:50 AM, Vladimir 'φ-coder/phcoder' Serbinenko
>> <phcoder@gmail.com> wrote:
>>> On 03.05.2012 21:40, Bean wrote:
>>>> + if (rsm->asm_netbuff)
>>>> + grub_netbuff_free (rsm->asm_netbuff);
>>> Could you make grub_netbuff_free skip on NULL and so simplify it here?
>> Hi,
>>
>> I think this is one of the few place where netbuff can be NULL (it
>> usually return error when grub_netbuff_alloc return NULL), since
>> grub_netbuff_free is called a lot, it might have a little performance
>> impact when we do the check in grub_netbuff_free.
> It's not called that much that this additional check would be a
> performance hit. But it decreases the probability of similar bugs to
> essentially zero.
Hi,
Ok, no problem, pls make the change and commit it for me.
>>> When you've done this you can commit bug.diff.
>>> Thank you
>>>
>>> --
>>> Regards
>>> Vladimir 'φ-coder/phcoder' Serbinenko
>>>
>>>
>>>
>>> _______________________________________________
>>> Grub-devel mailing list
>>> Grub-devel@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>
>>
>>
>
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Best wishes
Bean
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-04 7:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 19:19 [PATCH] network mega patch Bean
2012-05-03 19:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-03 19:40 ` Bean
2012-05-03 19:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 3:43 ` Bean
2012-05-04 6:07 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 7:04 ` Bean
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.